:root {
  --bg: #0e1117;
  --panel: #161b22;
  --panel-2: #1c2230;
  --border: #2a3140;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #2f81f7;
  --up: #ef4444;      /* 台股紅漲 */
  --down: #16a34a;    /* 綠跌 */
  --warn: #f0b429;
  --danger: #e5484d;   /* 警示／停機；注意本檔 --up 是紅、--down 是綠（台股慣例），不可借用 */
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
a { color: var(--accent); text-decoration: none; }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 8px 18px; min-height: 54px;
  background: var(--panel); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand::before { content: "📈" / ""; margin-inline-end: .35em; }
#nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
#nav a {
  padding: 7px 12px; border-radius: 6px; color: var(--muted); font-weight: 500;
}
#nav a:hover { background: var(--panel-2); color: var(--text); }
#nav a.active { background: var(--accent); color: #fff; }
.status { font-size: 12px; color: var(--muted); white-space: nowrap; }
.status .dot { display:inline-block; width:8px; height:8px; border-radius:50%; background:var(--muted); margin-right:5px; }
.status.live .dot { background: var(--down); }

main { padding: 18px; max-width: 1280px; margin: 0 auto; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; }

h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 18px 0 10px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 16px; flex-wrap: wrap; }
.col { flex: 1; min-width: 0; }

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; margin-bottom: 16px;
}
.card h2:first-child { margin-top: 0; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
/* 內容較長的欄位（標的、參數 JSON…）允許換行，避免撐寬整張表 */
td.wrap-cell { white-space: normal; word-break: break-all; }
/* 我的機器人：長名稱可換行，選股摘要保留可讀欄寬，超寬表格留在卡片內捲動。 */
#b-list { max-width: 100%; overflow-x: auto; }
#b-list .bot-strategy-target { min-width: 170px; width: 190px; word-break: normal; overflow-wrap: break-word; }
:root:not([data-ui="mobile"]) #b-list .bot-strategy-text { min-width: 120px; max-width: 190px; white-space: normal; overflow-wrap: anywhere; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; font-size: 12px; cursor: pointer; user-select: none; }
th[draggable="true"] { cursor: grab; }
th.column-dragging { opacity: 0.55; cursor: grabbing; }
th.column-drag-over { box-shadow: inset 3px 0 0 var(--accent); color: var(--text); }
tbody tr:hover { background: var(--panel-2); }
td.sym { font-weight: 600; }
td.sym a { color: var(--text); }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--muted); }

.tag { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: var(--panel-2); color: var(--muted); }
.tag.mock { color: var(--warn); }
.tag.real { color: var(--down); }
.tag.paper { color: var(--muted); }
.tag.live { color: var(--danger); font-weight: 600; }
.tag.halted { background: var(--danger); color: #fff; font-weight: 600; }
.tag.tag-link { cursor: pointer; }
.tag.tag-link:hover { outline: 1px solid var(--accent); color: var(--text); }

/* 右下角版本徽章：不擋點擊、不搶注意力 */
.app-version {
  position: fixed; right: 10px; bottom: 8px; z-index: 5;
  font-size: 11px; color: var(--muted); opacity: .85; pointer-events: none;
}

/* 從倉位表點策略標籤跳轉「我的機器人」時的列高亮提示 */
tr.row-flash td { animation: row-flash 2.5s ease-out; }
@keyframes row-flash {
  0%, 40% { background: rgba(47, 129, 247, 0.28); }
  100% { background: transparent; }
}

/* 停機橫幅：要一眼看到，不能只是另一個灰色小字 */
.halt-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; border-radius: 8px; margin-bottom: 12px;
  border: 1px solid var(--danger); background: rgba(229, 72, 77, 0.12);
}
.halt-banner.running { border-color: var(--border); background: var(--panel-2); }
.halt-banner .halt-msg { flex: 1; min-width: 220px; font-size: 13px; }
.halt-banner .halt-why { color: var(--muted); font-size: 12px; }

button, .btn {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 8px 14px; font-size: 13px; cursor: pointer; font-weight: 600;
}
button:hover { filter: brightness(1.1); }
button.ghost { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); }
/* --down 是綠色（台股慣例）；危險動作必須是紅色，改用 --danger */
button.danger { background: var(--danger); color: #fff; }
button.sell { background: var(--down); }
button.buy { background: var(--up); color: #fff; }
button.sm { padding: 4px 9px; font-size: 12px; }

/* 策略選擇器：建立、編輯與回測共用，原生 dialog 可疊在編輯視窗上。 */
.strategy-picker-field { display: flex; align-items: center; gap: 8px; min-width: 0; }
.strategy-picker-trigger { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-width: 0; min-height: 38px; text-align: left; }
.strategy-picker-trigger > span:first-child { overflow-wrap: anywhere; }
.strategy-picker-affordance { flex: none; font-size: 11px; font-weight: 400; color: var(--muted); }
.strategy-picker-trigger:disabled { opacity: .5; cursor: not-allowed; }
.strategy-picker-dialog { width: min(800px, calc(100vw - 24px)); max-height: min(780px, calc(100dvh - 32px)); margin: auto; padding: 20px; color: var(--text); background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 24px 80px #0008; }
.strategy-picker-dialog[open] { display: flex; flex-direction: column; }
.strategy-picker-dialog::backdrop { background: #0009; }
.strategy-picker-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.strategy-picker-header h2 { margin: 0; font-size: 19px; }
.strategy-picker-header p { margin: 8px 0 14px; line-height: 1.6; }
.strategy-picker-header > button { flex: none; }
.strategy-picker-search label { display: block; font-weight: 600; margin-bottom: 6px; }
.strategy-picker-search input { width: 100%; }
.strategy-picker-groups { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 12px; }
.strategy-picker-groups button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
.strategy-picker-count { margin: 12px 0 4px; font-size: 12px; }
.strategy-picker-results { overflow: auto; min-height: 80px; overscroll-behavior: contain; padding: 0 4px 4px; }
.strategy-picker-results h3 { font-size: 13px; color: var(--muted); margin: 15px 0 8px; }
.strategy-picker-results ul { list-style: none; margin: 0; padding: 0; }
.strategy-picker-row { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0; }
.strategy-picker-option { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 12px; }
.strategy-picker-option[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.strategy-picker-name { line-height: 1.5; overflow-wrap: anywhere; }
.strategy-picker-hint { font-weight: 400; color: var(--muted); font-size: 12px; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.strategy-picker-help { flex: none; margin-top: 0; }
.strategy-picker-row > .strategy-picker-help { margin-top: 12px; }
.strategy-picker-dialog button:focus-visible, .strategy-picker-dialog a:focus-visible, .strategy-picker-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
:root[data-ui="mobile"] .strategy-picker-dialog { padding: 14px; max-height: calc(100dvh - 16px); }
:root[data-ui="mobile"] .strategy-picker-affordance { max-width: 4em; white-space: normal; }

input, select {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 8px 10px; font-size: 13px;
}
textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 8px 10px; font-size: 13px; resize: vertical;
}
/* 停用中的輸入框要看得出來：上面的 input/select/textarea 規則會蓋掉瀏覽器預設的灰階樣式 */
input:disabled, select:disabled, textarea:disabled {
  opacity: .5; cursor: not-allowed;
}
label { display: block; font-size: 12px; color: var(--muted); margin: 8px 0 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; align-items: end; }
/* 格內控制項一律填滿自己的欄位、允許收縮：select 會以最寬選項自然撐寬，不加 min-width:0 會蓋到隔壁欄 */
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; min-width: 0; }
/* 長中文標籤／長選項文字的表單改用較寬的欄位 */
.form-grid-wide { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.report-columns { max-width: 800px; min-width: 0; margin-top: 18px; }
.report-columns-heading { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.report-columns-heading h4 { margin: 0; }
.report-columns-heading [role="status"] { font-size: 12px; }
.report-columns-help { margin: 8px 0; font-size: 12px; line-height: 1.6; }
.report-columns-options { min-width: 0; margin: 12px 0; border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; }
.report-columns-options legend { font-size: 12px; color: var(--muted); padding: 0 6px; }
.report-columns-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); gap: 8px 14px; }
.report-columns-grid label { display: flex; align-items: flex-start; gap: 7px; min-width: 0; margin: 0; color: var(--text); line-height: 1.5; cursor: pointer; }
.report-columns-grid input[type="checkbox"] { width: auto; flex: 0 0 auto; margin: 2px 0 0; }
.report-columns-grid label span { min-width: 0; overflow-wrap: anywhere; }
.report-columns-grid small { display: block; font-size: 11px; }
.report-columns-order { border-top: 1px solid var(--border); padding-top: 10px; }
.report-columns-order summary { cursor: pointer; font-size: 13px; }
.report-columns-order ol { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; }
.report-columns-order li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; padding: 7px 9px; border: 1px solid var(--border); border-radius: 5px; }
.report-column-name { flex: 1 1 150px; min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
.report-column-fixed { font-size: 12px; }
.report-column-moves { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
:root[data-ui="mobile"] .report-columns-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
:root[data-ui="mobile"] .report-columns-heading h4 { flex-basis: 100%; }
:root[data-ui="mobile"] .report-column-name { flex-basis: 120px; }

.chart { width: 100%; height: 360px; }
/* 個股 K 線（charts.js 的 stockChart）：主圖在上，副圖（.stock-sub-chart，每個指標一張）由上而下疊在
   .stock-sub-charts 裡，只有勾選的才會出現；外框最小高度只留主圖，沒開副圖時下面不會空一塊 */
.stock-chart-wrap { width: 100%; min-height: 520px; }
.stock-main-chart { width: 100%; height: 520px; }
.stock-sub-chart { width: 100%; height: 130px; margin-top: 8px; }
.stock-sub-chart[data-pane="macd"] { height: 160px; }
/* 週期按鈕＋區間按鈕＋「?」排成一列；兩組 .pill-tabs 的下緣距離改由外層提供，「?」才會與按鈕垂直置中 */
.stock-chart-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.stock-chart-tabs .pill-tabs { margin-bottom: 0; }
.stock-chart-tabs .wiki-help { margin-left: 0; }
.stock-range-tabs { padding-left: 10px; border-left: 1px solid var(--border); }
.stock-chart-note { font-size: 12px; margin: 0 0 6px; }
.stock-profile-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px;
}
.stock-profile-grid div,
.stock-profile-line {
  background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px;
}
.stock-profile-grid span,
.stock-profile-line span {
  display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px;
}
.stock-profile-grid b,
.stock-profile-line b {
  display: block; color: var(--text); font-weight: 650; overflow-wrap: anywhere;
}
.stock-profile-line { margin-top: 10px; }
.stock-news-list { display: grid; gap: 8px; }
.stock-news-item {
  display: block; padding: 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel-2); color: var(--text);
}
.stock-news-item:hover { border-color: var(--accent); filter: brightness(1.05); }
.stock-news-item strong { display: block; line-height: 1.45; font-size: 13px; }
.stock-news-item span { display: block; color: var(--muted); font-size: 12px; margin-top: 5px; }
.earnings-primary {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 10px; margin-bottom: 10px; border: 1px solid var(--border); background: var(--panel-2);
}
.earnings-primary > div:first-child { display: grid; gap: 3px; }
.earnings-primary span, .earnings-primary small { color: var(--muted); font-size: 12px; }
.earnings-primary strong { font-size: 18px; }
.earnings-calendar { display: grid; gap: 6px; }
.earnings-event {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 7px 2px; border-bottom: 1px solid var(--border);
}
.earnings-event-link { color: var(--text); }
.earnings-event-link:hover { background: var(--panel-2); border-color: var(--accent); }
.earnings-event > div { display: grid; gap: 2px; }
.earnings-event strong { font-size: 13px; }
.earnings-event span { color: var(--muted); font-size: 12px; }
.earnings-event .earnings-announced { color: var(--down); }
.earnings-event .earnings-upcoming { color: var(--accent); }
.earnings-event .earnings-overdue { color: var(--warn); }
.earnings-note { font-size: 12px; line-height: 1.5; margin: 10px 0 0; }
.indicator-controls {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 0 0 10px;
  padding: 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2);
}
.indicator-controls label {
  display: inline-flex; align-items: center; gap: 5px; margin: 0;
  color: var(--text); font-size: 12px; white-space: nowrap;
}
.indicator-controls input[type="checkbox"] { margin: 0; }
.indicator-controls input[type="number"] { width: 66px; padding: 4px 6px; font-size: 12px; }
/* 個股頁與詳情對話框共用三個原生收合面板，收合時保留控制項與設定。 */
.stock-indicator-rows { display: grid; gap: 6px; margin: 0 0 6px; }
.stock-chart-settings { margin: 0 0 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel-2); }
.stock-indicator-rows .stock-chart-settings { margin: 0; }
.stock-chart-settings > summary { padding: 8px 10px; color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.5; cursor: pointer; }
.stock-chart-settings > summary:hover { color: var(--text); }
.stock-chart-settings > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.stock-chart-settings > .indicator-controls { margin: 0; border: 0; border-top: 1px solid var(--border); border-radius: 0 0 8px 8px; }
.indicator-controls label.is-disabled { color: var(--muted); cursor: not-allowed; }
/* 勾選框與各參數各自一個 label、整組不換行（SAR：點「加速」「上限」聚焦輸入框，不會切換 SAR） */
.indicator-controls .indicator-group { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
/* 參數（說明字＋輸入框）包一層 .ind-params：桌機等於沒有這一層；手機版沒勾的指標整層藏起來（見手機版區塊） */
.ind-params { display: contents; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 10px; }
/* 投資組合摘要（10 張卡）：每列最多 5 張＝桌機兩列；卡片寬度不足 130px 時才自動減少每列張數。
   手機版由 :root[data-ui="mobile"] .metrics（權重較高）改成每列 2 張。 */
.metrics.pf-summary-metrics { grid-template-columns: repeat(auto-fill, minmax(max(130px, calc((100% - 40px) / 5)), 1fr)); }
.metric { background: var(--panel-2); border-radius: 8px; padding: 12px; }
.metric .v { font-size: 18px; font-weight: 700; }
.metric .k { font-size: 12px; color: var(--muted); }
.metric .metric-note { font-size: 11px; margin-top: 4px; }
.rc-value-picker { display: none; }
.rc-metric-note { font-size: 11px; margin-top: 4px; }
.rc-valuation-note { font-size: 12px; margin: 10px 0 0; }
.rc-holdings-scroll { overflow-x: auto; max-width: 100%; }
.rc-holdings-scroll th { white-space: nowrap; }

.pill-tabs { display:flex; gap:6px; margin-bottom: 12px; flex-wrap: wrap; }
.pill-tabs button { background: var(--panel-2); color: var(--muted); }
.pill-tabs button.active { background: var(--accent); color:#fff; }
.market-taxonomy {
  display: grid; gap: 8px; padding: 10px 0; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.market-taxonomy-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; align-items: start; }
.market-taxonomy-row > span { padding-top: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.market-taxonomy-row .pill-tabs { margin: 0; }
.industry-news-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 18px; }
.industry-news-group { min-width: 0; padding: 4px 0 12px; border-bottom: 1px solid var(--border); }
.industry-news-heading { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.industry-news-heading h2 { margin: 0; font-size: 16px; }
.industry-news-heading span { color: var(--muted); font-size: 12px; }
.industry-news-list { display: grid; }
.industry-news-item {
  display: grid; gap: 5px; padding: 10px 2px; color: var(--text); border-bottom: 1px solid var(--border);
}
.industry-news-item:hover strong { color: var(--accent); }
.industry-news-item strong { line-height: 1.45; white-space: normal; }
.industry-news-item span { color: var(--muted); font-size: 12px; }
.empty { color: var(--muted); padding: 30px; text-align: center; }
#toast-area {
  position: fixed; bottom: 20px; right: 20px; z-index: 100;
  display: grid; justify-items: end; gap: 8px; pointer-events: none;
}
.toast, #backup-export-status:not(:empty) {
  background: var(--panel-2); pointer-events: auto;
  border: 1px solid var(--border); border-left: 4px solid var(--accent);
  padding: 12px 16px; border-radius: 8px; max-width: 320px;
}
#backup-export-status:empty { display: none; }
.toast.err { border-left-color: var(--up); }
.toast.ok { border-left-color: var(--down); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stock-list-search { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.stock-list-search label { margin: 0; }
.stock-list-search input { width: min(320px, 100%); min-width: 0; }
:root[data-ui="mobile"] .stock-list-search label { flex-basis: 100%; }
:root[data-ui="mobile"] .stock-list-search input { flex: 1 1 180px; }
.adv-trend { display: inline-flex; gap: 4px; min-width: 60px; justify-content: flex-end; font-weight: 700; }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(0, 0, 0, .58); padding: 20px;
}
.modal {
  width: min(560px, 100%); background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.modal h2 { margin-top: 0; }
.fubon-credential-dialog { color: var(--text); width: min(440px, calc(100% - 32px)); max-height: 90dvh; overflow: auto; }
.fubon-credential-dialog::backdrop { background: rgba(0, 0, 0, .58); }
.fubon-credential-dialog label { display: grid; gap: 5px; margin-top: 14px; }
.fubon-credential-dialog input { width: 100%; min-width: 0; }
.fubon-setup-advanced { margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--border); }
.fubon-setup-advanced summary { cursor: pointer; font-weight: 600; }
.fubon-setup-advanced summary small { margin-left: 4px; font-weight: 400; }
.fubon-credential-dialog [data-cert], .fubon-credential-dialog [data-token] { margin: 5px 0 0; font-size: 12px; }
.fubon-setup-error { color: var(--danger); }
.fubon-setup-error:empty { display: none; }
.fubon-setup-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }
/* 編輯策略：長表單只捲動內容，標題與取消／儲存固定留在可視範圍。 */
.strategy-edit-dialog {
  width: min(860px, 100%); max-height: calc(100dvh - 40px); padding: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.strategy-edit-header { flex-shrink: 0; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.strategy-edit-header h2 { margin: 0; }
.strategy-edit-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px; }
.strategy-edit-footer { flex-shrink: 0; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); }
/* 紀錄／選股結果：固定標題與關閉鈕，長內容在對話框內捲動。 */
.bot-records-dialog { width: min(1080px, 100%); max-height: calc(100dvh - 40px); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.bot-records-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.bot-records-header h2 { margin: 0; font-size: 18px; overflow-wrap: anywhere; }
.bot-records-header button { flex-shrink: 0; }
.bot-records-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 16px 20px; overflow-wrap: anywhere; }
.bot-records-body .table-wrap { overflow-x: auto; max-width: 100%; }
.bot-records-body table { min-width: 720px; }
.bot-records-body td.sym a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.bot-records-body td:last-child { white-space: normal; min-width: 160px; }
.bot-stop-checks { margin: 8px 0; }
.bot-stop-warning { margin: 8px 0; color: var(--warn); }
.bot-stop-checks summary { cursor: pointer; color: var(--accent); }
.bot-stop-checks p { margin: 8px 0; font-size: 12px; }
.bot-stop-checks table { min-width: 1100px; }
.bot-stop-checks td:nth-child(2) { white-space: normal; min-width: 220px; }
.bot-stop-checks td:nth-child(2) small { display: block; margin-top: 4px; }
.bot-stop-checks td:last-child { white-space: nowrap; min-width: 90px; }
/* 平倉預覽／結果：固定標題與確認列，明細可上下及左右捲動。 */
.portfolio-close-dialog { width: min(1080px, 100%); max-height: calc(100dvh - 40px); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.portfolio-close-header { flex-shrink: 0; padding: 16px 20px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
.portfolio-close-header h2 { margin: 0; }
.portfolio-close-header p { margin: 8px 0 0; }
.portfolio-close-body { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; padding: 16px 20px; overflow-wrap: anywhere; }
.portfolio-close-body .table-wrap { max-width: 100%; overflow-x: auto; }
.portfolio-close-body table { min-width: 800px; }
.portfolio-close-footer { flex-shrink: 0; padding: 12px 20px; border-top: 1px solid var(--border); }
.portfolio-close-footer .inline { justify-content: flex-end; }
.portfolio-close-ack { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.portfolio-close-ack input { width: auto; margin-top: 3px; flex-shrink: 0; }
/* 倉位群組：收合標題同時是拖放目標，表格仍維持原本欄位。 */
.portfolio-group-help { font-size: 12px; margin: 8px 0 0; }
.valuation-status-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.valuation-status { font-size: 12px; line-height: 1.6; margin: 8px 0; overflow-wrap: anywhere; }
.valuation-status-bar .valuation-status { flex: 1 1 280px; }
.valuation-status.is-loading::before { content: ''; display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--accent); }
.valuation-row-note { display: block; max-width: 32em; white-space: normal; overflow-wrap: anywhere; font-weight: 400; line-height: 1.5; margin-top: 4px; }
.valuation-row-note:empty { display: none; }
.valuation-group-status { display: block; font-size: 11px; line-height: 1.4; }
.portfolio-group { position: relative; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
button.portfolio-group-toggle { position: relative; display: flex; align-items: center; gap: 8px; width: 100%; min-height: 56px; padding: 10px 164px 10px 12px; text-align: left; border: 0; border-radius: 0; white-space: normal; }
.portfolio-group-toggle strong { overflow-wrap: anywhere; }
.portfolio-group-toggle:focus-visible, .portfolio-move-button:focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
.portfolio-group-chevron { min-width: 12px; }
.portfolio-group-count { position: absolute; top: 12px; right: 12px; margin-left: auto; flex-shrink: 0; font-size: 12px; }
.portfolio-group-body { overflow-x: auto; }
/* 桌機倉位表：左右捲動時凍結「倉位」「策略」兩欄（bot.js 只在桌機輸出 .b-freeze；手機版另有自己的合併凍結欄）。
   第二欄的 left 由 syncFrozenBookColumns() 量第一欄寬度寫進 --b-freeze-left；凍結欄要有不透明底色，捲動的欄位才不會透出來。 */
#b-books .b-freeze { position: sticky; z-index: 1; background: var(--panel); }
#b-books th.b-freeze { z-index: 2; }
#b-books .b-freeze-1 { left: 0; }
#b-books .b-freeze-2 { left: var(--b-freeze-left, 0px); }
#b-books td.b-freeze-1 .valuation-row-note { max-width: 20em; } /* 倉位欄維持不換行（同凍結前）；長的估值註記限寬，凍結區不會吃掉整個畫面 */
#b-books td.b-freeze-2 { min-width: 9em; max-width: 16em; white-space: normal; text-align: left; }
#b-books td.b-freeze-2 .tag { display: inline-block; white-space: nowrap; margin: 2px 0; }
#b-books th.b-freeze-2 { text-align: left; }
#b-books .b-freeze-last { box-shadow: inset -1px 0 0 var(--border), 6px 0 8px -6px rgba(0, 0, 0, .55); }
#b-books tbody tr:hover .b-freeze { background: var(--panel-2); }

/* 標題旁的「?」：開新分頁到系統說明（docs/wiki.html，見 doc/wiki/README.md） */
.wiki-help { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; margin-left: 6px; border: 1px solid var(--border); border-radius: 50%; font-size: 13px; font-weight: 700; line-height: 1; color: var(--accent); background: var(--panel-2); text-decoration: none; vertical-align: middle; }
.wiki-help:hover { border-color: var(--accent); }
.wiki-help:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
:root[data-ui="mobile"] .wiki-help { width: 28px; height: 28px; font-size: 15px; }
.portfolio-group-body[hidden] { display: none; }
.portfolio-group-note { margin: 0; padding: 0 12px 8px; font-size: 12px; }
.portfolio-group-empty { padding: 20px 12px; font-size: 13px; }
.portfolio-book-actions { display: inline-flex; align-items: center; gap: 4px; margin-right: 8px; vertical-align: middle; }
button.portfolio-drag-handle { padding: 2px 5px; font-size: 21px; line-height: 1; cursor: grab; touch-action: none; user-select: none; }
button.portfolio-drag-handle:active { cursor: grabbing; }
button.portfolio-move-button { font-size: 11px; padding: 3px 6px; }
.portfolio-group-drop-note:empty { display: none; }
/* 拖曳提示只覆蓋預留狀態欄；dragstart 時改變列的位置會讓瀏覽器取消原生拖曳。 */
.portfolio-group-drop-note { position: absolute; top: 12px; right: 12px; width: 144px; text-align: right; font-size: 12px; line-height: 1.5; pointer-events: none; }
.portfolio-dragging .portfolio-group-count { visibility: hidden; }
.portfolio-dragging .portfolio-group.drop-allowed { border-style: dashed; border-color: var(--accent); }
.portfolio-dragging .portfolio-group.drop-denied .portfolio-group-drop-note { color: var(--up); }
.portfolio-dragging .portfolio-group.drop-allowed.drop-over { outline: 2px solid var(--accent); outline-offset: -2px; background: rgba(76, 143, 255, .1); }
.portfolio-dragging .portfolio-group.drop-denied.drop-over { outline: 2px solid var(--up); outline-offset: -2px; }
.portfolio-book-dragging { opacity: .45; }
#b-books[aria-busy="true"] .portfolio-move-button, #b-books[aria-busy="true"] .portfolio-drag-handle { opacity: .5; cursor: progress; }
.portfolio-group-dialog { padding: 0; display: flex; flex-direction: column; max-height: calc(100dvh - 40px); overflow: hidden; }
.portfolio-group-dialog-header { padding: 16px 20px; border-bottom: 1px solid var(--border); }
.portfolio-group-dialog-header h2 { margin: 0; }
.portfolio-group-dialog form { display: flex; flex-direction: column; min-height: 0; }
.portfolio-group-dialog-body { padding: 16px 20px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-wrap: anywhere; }
.portfolio-group-dialog-body label { margin-top: 10px; }
.portfolio-group-dialog-footer { display: flex; flex-shrink: 0; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }
:root[data-ui="mobile"] .portfolio-book-actions { display: flex; margin: 0 0 4px; }
:root[data-ui="mobile"] button.portfolio-move-button { padding: 5px 8px; min-height: 32px; }
:root[data-ui="mobile"] button.portfolio-group-toggle { align-items: flex-start; padding-right: 12px; }
:root[data-ui="mobile"] .portfolio-group-count { position: static; padding-top: 2px; }
:root[data-ui="mobile"] .modal.portfolio-group-dialog { padding: 0; max-height: 90dvh; overflow: hidden; }
/* 可點擊的風控說明，支援在策略編輯／批次建立對話框上開啟。 */
button.risk-help-button { display: inline-flex; align-items: center; justify-content: center; width: 20px; min-width: 20px; height: 20px; padding: 0; margin-left: 5px; border: 1px solid var(--muted); border-radius: 50%; background: transparent; color: var(--muted); font-size: 12px; line-height: 1; vertical-align: middle; }
button.risk-help-button:hover { color: var(--text); border-color: var(--accent); }
button.risk-help-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.risk-field-label { display: flex; align-items: center; gap: 2px; }
.risk-form-grid { align-items: start; }
.risk-field-label label { flex: 0 1 auto; }
.risk-field-note { display: block; color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: 5px; white-space: pre-line; overflow-wrap: anywhere; }
.risk-hint-backdrop { z-index: 180; }
.risk-hint-dialog { width: min(640px, 100%); max-height: calc(100dvh - 40px); padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.risk-hint-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.risk-hint-header h2 { margin: 0; line-height: 1.5; }
.risk-hint-header button { flex-shrink: 0; }
.risk-hint-body { padding: 4px 18px 12px; overflow-y: auto; line-height: 1.8; overflow-wrap: anywhere; }
.risk-hint-default { color: var(--muted); }
.risk-hint-current { font-weight: 600; }
.risk-hint-details { margin: 12px 0; padding-left: 22px; }
.risk-hint-details li + li { margin-top: 8px; }
.risk-hint-footer { padding: 12px 18px; border-top: 1px solid var(--border); text-align: right; }
:root[data-ui="mobile"] button.risk-help-button { width: 24px; min-width: 24px; height: 24px; min-height: 24px; padding: 0; }
:root[data-ui="mobile"] .modal.risk-hint-dialog { padding: 0; max-height: 90dvh; overflow: hidden; }
:root[data-ui="mobile"] .risk-hint-header { padding: 14px; }
:root[data-ui="mobile"] .risk-hint-body { padding: 4px 14px 10px; }
:root[data-ui="mobile"] .risk-hint-footer { padding: 12px 14px; }
.context-menu {
  position: fixed; z-index: 120; width: 280px; max-height: min(520px, calc(100vh - 16px));
  overflow-y: auto; padding: 6px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 6px; box-shadow: 0 14px 38px rgba(0, 0, 0, .5);
}
.context-menu-group + .context-menu-group { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--border); }
.context-menu-label { padding: 5px 8px; color: var(--muted); font-size: 11px; font-weight: 700; }
.context-menu button {
  display: flex; width: 100%; align-items: center; gap: 8px; padding: 7px 8px;
  border: 0; border-radius: 4px; background: transparent; color: var(--text); text-align: left;
}
.context-menu button:hover { background: var(--panel-2); }
.context-menu button span { min-width: 58px; color: var(--muted); font-size: 11px; }
.context-menu .context-menu-danger { color: var(--up); }
.context-menu-separator { margin: 5px 0; border-top: 1px solid var(--border); }
.context-menu-empty { padding: 7px 8px; color: var(--muted); font-size: 12px; }

/* 欄位全開時，表格超出面板 → 改為容器內水平捲動，不溢出背景面板 */
#mkt-table, #wl-table, #pf-holdings, #pf-tx, #t-orders, #t-fills,
#rc-summary, #rc-broker, #rc-local, #st-orders {
  overflow-x: auto;
  max-width: 100%;
}

/* 三大法人買賣超 */
.inst-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 10px 0 6px; }
.inst-key { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.inst-key i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.inst-chart-wrap { width: 100%; overflow-x: auto; }
.inst-chart-wrap svg { display: block; }

/* 表頭滑鼠提示浮層（util.js bindHints；掛在 body 用 fixed 定位，不受容器裁切） */
.col-hint {
  position: fixed;
  z-index: 80;
  display: none;
  max-width: 320px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
  white-space: pre-line; /* 保留提示文字中的換行（單行提示的呈現不受影響） */
  pointer-events: none; /* 浮層不吃滑鼠事件，避免蓋住表頭造成閃爍 */
}

/* 可排序＋可提示的表頭：虛線底線提示「可 hover 看說明」（th 本身已是 cursor:pointer） */
th[data-hint] { text-decoration: underline dotted; text-underline-offset: 3px; }
/* 指標卡標題只有說明、不可點，故用 help 游標 */
.metric .k[data-hint] {
  text-decoration: underline dotted;
  text-underline-offset: 3px;
  cursor: help;
  width: fit-content;
}

/* 欄位滑鼠提示（hover 顯示 title 說明） */
.field-hint {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-left: 4px;
  border: 1px solid var(--muted, #8b949e);
  border-radius: 50%;
  font-size: 10px;
  line-height: 1;
  cursor: help;
  vertical-align: middle;
  opacity: .75;
}

/* 產業新聞：本機模型進度、新聞根據與股價影響。 */
.news-workspace { --news-positive: #ff9298; --news-negative: #65d19a; }
.news-workspace [hidden] { display: none; }
.news-workspace :is(button, input, select, a, summary):focus-visible { outline: 2px solid #7eb2ff; outline-offset: 3px; }
.news-page-header { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin: 8px 0 22px; }
.news-eyebrow { color: #89b7ff; font-size: 11px; letter-spacing: .15em; font-weight: 700; margin-bottom: 9px; }
.news-page-header h1 { font-size: 27px; margin: 0 0 8px; }
.news-page-header h1 span { display: inline-block; font-size: 13px; font-weight: 500; color: #a9c9ff; vertical-align: middle; border: 1px solid #345780; background: #182a42; padding: 5px 9px; border-radius: 6px; }
.news-page-header p { margin: 0; color: var(--muted); line-height: 1.6; }
.news-actions { display: flex; flex-shrink: 0; gap: 8px; }
.news-notice { padding: 12px 16px; border: 1px solid #76562c; background: #2b231a; color: #f4d18e; border-radius: 8px; margin-bottom: 16px; line-height: 1.7; overflow-wrap: anywhere; }
.news-process { padding: 20px; border-top: 2px solid #528fde; background: linear-gradient(125deg, #182435, var(--panel) 65%); }
.news-process-header { display: flex; justify-content: space-between; align-items: start; gap: 20px; }
.news-process-header h2 { font-size: 15px; margin: 0; }
.news-job-message { margin: 7px 0 0; color: #bac4d3; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.news-model { color: var(--muted); font-size: 12px; white-space: nowrap; text-align: right; }
.news-model small { display: block; color: #a8b2c2; font-size: 11px; margin-top: 5px; white-space: normal; overflow-wrap: anywhere; }
.news-model-ready { color: #7ddbb6; }
.news-model-offline { color: #f2c773; }
.news-progress-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; margin: 21px 0 14px; }
.news-progress-label { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; color: #b8c3d3; margin-bottom: 9px; }
.news-progress-label b { color: #8496ad; font-size: 11px; margin-right: 5px; }
.news-progress-active .news-progress-label { color: #a9cbff; }
.news-progress-step progress { appearance: none; display: block; width: 100%; height: 6px; border: none; border-radius: 10px; overflow: hidden; background: #303a4b; accent-color: #6b9fec; }
.news-progress-step progress::-webkit-progress-bar { background: #303a4b; border-radius: 10px; }
.news-progress-step progress::-webkit-progress-value { background: #6b9fec; border-radius: 10px; transition: width .3s; }
.news-progress-step progress::-moz-progress-bar { background: #6b9fec; border-radius: 10px; }
.news-progress-caption { color: var(--muted); font-size: 11px; margin-top: 7px; }
.news-process-footer { display: flex; gap: 8px 16px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 11px; border-top: 1px solid var(--border); padding-top: 12px; }
.news-job-state { color: #c1d5f4; }
.news-model-error { margin: 10px 0 0; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.news-error-text { color: #f2c773; }
.news-filter-help, .news-filter-description { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0 0 12px; }
.news-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.news-metric { border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 16px 18px; border-radius: 9px; display: flex; align-items: baseline; gap: 12px; min-width: 0; text-align: left; cursor: pointer; }
.news-metric:hover { background: var(--panel-2); border-color: #568fe3; }
.news-metric[aria-pressed="true"] { border-color: var(--accent); background: #17283e; box-shadow: inset 0 0 0 1px var(--accent); }
.news-metric:focus-visible { outline: 2px solid #a9cbff; outline-offset: 3px; }
.news-metric strong { font-size: 25px; font-variant-numeric: tabular-nums; letter-spacing: -.04em; }
.news-metric span { font-size: 12px; color: var(--muted); }
.news-metric[aria-pressed="true"] span { color: #d9e8ff; }
.news-metric-bullish strong { color: var(--news-positive); }
.news-metric-bearish strong { color: var(--news-negative); }
.news-filter-card { padding: 18px 20px; }
.news-filter-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.news-filter-header h2 { margin: 0; white-space: nowrap; }
.news-filter-inputs { display: flex; gap: 12px; align-items: end; }
.news-filter-inputs label { display: grid; gap: 6px; margin: 0; }
.news-filter-inputs label > span { font-size: 11px; color: var(--muted); }
.news-filter-inputs input { width: 260px; max-width: 100%; }
.news-filter-card .market-taxonomy { border-bottom: none; padding-bottom: 0; }
.news-filter-card .pill-tabs button { font-size: 12px; padding: 6px 10px; }
.news-taxonomy-hint { color: var(--muted); font-size: 12px; align-self: center; padding: 5px; }
.news-results-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 24px 0 16px; }
.news-results-heading h2 { margin: 0; font-size: 18px; }
.news-results-heading > span { font-size: 12px; }
.news-group { margin-bottom: 25px; min-width: 0; }
.news-group-heading { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 11px; border-left: 3px solid #568fe3; padding-left: 10px; }
.news-group-heading h3 { margin: 0; font-size: 15px; }
.news-group-heading span { color: var(--muted); font-size: 11px; }
.news-group-heading span:last-child { margin-left: auto; }
.news-articles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.news-article { min-width: 0; padding: 20px; border: 1px solid var(--border); background: var(--panel); border-radius: 10px; overflow-wrap: anywhere; }
.news-article-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.news-source { color: #a5b1c2; font-size: 12px; }
.news-impact { display: inline-flex; align-items: center; gap: 3px; color: #aab4c4; background: #252e3b; padding: 4px 8px; border-radius: 5px; font-size: 11px; white-space: nowrap; font-weight: 600; }
.news-impact-bullish { color: var(--news-positive); background: #3b242e; }
.news-impact-bearish { color: var(--news-negative); background: #19342d; }
.news-impact-mixed { color: #e4c285; background: #39301f; }
.news-impact-uncertain { color: #bcacf0; background: #2c2740; }
.news-analysis-state { color: #a8b9d4; font-size: 11px; }
.news-article h3 { margin: 0 0 8px; font-size: 16px; line-height: 1.65; font-weight: 600; }
.news-article h3 a { color: var(--text); }
.news-article h3 a:hover { color: #96c0ff; }
.news-external { color: #7287a4; font-size: 12px; }
.news-published { color: var(--muted); font-size: 11px; margin-bottom: 16px; }
.news-label { color: #a6b3c5; font-size: 10px; font-weight: 600; letter-spacing: .06em; }
.news-evidence { background: #111720; border: 1px solid #283344; padding: 11px 13px; border-radius: 7px; margin-bottom: 16px; }
.news-evidence p { margin: 5px 0 0; color: #a7b3c4; font-size: 12px; line-height: 1.7; }
.news-quotes { margin: 9px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.news-quotes li { color: #b8c6d9; font-size: 11px; padding-top: 6px; line-height: 1.65; }
.news-inference .news-label { color: #8bbaff; }
.news-conclusion { font-size: 14px; line-height: 1.75; margin: 6px 0; font-weight: 500; }
.news-reasoning { color: #b0bccb; font-size: 13px; line-height: 1.85; margin: 7px 0 13px; }
.news-assessment { display: flex; flex-wrap: wrap; gap: 6px 16px; color: #b9c6d7; font-size: 11px; margin: 13px 0; }
.news-stocks { padding: 0; margin: 15px 0 0; list-style: none; display: grid; gap: 10px; }
.news-stocks > li { padding-left: 10px; border-left: 2px solid #384b65; }
.news-stock-heading { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.news-stock-heading > a, .news-stock-heading > span:first-child { font-size: 12px; font-weight: 600; color: #9dc3ff; }
.news-stock-heading .news-impact { font-size: 10px; padding: 2px 6px; }
.news-stocks p { font-size: 12px; color: #aab7c9; line-height: 1.7; margin: 5px 0 0; }
.news-no-stock { color: var(--muted); font-size: 12px; margin: 15px 0; }
.news-details { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 13px; }
.news-details > summary { color: #9bb8df; font-size: 12px; cursor: pointer; }
.news-details[open] > summary { margin-bottom: 15px; }
.news-factors { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.news-detail-block { margin-bottom: 13px; }
.news-detail-block h4 { font-size: 12px; margin: 0 0 6px; color: #c0cce0; }
.news-factor-bullish h4 { color: var(--news-positive); }
.news-factor-bearish h4 { color: var(--news-negative); }
.news-detail-block ul { padding-left: 17px; margin: 0; color: #a9b6c9; font-size: 12px; line-height: 1.8; }
.news-detail-block li + li { margin-top: 4px; }
.news-analysis-meta { color: var(--muted); font-size: 10px; margin: 12px 0 0; }
.news-pending { border-top: 1px solid var(--border); padding-top: 4px; }
.news-pending p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.news-pending .news-error-text { color: #f2c773; }
.news-more { text-align: center; margin: 16px 0; }
.news-footnote { color: var(--muted); font-size: 11px; line-height: 1.85; margin: 24px 0 12px; border-top: 1px solid var(--border); padding-top: 15px; }

/* 股票池交集選擇，建立／編輯及批次表單共用。 */
.stock-pool-filters { margin-top: 8px; min-width: 0; }
.stock-pool-filters summary { cursor: pointer; overflow-wrap: anywhere; }
.stock-pool-filter-note { font-size: .85em; margin: 8px 0; }
.stock-pool-filter-options { display: grid; gap: 6px; max-height: 15rem; overflow-y: auto; padding: 6px; border: 1px solid var(--border); border-radius: 6px; }
.stock-pool-filter-options label { display: flex; align-items: flex-start; gap: 8px; margin: 0; font-size: .9em; }
.stock-pool-filter-options input[type="checkbox"] { width: auto; flex: 0 0 auto; margin-top: 3px; }
.stock-pool-filter-options span { overflow-wrap: anywhere; min-width: 0; }

/* 持股明細「1日走勢」分時格：Screener 共用的 mainForceIntraday.js 輸出這些 class，規則同 frontend-screener/style.css。
   th／td 預設 nowrap，狀態文字要能換行才不會把欄撐寬；146px 的圖靠右，與數字欄對齊。
   N 日走勢圖（.mf-trend-svg）的尺寸寫在 SVG 屬性與 inline style，不需要規則。必須放在手機版區塊之前。 */
.mf-intraday-cell { min-width: 146px; width: 146px; margin-inline-start: auto; white-space: normal; }
.mf-intraday-svg { display: block; max-width: none; }
.mf-intraday-meta, .mf-intraday-note { display: block; font-size: 11px; line-height: 1.4; color: var(--muted); }
.mf-intraday-note { overflow-wrap: anywhere; }
/* 持股明細預設就有 1日欄，而分時只在列捲進畫面時才讀：先預留載入後的高度（62px 圖＋一行時間／漲跌＋一行備註
   ＝模擬行情、更新中、資料待更新），列才不會在使用者閱讀時從一行字長成整張圖、把下面的列往下推（手機版橫向滑到此欄時也一樣）。 */
#pf-holdings .mf-intraday-cell { min-height: calc(62px + 2 * 11px * 1.4); }

/* 我的機器人：選取狀態獨立於排序與刷新，手機仍凍結原名稱欄。 */
.strategy-bulk-toolbar { gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.strategy-bulk-toolbar label, .strategy-row-choice { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.strategy-row-choice input, .strategy-bulk-toolbar input { width: auto; flex: 0 0 auto; }
.strategy-bulk-dialog { width: min(1050px, 95vw); max-height: 90dvh; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.strategy-bulk-dialog header, .strategy-bulk-dialog footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; flex-shrink: 0; }
.strategy-bulk-dialog h2, .strategy-bulk-dialog footer p { margin: 0; }
.strategy-bulk-body { padding: 0 20px 16px; overflow: auto; min-height: 0; }
.strategy-bulk-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 12px; }
.strategy-bulk-fields label { display: block; }
.strategy-bulk-fields select, .strategy-bulk-fields input { width: 100%; }
.strategy-bulk-fields input { margin-top: 6px; }
.strategy-bulk-dialog fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 12px; }
.strategy-bulk-warning { border-left: 3px solid #d88b24; padding: 8px 12px; background: rgba(216,139,36,.08); }
.strategy-bulk-results { overflow-x: auto; margin-top: 14px; }
.strategy-bulk-results table { min-width: 560px; width: 100%; }
.strategy-bulk-results th, .strategy-bulk-results td { text-align: left; }
.strategy-bulk-results td { white-space: normal; vertical-align: top; }
.strategy-bulk-results small { display: block; margin-top: 4px; }
.strategy-bulk-error { color: var(--danger); }

/* ==========================================================================
   手機／平板版（Firstrade 風格清單）
   --------------------------------------------------------------------------
   啟用條件：js/mobileUi.js 判斷「觸控裝置 且 視窗 <= 1024px」後，在 <html> 掛上
   data-ui="mobile"。以下每一條規則都掛在 :root[data-ui="mobile"] 之下，所以桌機
   （data-ui="desktop"）一條都不會命中——把 PC 視窗縮窄也不會變版，這是刻意的。
   要改判斷條件，js/mobileUi.js 與 index.html <head> 的 inline script 必須一起改。
   ========================================================================== */
:root[data-ui="mobile"] {
  /* 凍結欄寬度：索引欄與日走勢欄靠這三個變數算 sticky 的 left 位移 */
  --m-pick-w: 30px;
  --m-idx-w: 96px;
  --m-trend-w: 68px;
}

/* ---- 版面基本壓縮 ---- */
:root[data-ui="mobile"] main { padding: 10px; max-width: none; }
:root[data-ui="mobile"] .card { padding: 12px 10px; border-radius: 8px; margin-bottom: 12px; }
:root[data-ui="mobile"] h1 { font-size: 17px; }
:root[data-ui="mobile"] h2 { font-size: 15px; }

/* ---- 頂部導覽：12 個連結不要擠成 4 行，改成單行橫向捲動 ---- */
/* 注意：這裡不能用 flex-wrap:nowrap。#nav 是 flex:1（flex-basis:0），縮放因子按 basis 加權後為 0，
   右側備份/憑證/狀態那組又寫死 flex:0 0 auto 的話，#nav 會被壓到 0px，12 個連結全部消失，
   整頁還會橫向溢出。改成：允許換行，並讓 #nav 獨佔一整列。 */
:root[data-ui="mobile"] .topbar { gap: 8px; padding: 6px 10px; min-height: 0; flex-wrap: wrap; align-items: center; }
:root[data-ui="mobile"] .brand { font-size: 14px; flex: 0 1 auto; order: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
:root[data-ui="mobile"] #nav {
  flex: 1 1 100%; order: 3;
  flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 2px; min-width: 0;
}
:root[data-ui="mobile"] #nav::-webkit-scrollbar { display: none; }
:root[data-ui="mobile"] #nav a { flex: 0 0 auto; white-space: nowrap; padding: 8px 10px; font-size: 13px; }
/* 備份/憑證/狀態：真實內容最寬可達 ~550px，比手機螢幕還寬。
   讓它自成一列並在列內橫向捲動，而不是每個子元素各自換行（那會把標題列擐到 ~190px 高）。 */
:root[data-ui="mobile"] .topbar > .inline {
  flex: 1 1 100%; order: 2; min-width: 0; gap: 6px;
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
}
:root[data-ui="mobile"] .topbar > .inline::-webkit-scrollbar { display: none; }
:root[data-ui="mobile"] .topbar > .inline > *, :root[data-ui="mobile"] #backup-tools > * { flex: 0 0 auto; }
:root[data-ui="mobile"] #backup-tools, :root[data-ui="mobile"] #cert-switch { flex-wrap: nowrap; display: flex; align-items: center; gap: 6px; }
/* 標題列的按鈕不需要 40px 觸控高度，否則整列會被擐高 */
:root[data-ui="mobile"] .topbar button { min-height: 32px; padding: 5px 9px; }
:root[data-ui="mobile"] .status { font-size: 11px; }

/* ---- 表格：代號／名稱索引欄＋日走勢欄凍結，其餘左右捲動 ---- */
/* 所有卡片內的表格都要能水平捲動；桌機原本只有 10 個 id 有 overflow-x，
   .table-wrap 在桌機端根本沒有規則（analysis/backtest/stock 共用 14 處），這裡只補手機版。 */
:root[data-ui="mobile"] #b-list, :root[data-ui="mobile"] #rc-holdings { overflow-x: auto; max-width: 100%; }
:root[data-ui="mobile"] .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
/* 前面那串具名名單永遠會漏（bot.js、stock.js、analysis.js 都有直接包在 div 裡的表格）。
   這一組用 :has() 把「直接裝著表格的 div」全部補上；iOS 15.4+/Chrome 105+ 支援，
   舊瀏覽器會整條規則丟掉而退回上面的具名名單，兩層剛好互補。 */
:root[data-ui="mobile"] .card > div:has(> table) { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
:root[data-ui="mobile"] .card > div:has(> table) > table { width: max-content; min-width: 100%; }
/* 讓欄位保持自然寬度並撐出捲動距離；沒有這行 width:100% 會把欄位壓扁，sticky 也就沒有作用。
   只能套在「本身有 overflow-x 的容器」裡的表格：套到沒有捲動容器的表格會變成整頁橫向滑動。
   下面這串 id 與上方 overflow-x 的名單一致，新增捲動容器時兩邊要一起加。 */
:root[data-ui="mobile"] #mkt-table table,
:root[data-ui="mobile"] #wl-table table,
:root[data-ui="mobile"] #pf-holdings table,
:root[data-ui="mobile"] #pf-tx table,
:root[data-ui="mobile"] #t-orders table,
:root[data-ui="mobile"] #t-fills table,
:root[data-ui="mobile"] #rc-summary table,
:root[data-ui="mobile"] #rc-broker table,
:root[data-ui="mobile"] #rc-local table,
:root[data-ui="mobile"] #st-orders table,
:root[data-ui="mobile"] #b-list table,
:root[data-ui="mobile"] #rc-holdings table,
:root[data-ui="mobile"] .table-wrap table { width: max-content; min-width: 100%; }
:root[data-ui="mobile"] th, :root[data-ui="mobile"] td { padding: 7px 8px; }
:root[data-ui="mobile"] th { font-size: 11px; }

:root[data-ui="mobile"] .m-pick {
  position: sticky; left: 0; z-index: 2;
  width: var(--m-pick-w); min-width: var(--m-pick-w);
  padding-left: 6px; padding-right: 2px; background: var(--panel);
}
:root[data-ui="mobile"] .m-idx {
  position: sticky; left: 0; z-index: 2;
  width: var(--m-idx-w); min-width: var(--m-idx-w); max-width: var(--m-idx-w);
  background: var(--panel); text-align: left;
}
:root[data-ui="mobile"] .m-idx--offset { left: var(--m-pick-w); }
:root[data-ui="mobile"] .m-trend {
  position: sticky; left: var(--m-idx-w); z-index: 2;
  width: var(--m-trend-w); min-width: var(--m-trend-w);
  background: var(--panel); text-align: center;
  /* 捲動邊界要看得出來，否則凍結欄和捲動欄會糊成一片 */
  box-shadow: inset -1px 0 0 var(--border), 6px 0 8px -6px rgba(0, 0, 0, .55);
}
:root[data-ui="mobile"] .m-trend--offset { left: calc(var(--m-pick-w) + var(--m-idx-w)); }
/* 表頭的凍結欄要壓在資料列之上，捲動時才不會被穿透 */
:root[data-ui="mobile"] thead .m-pick,
:root[data-ui="mobile"] thead .m-idx,
:root[data-ui="mobile"] thead .m-trend { z-index: 3; }

:root[data-ui="mobile"] td.m-idx { white-space: normal; line-height: 1.25; font-weight: 700; }
:root[data-ui="mobile"] .m-idx-name {
  display: block; margin-top: 1px; font-size: 11px; font-weight: 400;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
:root[data-ui="mobile"] .m-idx-name a { color: var(--muted); }
:root[data-ui="mobile"] .m-trend-svg { display: block; margin: 0 auto; }
:root[data-ui="mobile"] .m-trend-empty { color: var(--muted); }
/* 凍結欄的底色必須不透明，否則捲過去的欄位會透出來；hover 態一併蓋掉 */
:root[data-ui="mobile"] tbody tr:hover .m-pick,
:root[data-ui="mobile"] tbody tr:hover .m-idx,
:root[data-ui="mobile"] tbody tr:hover .m-trend { background: var(--panel-2); }

/* ---- 表單與輸入 ---- */
/* iOS Safari 在 font-size < 16px 的輸入框聚焦時會自動放大整頁（viewport 沒有 maximum-scale），
   放大後不會自己縮回來，所以手機版一律 16px。 */
:root[data-ui="mobile"] input,
:root[data-ui="mobile"] select,
:root[data-ui="mobile"] textarea { font-size: 16px; }
:root[data-ui="mobile"] input[type="checkbox"], :root[data-ui="mobile"] input[type="radio"] { width: 18px; height: 18px; }
:root[data-ui="mobile"] .form-grid,
:root[data-ui="mobile"] .form-grid-wide { grid-template-columns: 1fr; align-items: stretch; }
:root[data-ui="mobile"] .metrics,
:root[data-ui="mobile"] .stock-profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
:root[data-ui="mobile"] .metric .v { font-size: 16px; }
:root[data-ui="mobile"] .rc-value-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 10px; }
:root[data-ui="mobile"] .rc-value-picker label { margin: 0; }
:root[data-ui="mobile"] .rc-value-picker select { flex: 1 1 220px; min-width: 0; }
:root[data-ui="mobile"] .rc-account-metrics[data-value-choice="net"] .rc-value-gross,
:root[data-ui="mobile"] .rc-account-metrics[data-value-choice="gross"] .rc-value-net { display: none; }

/* ---- 可點擊範圍：手指不是滑鼠 ---- */
:root[data-ui="mobile"] button, :root[data-ui="mobile"] .btn { min-height: 40px; padding: 9px 14px; }
:root[data-ui="mobile"] button.sm { min-height: 34px; padding: 6px 10px; font-size: 12px; }
:root[data-ui="mobile"] .pill-tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
:root[data-ui="mobile"] .pill-tabs::-webkit-scrollbar { display: none; }
:root[data-ui="mobile"] .pill-tabs button { flex: 0 0 auto; }
:root[data-ui="mobile"] th { cursor: default; }

/* ---- 浮層：全部改成貼齊螢幕邊緣，不要用桌機的定寬 ---- */
/* .modal-backdrop 預設置中，內容一長就上下都被切掉且無法捲動 → 手機版改成底部抽屜 */
:root[data-ui="mobile"] .modal-backdrop { padding: 0; place-items: end stretch; }
:root[data-ui="mobile"] .modal {
  width: 100%; max-width: none; max-height: 90vh; overflow: auto;
  border-radius: 14px 14px 0 0; padding: 14px;
}
:root[data-ui="mobile"] .modal.strategy-edit-dialog { padding: 0; max-height: 90dvh; overflow: hidden; }
:root[data-ui="mobile"] .modal.bot-records-dialog { padding: 0; max-height: 90dvh; overflow: hidden; }
:root[data-ui="mobile"] .bot-records-header { padding: 14px; }
:root[data-ui="mobile"] .bot-records-body { padding: 14px 14px max(14px, env(safe-area-inset-bottom)); }
:root[data-ui="mobile"] .modal.portfolio-close-dialog { padding: 0; max-height: 90dvh; overflow: hidden; }
:root[data-ui="mobile"] .portfolio-close-header,
:root[data-ui="mobile"] .portfolio-close-body { padding: 14px; }
:root[data-ui="mobile"] .portfolio-close-header h2 { font-size: 18px; }
:root[data-ui="mobile"] .portfolio-close-footer { padding: 12px 14px max(12px, env(safe-area-inset-bottom)); }
:root[data-ui="mobile"] .strategy-edit-header { padding: 14px; }
:root[data-ui="mobile"] .strategy-edit-body { padding: 14px; }
:root[data-ui="mobile"] .strategy-edit-footer { padding: 12px 14px max(12px, env(safe-area-inset-bottom)); }
:root[data-ui="mobile"] #toast-area { left: 8px; right: 8px; bottom: 8px; justify-items: stretch; }
:root[data-ui="mobile"] #toast-area > * { max-width: none; }
/* context-menu 的 left/top 是 JS 寫在 inline style 上的，只能用 !important 蓋掉 */
:root[data-ui="mobile"] .context-menu {
  left: 8px !important; right: 8px; width: auto; max-height: 60vh;
}
:root[data-ui="mobile"] .context-menu button { padding: 10px 8px; }
:root[data-ui="mobile"] .col-hint { max-width: calc(100vw - 24px); }

/* ---- 圖表：桌機的固定高度在手機上會佔掉整個螢幕 ---- */
:root[data-ui="mobile"] .chart { height: 46vh; min-height: 220px; }
:root[data-ui="mobile"] .stock-chart-wrap { min-height: 0; }
:root[data-ui="mobile"] .stock-main-chart { height: 48vh; min-height: 240px; }
:root[data-ui="mobile"] .stock-sub-chart { height: 16vh; min-height: 96px; }
:root[data-ui="mobile"] .stock-sub-chart[data-pane="macd"] { height: 18vh; min-height: 110px; }
/* 週期與區間各自一列、列內橫向捲動（.pill-tabs 在手機版不換行）；min-width:0 才捲得動 */
:root[data-ui="mobile"] .stock-chart-tabs { width: 100%; }
:root[data-ui="mobile"] .stock-chart-tabs .pill-tabs { min-width: 0; max-width: 100%; }
:root[data-ui="mobile"] .stock-range-tabs { padding-left: 0; border-left: 0; }
/* 指標列：沒勾的指標只顯示名稱，參數框（含說明字）勾了才出現，K 線圖才不會被十幾行參數擠到畫面外。
   輸入框仍在 DOM 裡（chartOptions 照常讀值）；不支援 :has() 的瀏覽器略過這幾條、維持全部顯示 */
:root[data-ui="mobile"] .stock-indicator-rows label:has(> input[type="checkbox"]:not(:checked)) > input[type="number"],
:root[data-ui="mobile"] .stock-indicator-rows label:has(> input[type="checkbox"]:not(:checked)) > .ind-params,
:root[data-ui="mobile"] .stock-indicator-rows .indicator-group:not(:has([data-ind]:checked)) > label:has(> [data-period]),
:root[data-ui="mobile"] .stock-indicator-rows .indicator-controls:not(:has([data-ind="macd"]:checked)) label:has(> [data-period^="macd"]) { display: none; }
:root[data-ui="mobile"] .inst-chart-wrap { -webkit-overflow-scrolling: touch; }

/* ---- 其他 ---- */
:root[data-ui="mobile"] .row { gap: 10px; }
:root[data-ui="mobile"] .col { min-width: 0 !important; flex-basis: 100%; }
:root[data-ui="mobile"] .app-version { opacity: .5; font-size: 10px; }
:root[data-ui="mobile"] .footer { padding: 12px 10px 28px; font-size: 11px; }
:root[data-ui="mobile"] .industry-news-groups { grid-template-columns: 1fr; gap: 12px; }

/* 自訂策略建構器（customBuilder.js，掛在回測與交易機器人的 modal 內）：
   它的欄寬是寫在 inline style 上的（width:70px/55px/48px/90px），inline 樣式權重高於樣式表，
   只能用 !important 蓋掉。這裡不改那支 JS，因為它同時被 bot.js 與 backtest.js 掛載。 */
:root[data-ui="mobile"] [data-ind] { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; }
:root[data-ui="mobile"] [data-cond] { display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 6px; align-items: center; }
:root[data-ui="mobile"] [data-ind] input, :root[data-ui="mobile"] [data-ind] select,
:root[data-ui="mobile"] [data-cond] input, :root[data-ui="mobile"] [data-cond] select {
  width: auto !important; min-width: 0; font-size: 16px;
}
:root[data-ui="mobile"] #cb-yaml { height: 180px; font-size: 16px !important; }
/* 停機橫幅的訊息欄有 min-width:220px，手機上會把按鈕擠出去 */
:root[data-ui="mobile"] .halt-banner .halt-msg { min-width: 0; }

/* 走勢欄的兩種非完整狀態：等待批次補值、以及退化成「昨收→現價」的兩點線。
   退化線在 SVG 裡已經畫成虛線且不填色，這裡只補文字狀態的顏色。 */
:root[data-ui="mobile"] .m-trend-wait { color: var(--muted); letter-spacing: 1px; }

/* ---- 交易機器人兩張表的手機版凍結首欄（views/bot.js）----
   這兩張表沒有 columns.js 的代號欄，所以不走 .m-idx／.m-trend 那組，改用獨立的 .m-lead：
     倉位表      → 把「倉位」與「策略」併成一個凍結欄（名稱在上、策略標籤在下的小字）。
                   併成一欄是刻意的：只有一個凍結欄就不必量測第二欄的像素位移，
                   轉向與系統字級放大都不會讓 sticky 的 left 算錯。
     我的機器人表 → 只凍結「名稱」欄。
   捲動容器：#b-list 已在上面的具名名單裡；倉位表的分組 div 不是 .card 的直接子層，
   :has() 那條 fallback 蓋不到，所以 bot.js 在手機版才多包一層 .table-wrap（桌機 DOM 不變）。 */
:root[data-ui="mobile"] {
  --m-lead-w: 128px;
}
:root[data-ui="mobile"] .m-lead {
  position: sticky; left: 0; z-index: 2;
  width: var(--m-lead-w); min-width: var(--m-lead-w); max-width: var(--m-lead-w);
  /* 底色必須不透明，否則捲過去的欄位會從下面透出來 */
  background: var(--panel); text-align: left;
  white-space: normal; line-height: 1.25; overflow-wrap: anywhere;
  /* 捲動邊界要看得出來，否則凍結欄和捲動欄會糊成一片（同 .m-trend 的處理） */
  box-shadow: inset -1px 0 0 var(--border), 6px 0 8px -6px rgba(0, 0, 0, .55);
}
/* 表頭的凍結欄要壓在資料列之上，捲動時才不會被穿透 */
:root[data-ui="mobile"] thead .m-lead { z-index: 3; }
:root[data-ui="mobile"] td.m-lead { font-weight: 700; }
:root[data-ui="mobile"] td.m-lead a { color: var(--text); }
/* 「⚠ 模式不符」是固定短字串，跟著名稱一起斷行會被拆成「⚠ 模／式不符」，整個標籤不換行 */
:root[data-ui="mobile"] td.m-lead > .tag { white-space: nowrap; }
/* 併進來的策略標籤：第二行的小字，標籤本身縮一號才塞得進 128px */
:root[data-ui="mobile"] .m-lead-sub {
  display: block; margin-top: 3px; font-size: 11px; font-weight: 400;
  color: var(--muted); line-height: 1.5;
}
:root[data-ui="mobile"] .m-lead-sub .tag { font-size: 10px; padding: 1px 5px; }
:root[data-ui="mobile"] tbody tr:hover .m-lead { background: var(--panel-2); }

:root[data-ui="mobile"] .news-page-header { align-items: stretch; flex-direction: column; gap: 14px; margin: 4px 0 18px; }
:root[data-ui="mobile"] .news-page-header h1 { font-size: 24px; }
:root[data-ui="mobile"] .news-page-header h1 span { font-size: 11px; }
:root[data-ui="mobile"] .news-actions button { flex: 1; }
:root[data-ui="mobile"] .news-process, :root[data-ui="mobile"] .news-filter-card { padding: 15px; }
:root[data-ui="mobile"] .news-process-header { flex-direction: column; gap: 12px; }
:root[data-ui="mobile"] .news-model { text-align: left; }
:root[data-ui="mobile"] .news-model small { display: inline; margin-left: 6px; }
:root[data-ui="mobile"] .news-progress-grid { grid-template-columns: 1fr; gap: 15px; margin: 18px 0 12px; }
:root[data-ui="mobile"] .news-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
:root[data-ui="mobile"] .news-metric { padding: 12px; gap: 10px; }
:root[data-ui="mobile"] .news-metric strong { font-size: 23px; }
:root[data-ui="mobile"] .news-filter-header { flex-direction: column; align-items: stretch; gap: 12px; }
:root[data-ui="mobile"] .news-filter-inputs { flex-direction: column; align-items: stretch; gap: 10px; }
:root[data-ui="mobile"] .news-filter-inputs input { width: 100%; }
:root[data-ui="mobile"] .news-filter-card .pill-tabs button { font-size: 12px; }
:root[data-ui="mobile"] .news-taxonomy-hint { display: none; }
:root[data-ui="mobile"] .news-articles { grid-template-columns: 1fr; gap: 12px; }
:root[data-ui="mobile"] .news-article { padding: 16px; }
:root[data-ui="mobile"] .news-factors { grid-template-columns: 1fr; gap: 0; }
:root[data-ui="mobile"] .news-results-heading { margin-top: 20px; }

:root[data-ui="mobile"] .modal.strategy-bulk-dialog { width: 100%; max-height: 90dvh; padding: 0; overflow: hidden; }
:root[data-ui="mobile"] .strategy-bulk-dialog header, :root[data-ui="mobile"] .strategy-bulk-dialog footer { padding: 12px; flex-wrap: wrap; }
:root[data-ui="mobile"] .strategy-bulk-body { padding: 0 12px 12px; }
:root[data-ui="mobile"] .strategy-bulk-fields { grid-template-columns: 1fr; }
