/* =====================================================================
   A股盘后选股助手 — 单一 Design System
   风格：浅色专业金融研究工作台（Swiss / Minimalism · 数据密集 · 克制动效）
   说明：本文件为唯一视觉来源，已移除历史 Fluid Exchange 深色覆盖层。
   上涨=红 / 下跌=绿（A 股金融语义，不可为统一主题而改）。
   ===================================================================== */

/* ----- 1. tokens ----- */
:root {
  /* ink / text */
  --ink: #14181b;
  --text: #2a3134;
  --muted: #656f73;
  --faint: #8b9499;

  /* surfaces — three tiers for real depth (canvas → surface → raised) */
  --canvas: #eef1f3;
  --surface: #ffffff;
  --surface-soft: #f3f5f6;
  --surface-sunken: #e9ebee;
  --raised: #ffffff;
  --sidebar: #ffffff;

  /* lines */
  --line: #dfe3e6;
  --line-strong: #ccd2d6;
  --hairline: #eceef0;

  /* primary accent (teal — structural / neutral-positive) */
  --primary: #0f7a6e;
  --primary-strong: #0a5d54;
  --primary-soft: #e0efec;
  --primary-tint: #f0f7f5;

  /* warm secondary (amber / gold — attention, leaders, “watch”) */
  --amber: #b07d22;
  --amber-strong: #8f6316;
  --amber-soft: #f7eed6;
  --amber-tint: #fbf4e3;

  /* cool secondary (slate-blue — structural, rank, secondary charts) */
  --slate: #3e5a8a;
  --slate-strong: #324b78;
  --slate-soft: #e6ecf4;
  --slate-tint: #f1f4f9;

  /* semantic — A 股：上涨红 / 下跌绿 */
  --positive: #d63d2e;
  --positive-soft: #fbe9e6;
  --negative: #0e8a72;
  --negative-soft: #e4f3ef;
  --warn: #b07d22;
  --warn-soft: #f7eed6;
  --danger: #cb3b34;
  --danger-soft: #fbeae8;
  --green: #0e8a72;          /* used by breakdownRow healthy bars */
  --coral: #d63d2e;          /* kept for breakdownRow risk bar + tag.accent */
  --coral-soft: #fbe9e6;

  /* score tiers — cool → base → hot (weak market = cool, hot market = red, matches A 股 heat) */
  --tier-cool: #5b7fb0;
  --tier-cool-soft: #e6edf5;
  --tier-base: #0f7a6e;
  --tier-base-soft: #e0efec;
  --tier-hot: #d63d2e;
  --tier-hot-soft: #fbe9e6;

  /* brand gradient (restrained, used only on brand mark + focus hero) */
  --grad-brand: linear-gradient(135deg, #14a89a 0%, #0a5d54 100%);
  --grad-amber: linear-gradient(135deg, #d4a23a 0%, #b07d22 100%);

  /* console (intentional dark log panel inside the light system) */
  --console-bg: #0f1a1f;
  --console-border: #1d3036;
  --console-text: #c8d9dc;
  --console-dim: #6f868c;

  /* status pills */
  --pill-ok-bg: #e0efec; --pill-ok-fg: #0a5d54;
  --pill-warn-bg: #f7eed6; --pill-warn-fg: #8f6316;
  --pill-risk-bg: #fbe9e6; --pill-risk-fg: #c0392e;
  --pill-active-bg: #e0efec; --pill-active-fg: #0a5d54;
  --pill-idle-bg: #eef1f3; --pill-idle-fg: #5a6469;

  /* shape */
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --radius-xl: 10px;

  /* motion */
  --t-fast: 120ms;
  --t: 180ms;
  --t-slow: 220ms;
  --ease: cubic-bezier(.2, .8, .2, 1);

  /* metrics */
  --sidebar-width: 208px;
  --topbar-height: 60px;
  --row-height: 46px;
  --density-pad: 9px 12px;

  /* shadows — deeper, with a faint teal contact for raised surfaces */
  --shadow-sm: 0 1px 2px rgba(20, 24, 27, .06);
  --shadow: 0 8px 22px rgba(20, 24, 27, .10);
  --shadow-raised: 0 2px 10px rgba(15, 122, 110, .07), 0 6px 20px rgba(20, 24, 27, .08);
  --shadow-lg: 0 18px 50px rgba(20, 24, 27, .16);
}

/* ----- 2. reset / base ----- */
* { box-sizing: border-box; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--text);
  font-family: system-ui, "Segoe UI", "Microsoft YaHei UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid rgba(15, 122, 110, .55); outline-offset: 2px; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid rgba(15, 122, 110, .55);
  outline-offset: 2px;
}
svg { width: 16px; height: 16px; stroke-width: 1.7; flex-shrink: 0; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 18px; line-height: 1.25; font-weight: 600; letter-spacing: -.01em; }
h2 { margin-bottom: 0; font-size: 15px; line-height: 1.3; font-weight: 600; letter-spacing: -.005em; }
h3 { margin-bottom: 8px; font-size: 12.5px; line-height: 1.4; font-weight: 600; }
p { margin-bottom: 0; }
.num, .report-date b, th, td, .score-cell, .brief-metrics strong, .market-evidence strong,
.index-item strong, .inspector-metrics dd, .health-list dd, .scheduler-meta dd,
.custom-result-count strong, .breakdown-row span:last-child { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.positive { color: var(--positive) !important; }
.negative { color: var(--negative) !important; }

/* ----- 3. layout ----- */
.app-shell { min-height: 100vh; }
.workspace { min-height: 100vh; margin-left: var(--sidebar-width); display: flex; flex-direction: column; }
main { flex: 1; min-width: 0; }
.view { display: none; }
.view.active { display: block; }

/* ----- 4. navigation ----- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--sidebar-width);
  padding: 18px 14px 14px;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.brand { min-height: 40px; padding: 0 6px; display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 32px; height: 32px; flex: 0 0 auto;
  display: grid; place-items: center;
  border-radius: var(--radius);
  background: var(--grad-brand); color: #fff;
  box-shadow: 0 2px 6px rgba(10, 93, 84, .28);
}
.brand-mark svg { width: 18px; height: 18px; stroke-width: 2; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 13.5px; line-height: 1.15; font-weight: 700; letter-spacing: .01em; color: var(--ink); }
.brand small { margin-top: 3px; color: var(--faint); font-size: 10.5px; }
.nav-list { display: grid; gap: 2px; margin-top: 22px; }
.nav-item {
  width: 100%; min-height: 42px; padding: 0 12px;
  border: 0; border-left: 2px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted);
  display: flex; align-items: center; gap: 11px;
  text-align: left; font-size: 13px; font-weight: 500;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.nav-item svg { width: 17px; height: 17px; stroke-width: 1.8; }
.nav-item:hover { background: var(--surface-soft); color: var(--ink); }
.nav-item.active {
  border-left-color: var(--primary);
  background: var(--primary-tint);
  color: var(--primary-strong);
  font-weight: 600;
}
.sidebar-foot {
  margin-top: auto; padding: 13px 6px 2px;
  border-top: 1px solid var(--hairline);
  color: var(--faint); font-size: 10.5px;
}
.sidebar-foot > span { display: flex; align-items: center; gap: 7px; }
.sidebar-foot small { display: block; margin-top: 10px; color: var(--faint); line-height: 1.5; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.status-dot.ok { background: var(--negative); }
.status-dot.error { background: var(--danger); }

/* mobile bottom nav (kept 5 items, safe-area, ≥44px hit) */
.mobile-nav { display: none; }

/* ----- 5. topbar ----- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  min-height: var(--topbar-height);
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
}
.title-row, .topbar-actions { display: flex; align-items: center; gap: 10px; }
.title-row { flex: 1; min-width: 0; }
.title-row > div { min-width: 120px; }
.page-context, .section-label {
  display: block; margin: 0 0 3px;
  color: var(--faint); font-size: 10.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  padding-left: 9px; position: relative;
}
.page-context::before, .section-label::before {
  content: ""; position: absolute; left: 0; top: 3px;
  width: 3px; height: 11px; border-radius: 2px; background: var(--primary);
}
.title-row h1 { color: var(--ink); }
.report-date {
  min-height: 34px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px;
}
.report-date svg { width: 14px; height: 14px; color: var(--faint); }
.report-date b { font-weight: 600; color: var(--text); }
.topbar-actions { margin-left: auto; }

/* ----- 6. controls ----- */
.icon-button, .primary-button, .secondary-button, .ghost-button, .text-button {
  min-height: 34px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 13px; font-weight: 600;
  transition: background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease), color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.primary-button { padding: 0 14px; border: 0; background: var(--primary); color: #fff; }
.primary-button:hover { background: var(--primary-strong); }
.secondary-button { padding: 0 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--primary-strong); }
.secondary-button:hover { background: var(--primary-soft); border-color: var(--primary); }
.ghost-button { padding: 0 11px; border: 1px solid transparent; background: transparent; color: var(--muted); }
.ghost-button:hover { background: var(--surface-soft); color: var(--ink); }
.icon-button { width: 34px; padding: 0; border: 1px solid var(--line); background: var(--surface); color: var(--muted); }
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-soft); color: var(--ink); }
.text-button { padding: 0; min-height: auto; background: transparent; border: 0; color: var(--primary); }
.text-button:hover { color: var(--primary-strong); }
.primary-button:disabled, .secondary-button:disabled, .ghost-button:disabled, .icon-button:disabled { opacity: .45; cursor: not-allowed; }

.search-box {
  min-width: 240px; height: 34px; padding: 0 11px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--muted);
  display: flex; align-items: center; gap: 8px;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
.search-box svg { width: 15px; height: 15px; color: var(--faint); }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 122, 110, .1); }
.search-box input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: var(--ink); height: 100%; }
.search-box input::placeholder { color: var(--faint); }
.search-box.compact { min-width: 220px; height: 32px; }

select, input[type="date"], input[type="number"], input[type="time"] {
  min-height: 34px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--ink);
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
select:focus, input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15, 122, 110, .1); }
.compact-filters select { min-height: 32px; }
.history-select { max-width: 160px; min-height: 34px; font-size: 12.5px; }
.history-select:disabled { opacity: .45; cursor: not-allowed; }

.segmented { display: inline-flex; padding: 3px; background: var(--surface-sunken); border-radius: var(--radius-sm); }
.segmented button {
  min-height: 28px; padding: 0 14px; border: 0; border-radius: 3px;
  background: transparent; color: var(--muted);
  font-size: 12.5px; font-weight: 600;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.segmented button:hover { color: var(--ink); }
.segmented button.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }

/* switch */
.switch { position: relative; width: 34px; height: 19px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 10px; background: #c3cacd; transition: background var(--t) var(--ease); }
.switch span::after { content: ""; position: absolute; width: 13px; height: 13px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform var(--t) var(--ease); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(15px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px rgba(15, 122, 110, .18); }

/* ----- 7. data table ----- */
.toolbar { display: flex; align-items: center; gap: 10px; }
.page-toolbar { margin-bottom: 14px; flex-wrap: wrap; }
.table-wrap { width: 100%; overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; font-size: 12.5px; }
th, td {
  height: var(--row-height); padding: var(--density-pad);
  border-bottom: 1px solid var(--hairline);
  text-align: left; vertical-align: middle;
}
th {
  position: sticky; top: 0; z-index: 2; height: 38px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line-strong);
  color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
th.num, td.num { text-align: right; }
tbody tr { transition: background var(--t-fast) var(--ease); }
tbody tr:hover { background: var(--primary-tint); }
tbody tr.selected { background: var(--primary-soft); box-shadow: inset 2px 0 0 var(--primary); }
tbody tr:last-child td { border-bottom: 0; }
.rank-cell { width: 36px; text-align: center; font-weight: 700; color: var(--faint); }
.rank-cell.top { color: var(--positive); }
.stock-cell strong, .stock-cell small { display: block; }
.stock-cell strong { margin-bottom: 2px; color: var(--ink); font-size: 12.5px; font-weight: 600; }
.stock-cell small { color: var(--faint); font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 10.5px; letter-spacing: .02em; }
.score-cell {
  font-size: 13.5px; font-weight: 700; color: var(--primary-strong);
  position: relative; padding-left: 14px;
}
.score-cell::before {
  content: ""; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 2px; background: var(--grad-brand);
}
.context-cell { min-width: 150px; }
.context-cell strong, .context-cell small { display: block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.context-cell strong { margin-bottom: 3px; font-size: 12px; font-weight: 600; color: var(--text); }
.context-cell small { color: var(--muted); font-size: 10.5px; }
.signal-cell { min-width: 180px; max-width: 300px; white-space: normal; }
.signal-summary { color: var(--text); font-size: 12px; line-height: 1.55; }
.formula-hit-summary { color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.tag {
  display: inline-flex; align-items: center; min-height: 21px; padding: 1px 7px;
  border: 1px solid var(--line-strong); border-radius: 3px;
  background: var(--surface-soft); color: var(--muted);
  font-size: 10.5px; line-height: 1.2;
}
.tag.accent { border-color: rgba(214, 61, 46, .28); background: var(--positive-soft); color: var(--positive); }
.tag.risk { border-color: rgba(203, 59, 52, .26); background: var(--danger-soft); color: var(--danger); }
.risk-quiet { color: var(--faint); font-size: 11px; }
.detail-button { width: 30px; min-height: 30px; border-color: transparent; background: transparent; color: var(--faint); }
.detail-button:hover { border-color: var(--line); background: var(--surface-soft); color: var(--primary); }
.empty-state { padding: 28px; color: var(--faint); text-align: center; font-size: 12px; }
.table-footer {
  min-height: 42px; padding: 9px 2px 0;
  color: var(--faint);
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  font-size: 11px;
}

/* ----- 8. overview ----- */
.page-view { padding: 22px clamp(18px, 2.4vw, 34px) 44px; }
.overview-workbench {
  min-height: calc(100vh - var(--topbar-height));
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  background: var(--surface);
}
.brief-intro, .brief-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--hairline);
}
.brief-section:last-child { border-bottom: 0; }
.brief-section { padding-top: 17px; padding-bottom: 17px; }
.brief-intro .section-label b { font-weight: 600; color: var(--muted); }
.market-guidance { margin: 8px 0 0; color: var(--ink); font-size: 13px; font-weight: 500; line-height: 1.65; }
.inline-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.inline-heading h2 { font-size: 13px; }
.guardrail-list {
  margin: 11px 0 0; padding: 0; counter-reset: guardrail; list-style: none;
  display: grid; gap: 10px;
}
.guardrail-list li {
  counter-increment: guardrail; position: relative; padding-left: 28px;
  color: var(--text); font-size: 12px; line-height: 1.55;
}
.guardrail-list li::before {
  content: counter(guardrail); position: absolute; left: 0; top: 1px;
  width: 18px; height: 18px; border: 0; border-radius: 50%;
  color: #fff; display: grid; place-items: center;
  font-size: 9.5px; font-weight: 700;
  background: var(--grad-amber);
  box-shadow: 0 1px 3px rgba(143, 99, 22, .3);
}
.risk-inline {
  padding: 2px 8px; border-radius: 3px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 10.5px; font-weight: 700;
}
.risk-inline.high { background: var(--danger-soft); color: var(--danger); }
.risk-inline.low { background: var(--negative-soft); color: var(--negative); }
.brief-metrics {
  margin-top: 12px;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px; background: var(--hairline); border: 1px solid var(--hairline);
}
.brief-metrics > div { padding: 11px 12px; background: var(--surface); }
.brief-metrics span, .brief-metrics small { display: block; color: var(--muted); font-size: 10.5px; }
.brief-metrics span { font-weight: 500; }
.brief-metrics strong { display: inline-block; margin: 6px 3px 4px 0; font-size: 20px; line-height: 1; color: var(--ink); }
.brief-metrics small { line-height: 1.45; }
.mini-track { width: 100%; height: 4px; margin-top: 6px; overflow: hidden; background: var(--surface-sunken); border-radius: 2px; }
.mini-track i { display: block; width: 0; height: 100%; background: var(--grad-brand); border-radius: 2px; }
.index-ledger { margin-top: 8px; }
.index-item { min-height: 34px; border-bottom: 1px solid var(--hairline); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.index-item:last-child { border-bottom: 0; }
.index-item span { color: var(--muted); font-size: 12px; }
.index-item strong { font-size: 12px; }
.sector-brief .inline-heading span { color: var(--muted); font-size: 10.5px; }
.sector-list { margin-top: 9px; display: grid; gap: 1px; }
.sector-item { min-height: 30px; display: grid; grid-template-columns: 16px minmax(74px, 1fr) 1.1fr auto; align-items: center; gap: 9px; }
.sector-item > b { color: var(--faint); font-size: 10px; font-weight: 700; }
.sector-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 600; color: var(--text); }
.sector-bar { height: 4px; overflow: hidden; background: var(--surface-sunken); border-radius: 2px; }
.sector-bar span { display: block; height: 100%; background: var(--grad-brand); border-radius: 2px; }
.sector-item em { min-width: 46px; text-align: right; font-style: normal; font-size: 11px; font-weight: 700; }

/* overview main: metrics strip → focus workspace */
.overview-main { min-width: 0; display: flex; flex-direction: column; }
.market-evidence {
  min-height: 76px; border-bottom: 1px solid var(--line);
  display: grid; grid-template-columns: .62fr .74fr .82fr 1.5fr .9fr;
}
.market-evidence > div {
  min-width: 0; padding: 16px 20px; border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column; justify-content: center;
}
.market-evidence > div:last-child { border-right: 0; }
.market-evidence span { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10.5px; }
.market-evidence strong { display: inline-block; margin-right: 3px; font-size: 22px; color: var(--ink); }
.market-evidence small { color: var(--muted); font-size: 10.5px; }
.evidence-indexes #evidence-index-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.evidence-indexes #evidence-index-grid div { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.evidence-indexes #evidence-index-grid span { margin-bottom: 0; white-space: nowrap; font-size: 10.5px; }
.evidence-indexes #evidence-index-grid strong { font-size: 13.5px; }
.evidence-temperature strong { display: inline-block; margin-right: 4px; font-size: 22px; }
.evidence-temperature small { display: inline; }
.evidence-temperature i { display: block; width: 100%; height: 5px; margin-top: 10px; overflow: hidden; background: var(--surface-sunken); border-radius: 2px; }
.evidence-temperature i b { display: block; width: 0; height: 100%; background: var(--grad-brand); border-radius: 2px; }

.focus-workspace {
  flex: 1; display: grid;
  grid-template-columns: minmax(560px, 1fr) minmax(320px, 380px);
}
.focus-list-surface { min-width: 0; padding: 18px 20px 12px; border-right: 1px solid var(--hairline); }
.focus-list-surface .table-wrap { border-top: 1px solid var(--hairline); }
.focus-toolbar { min-height: 44px; margin-bottom: 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.compact-filters { display: flex; align-items: center; gap: 8px; }

.stock-inspector { min-width: 0; padding: 20px 22px; background: var(--surface-soft); }
.stock-inspector header { min-height: 46px; display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.stock-inspector header h2 { font-size: 16px; }
.stock-inspector header p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.stock-inspector header > span { color: var(--faint); font-size: 10.5px; }
.inspector-score { padding: 11px 0 16px; border-bottom: 1px solid var(--hairline); display: flex; align-items: baseline; gap: 10px; }
.inspector-score strong { color: var(--positive); font-size: 26px; font-weight: 700; }
.inspector-score em { margin-left: auto; font-style: normal; font-size: 13px; font-weight: 700; }
.inspector-metrics { margin: 0; padding: 13px 0; border-bottom: 1px solid var(--hairline); display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.inspector-metrics dt { color: var(--muted); font-size: 10px; }
.inspector-metrics dd { margin: 5px 0 0; font-size: 12px; font-weight: 700; color: var(--ink); }
.stock-inspector section { padding: 13px 0; border-bottom: 1px solid var(--hairline); }
.stock-inspector section p { margin: 0; color: var(--text); font-size: 12px; line-height: 1.65; }
.inspector-detail { margin-top: 13px; }
.muted { color: var(--muted); font-size: 11px; }

/* ----- 9. watchlist ----- */
.data-surface, .settings-section {
  min-width: 0; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.data-surface { padding: 16px 18px 8px; }
.surface-heading, .settings-header {
  min-height: 40px; margin-bottom: 12px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.surface-heading h2, .settings-header h2 { font-size: 14px; }
.watchlist-panel { padding-bottom: 6px; }

/* ----- 10. custom strategy ----- */
.single-hero {
  min-height: 104px; padding: 20px 22px 18px;
  margin-bottom: 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border: 1px solid var(--line); border-left: 4px solid var(--primary);
  border-radius: var(--radius-lg); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.single-hero-copy { min-width: 0; max-width: 720px; }
.single-hero-copy h2 {
  margin: 6px 0 6px; color: var(--ink);
  font-size: 22px; font-weight: 700; line-height: 1.15; letter-spacing: -.015em;
}
.single-hero-copy p { max-width: 580px; margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.custom-result-count {
  min-width: 150px; padding: 4px 0 4px 20px;
  border-left: 1px solid var(--hairline); text-align: right;
}
.custom-result-count span, .custom-result-count em { display: block; color: var(--muted); font-size: 10.5px; font-style: normal; }
.custom-result-count strong {
  display: inline-block; margin: 2px 6px 2px 0;
  color: var(--primary-strong); font-size: 34px; font-weight: 700; line-height: 1;
  background: var(--grad-amber);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

.custom-layout {
  min-height: calc(100vh - var(--topbar-height) - 132px);
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-sm);
  display: grid; grid-template-columns: 1fr;
}
.formula-index { min-width: 0; padding: 16px 18px 18px; background: var(--surface); }
.formula-index .surface-heading { margin-bottom: 12px; }
.formula-index .surface-heading h2 { font-size: 13.5px; }
.formula-list {
  margin: 0 0 14px; display: flex;
  gap: 8px; overflow-x: auto; padding-bottom: 6px;
  scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.formula-item {
  position: relative; flex: 0 0 auto; min-width: 132px; max-width: 168px;
  padding: 12px 12px 11px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  display: block; overflow: hidden;
  transition: border-color var(--t) var(--ease), background var(--t) var(--ease), box-shadow var(--t) var(--ease);
}
.formula-item:hover { border-color: var(--line-strong); background: var(--surface-soft); }
.formula-item.active {
  border-color: var(--primary);
  background: var(--primary-tint);
  box-shadow: var(--shadow-sm);
}
.formula-item.disabled { opacity: .5; }
.formula-item button { width: 100%; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; text-align: left; }
.formula-order { display: block; color: var(--faint); font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.formula-icon { width: 26px; height: 26px; margin: 7px 0 7px; color: var(--muted); display: grid; place-items: center; }
.formula-icon svg { width: 22px; height: 22px; stroke-width: 1.6; }
.formula-item.active .formula-order { color: var(--primary); }
.formula-item.active .formula-icon { color: var(--primary); }
.formula-item h3 { min-height: 32px; margin: 0; font-size: 12px; font-weight: 600; line-height: 1.4; color: var(--text); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.formula-item p { display: none; }
.formula-item small { display: block; margin-top: 6px; color: var(--muted); font-size: 10.5px; }
.formula-item.active h3 { color: var(--primary-strong); }
.formula-item.active small { color: var(--primary); }
.formula-item .switch { position: absolute; top: 10px; right: 10px; transform: scale(.82); transform-origin: top right; }
.formula-index > .secondary-button { margin-left: 2px; }
.formula-origin { display: inline-block; margin-left: 6px; padding: 1px 5px; border-radius: 4px; vertical-align: 1px; font-size: 9.5px; font-weight: 600; line-height: 1.5; color: var(--muted); background: var(--secondary-tint, rgba(15, 23, 42, .06)); border: 1px solid var(--hairline); }
.screener-config-bar { display: flex; align-items: center; gap: 8px; margin: 10px 2px 0; flex-wrap: wrap; }
.screener-topn { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); }
.screener-topn input { width: 58px; padding: 5px 7px; border: 1px solid var(--hairline); border-radius: 8px; font-size: 12px; color: var(--text); background: var(--card, #fff); }

.custom-results { min-width: 0; padding: 18px 20px 12px; border-top: 1px solid var(--hairline); }
.custom-result-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.custom-result-header h2 { color: var(--ink); font-size: 16px; }
.custom-result-header p { max-width: 620px; margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.formula-summary {
  margin-top: 12px; padding: 10px 13px;
  border-left: 3px solid var(--primary); background: var(--primary-tint);
  color: var(--text); font-size: 12px; line-height: 1.55; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.custom-toolbar { margin: 14px 0 10px; justify-content: space-between; flex-wrap: wrap; }

/* ----- 11. settings ----- */
.settings-section { padding: 18px 20px; }
.settings-section + .settings-section, .settings-section + .data-surface, .settings-section + .custom-layout,
.data-surface + .settings-section, .data-surface + .data-surface { margin-top: 14px; }
.settings-actions { display: flex; gap: 8px; align-items: center; }
.strategy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 22px; }
.strategy-card {
  min-height: 70px; padding: 14px 0; border-bottom: 1px solid var(--hairline);
  display: grid; grid-template-columns: 3px minmax(0, 1fr) auto; align-items: start; gap: 11px;
}
.strategy-card:nth-last-child(-n+2) { border-bottom: 0; }
.strategy-card.disabled { opacity: .5; }
.strategy-card h3 { margin: 0 0 5px; font-size: 12.5px; }
.strategy-card p { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.family-mark { width: 3px; height: 34px; border-radius: 2px; background: var(--amber); }
.family-mark.trend { background: var(--grad-brand); }
.family-mark.pullback { background: var(--negative); }
.family-mark.event { background: var(--coral); }
.family-mark.sector { background: var(--slate); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-grid label span, .run-controls label span, .option-group > span,
.scheduler-controls > label > span {
  display: block; margin-bottom: 6px; color: var(--muted); font-size: 11px; font-weight: 600;
}
.form-grid label span::after { content: ""; }
.form-grid input { width: 100%; }
.option-group { margin-top: 16px; }
.check-row { display: flex; flex-wrap: wrap; gap: 8px; }
.check-row label {
  min-height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-soft);
  display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text);
}
.check-row input { accent-color: var(--primary); }
.binary-options { margin-top: 10px; }
.performance-surface { margin-top: 16px; }

/* ----- 12. system ----- */
.system-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, .9fr); gap: 14px; align-items: start; }

/* unified status pills across health / run / scheduler */
.health-state, .run-state, .scheduler-state {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 10px; border: 1px solid transparent;
  font-size: 10.5px; font-weight: 700; line-height: 1.4; white-space: nowrap;
}
.health-state::before, .run-state::before, .scheduler-state::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9;
}
.health-state { background: var(--pill-ok-bg); color: var(--pill-ok-fg); }
.health-state.bad { background: var(--pill-risk-bg); color: var(--pill-risk-fg); }
.run-state { background: var(--pill-idle-bg); color: var(--pill-idle-fg); }
.run-state.active { background: var(--pill-active-bg); color: var(--pill-active-fg); }
.run-state.active::before { animation: pulse 1.6s var(--ease) infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.scheduler-state { background: var(--pill-idle-bg); color: var(--pill-idle-fg); }
.scheduler-state.active { background: var(--pill-active-bg); color: var(--pill-active-fg); }
.scheduler-state.pending { background: var(--pill-warn-bg); color: var(--pill-warn-fg); }
.health-list {
  margin: 0; display: grid; grid-template-columns: repeat(2, 1fr);
  border-top: 1px solid var(--hairline); border-left: 1px solid var(--hairline);
}
.health-list div { padding: 11px 12px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.health-list dt { color: var(--muted); font-size: 10.5px; }
.health-list dd { margin: 5px 0 0; font-size: 15px; font-weight: 700; color: var(--ink); }
.run-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.run-controls select, .run-controls input { width: 100%; }
.run-controls button { grid-column: 1 / -1; }
/* intentional dark log console inside the light system — one token-driven panel */
.run-output {
  max-height: 210px; min-height: 90px; margin: 12px 0 0; padding: 12px 14px;
  overflow: auto; border: 1px solid var(--console-border); border-radius: var(--radius);
  background: var(--console-bg); color: var(--console-text);
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 11px; line-height: 1.6;
  white-space: pre-wrap;
  scrollbar-width: thin; scrollbar-color: var(--console-dim) transparent;
}
.scheduler-surface { margin-top: 14px; }
.scheduler-layout { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(380px, .9fr); gap: 26px; align-items: center; }
.scheduler-summary { min-width: 0; display: flex; align-items: flex-start; gap: 13px; }
.scheduler-icon {
  width: 36px; height: 36px; flex: 0 0 auto;
  border: 0; border-radius: var(--radius);
  background: var(--grad-brand); color: #fff;
  display: grid; place-items: center;
  box-shadow: 0 2px 6px rgba(10, 93, 84, .24);
}
.scheduler-summary strong { display: block; margin: 1px 0 6px; font-size: 14px; color: var(--ink); }
.scheduler-summary p { max-width: 560px; margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.6; }
.scheduler-controls { display: grid; grid-template-columns: 120px 170px minmax(210px, 1fr); gap: 12px; align-items: end; }
.scheduler-controls input[type="time"] { width: 100%; }
.scheduler-midday-control { min-height: 34px; margin: 0 !important; display: flex !important; align-items: center; gap: 8px; }
.scheduler-midday-control input[type="checkbox"] { flex: 0 0 auto; accent-color: var(--primary); }
.scheduler-midday-control input[type="time"] { min-width: 0; }
.scheduler-publish {
  min-height: 34px; padding: 5px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-soft); display: flex; align-items: center; gap: 9px;
}
.scheduler-publish input { accent-color: var(--primary); }
.scheduler-publish > span { margin: 0 !important; }
.scheduler-publish b, .scheduler-publish small { display: block; }
.scheduler-publish b { color: var(--ink); font-size: 11px; font-weight: 600; }
.scheduler-publish small { margin-top: 1px; color: var(--faint); font-size: 9.5px; font-weight: 400; line-height: 1.2; }
.scheduler-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 6px; }
.scheduler-meta {
  margin: 15px 0 0; padding-top: 13px; border-top: 1px solid var(--hairline);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
}
.scheduler-meta div { padding: 0 14px; border-right: 1px solid var(--hairline); }
.scheduler-meta div:first-child { padding-left: 0; }
.scheduler-meta div:last-child { border-right: 0; }
.scheduler-meta dt { color: var(--muted); font-size: 10px; }
.scheduler-meta dd { margin: 5px 0 0; font-size: 12px; font-weight: 700; color: var(--ink); }
.runs-surface { margin-top: 14px; }
.runs-surface .signal-cell { min-width: 340px; max-width: 540px; line-height: 1.55; }
.run-status-failed, .run-message-failed { color: var(--danger); }
.system-note {
  margin-top: 14px; padding: 12px 16px;
  border: 1px solid var(--primary-soft); border-left: 3px solid var(--primary);
  border-radius: var(--radius); background: var(--primary-tint);
  display: flex; align-items: center; gap: 9px;
}
.system-note p { margin: 0; color: var(--text); font-size: 11px; }
.system-note svg { color: var(--primary); }

/* ----- 13. footer ----- */
footer {
  min-height: 44px; padding: 0 clamp(18px, 2.4vw, 34px);
  border-top: 1px solid var(--line);
  color: var(--faint);
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  font-size: 10.5px;
}

/* ----- 14. drawer / dialog ----- */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(20, 24, 27, .42); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity var(--t-slow) var(--ease);
}
.stock-drawer {
  position: fixed; inset: 0 0 0 auto; z-index: 61;
  width: min(480px, 92vw);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow-lg);
  transform: translateX(100%); transition: transform var(--t-slow) var(--ease);
  display: flex; flex-direction: column;
}
.drawer-backdrop.open { opacity: 1; visibility: visible; }
.stock-drawer.open { transform: translateX(0); }
.drawer-header {
  min-height: 76px; padding: 18px 20px; border-bottom: 1px solid var(--line);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 15px;
}
.drawer-header h2 { font-size: 19px; }
.drawer-header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.drawer-body { padding: 20px; overflow: auto; }
.drawer-score { min-height: 60px; padding-bottom: 16px; border-bottom: 1px solid var(--hairline); display: flex; align-items: baseline; gap: 8px; }
.drawer-score strong { font-size: 32px; font-weight: 700;
  background: var(--grad-brand); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; }
.drawer-score span { color: var(--muted); font-size: 11px; }
.drawer-score em { margin-left: auto; font-style: normal; font-size: 16px; font-weight: 700; }
.drawer-body > .tag-list { margin-top: 13px; }
.drawer-section { padding: 16px 0; border-bottom: 1px solid var(--hairline); }
.drawer-section:last-child { border-bottom: 0; }
.drawer-section p { margin: 0; color: var(--text); line-height: 1.7; font-size: 12px; }
.risk-section h3 { color: var(--danger); }
.score-breakdown { display: grid; gap: 9px; }
.breakdown-row { display: grid; grid-template-columns: 70px 1fr 40px; align-items: center; gap: 10px; font-size: 11px; color: var(--text); }
.breakdown-row span:first-child { color: var(--muted); }
.breakdown-row span:last-child { text-align: right; font-weight: 700; }
.breakdown-track { height: 5px; background: var(--surface-sunken); border-radius: 2px; overflow: hidden; }
.breakdown-track i { display: block; height: 100%; background: var(--grad-brand); border-radius: 2px; }
.risk-section .breakdown-track i { background: var(--coral); }
.concepts { margin-top: 10px; }
body.drawer-open { overflow: hidden; }

/* toast */
.toast {
  position: fixed; right: 18px; bottom: 18px; z-index: 80;
  max-width: min(360px, calc(100vw - 28px)); padding: 11px 14px;
  border-radius: var(--radius); box-shadow: var(--shadow);
  background: var(--ink); color: #fff; font-size: 12px;
  opacity: 0; pointer-events: none; transform: translateY(6px);
  transition: opacity var(--t) var(--ease), transform var(--t) var(--ease);
}
.toast.show { opacity: 1; transform: translateY(0); }

/* view switch enter (very subtle, reduced-safe) */
.view.view-enter { animation: viewFade var(--t-slow) var(--ease) both; }
@keyframes viewFade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

body.static-mode .local-only { display: none !important; }

/* ----- 15. responsive ----- */
@media (max-width: 1200px) {
  :root { --sidebar-width: 72px; }
  .sidebar { padding-inline: 8px; }
  .brand { justify-content: center; padding: 0; }
  .brand > span:last-child, .nav-item span, .sidebar-foot span span, .sidebar-foot small { display: none; }
  .nav-item { justify-content: center; padding: 0; }
  .overview-workbench { grid-template-columns: 252px minmax(0, 1fr); }
  .market-evidence { grid-template-columns: repeat(3, 1fr); }
  .market-evidence > div:nth-child(3) { border-right: 0; }
  .market-evidence > div:nth-child(n+4) { border-top: 1px solid var(--hairline); }
  .evidence-indexes { grid-column: span 2; }
  .focus-workspace { grid-template-columns: minmax(520px, 1fr) 320px; }
}
@media (max-width: 940px) {
  .overview-workbench { grid-template-columns: 238px minmax(0, 1fr); }
  .focus-workspace { grid-template-columns: 1fr; }
  .focus-list-surface { border-right: 0; }
  .stock-inspector { border-top: 1px solid var(--hairline); }
  .system-grid { grid-template-columns: 1fr; }
  .scheduler-layout { grid-template-columns: 1fr; gap: 18px; }
  .custom-layout { display: block; min-height: auto; }
  .formula-list { flex-wrap: wrap; }
  .custom-results { border-top: 1px solid var(--hairline); }
  .focus-toolbar { align-items: flex-start; flex-direction: column; }
  .compact-filters { width: 100%; }
  .compact-filters .search-box { flex: 1; }
}
@media (max-width: 760px) {
  body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .workspace { margin-left: 0; }
  .topbar { min-height: 54px; padding: 0 14px; gap: 10px; }
  .title-row > div { min-width: 0; }
  h1 { font-size: 16px; }
  .page-context { display: none; }
  .report-date { min-height: 30px; padding: 0 8px; font-size: 10.5px; }
  .report-date svg { display: none; }
  .topbar-actions .ghost-button { display: none; }
  .topbar-actions .primary-button { width: 34px; min-height: 32px; padding: 0; }
  .topbar-actions .primary-button span { display: none; }
  .overview-workbench { display: block; min-height: auto; }
  .brief-intro, .brief-section { padding-inline: 16px; }
  .brief-market, .brief-section:has(#index-grid), .sector-brief { display: none; }
  .market-evidence { min-height: 0; grid-template-columns: repeat(2, 1fr); }
  .market-evidence > div { min-height: 76px; padding: 14px 14px; border-right: 1px solid var(--hairline); border-top: 0; border-bottom: 1px solid var(--hairline); }
  .market-evidence > div:nth-child(2n) { border-right: 0; }
  .market-evidence > div:nth-child(3) { border-right: 1px solid var(--hairline); }
  .evidence-indexes { grid-column: span 2; }
  .evidence-temperature { grid-column: span 2; border-bottom: 0 !important; }
  .focus-workspace { display: block; min-height: 0; }
  .focus-list-surface { padding: 16px 12px 10px; border-right: 0; }
  .stock-inspector { display: none; }
  .focus-toolbar { margin-bottom: 10px; }
  .compact-filters { flex-wrap: wrap; }
  .compact-filters .search-box { order: 2; width: 100%; flex-basis: 100%; }
  .focus-table-wrap { overflow: visible; }
  #focus-table th:nth-child(3), #focus-table td:nth-child(3),
  #focus-table th:nth-child(6), #focus-table td:nth-child(6),
  #focus-table th:nth-child(7), #focus-table td:nth-child(7) { display: none; }
  #focus-table th, #focus-table td { padding-inline: 7px; }
  .table-footer { padding-inline: 2px; }
  .page-view { padding: 14px 12px 30px; }
  .page-toolbar { flex-wrap: wrap; gap: 8px; }
  .page-toolbar .search-box { order: 3; width: 100%; min-width: 0; }
  .watchlist-panel { padding: 14px 0 4px; }
  .watchlist-panel .surface-heading { padding: 0 14px; margin-bottom: 8px; }
  .watchlist-panel .table-wrap { padding: 0; }
  #watchlist-table th:nth-child(n+5):nth-child(-n+10), #watchlist-table td:nth-child(n+5):nth-child(-n+10) { display: none; }
  #watchlist-table th, #watchlist-table td { padding-inline: 7px; }
  .custom-layout { display: block; min-height: 0; }
  .formula-index { padding: 14px 12px 12px; }
  .formula-list { display: flex; flex-wrap: nowrap; margin-right: -12px; padding-right: 12px; padding-bottom: 8px; scroll-snap-type: x mandatory; }
  .formula-item { min-width: 112px; scroll-snap-align: center; }
  .custom-results { padding: 16px 12px 8px; }
  .custom-toolbar { align-items: flex-start; flex-direction: column; }
  .custom-toolbar .search-box { width: 100%; min-width: 0; }
  #custom-results-table th:nth-child(4), #custom-results-table td:nth-child(4),
  #custom-results-table th:nth-child(6), #custom-results-table td:nth-child(6),
  #custom-results-table th:nth-child(7), #custom-results-table td:nth-child(7),
  #custom-results-table th:nth-child(8), #custom-results-table td:nth-child(8) { display: none; }
  .strategy-grid { grid-template-columns: 1fr; }
  .strategy-card:nth-last-child(2) { border-bottom: 1px solid var(--hairline); }
  .form-grid { grid-template-columns: 1fr; }
  .scheduler-controls { grid-template-columns: 1fr; }
  .scheduler-actions { grid-column: auto; justify-content: stretch; }
  .scheduler-actions button { flex: 1; }
  .scheduler-meta { grid-template-columns: 1fr; gap: 10px; padding-top: 10px; }
  .scheduler-meta div, .scheduler-meta div:first-child { padding: 0 0 10px; border-right: 0; border-bottom: 1px solid var(--hairline); }
  .scheduler-meta div:last-child { padding-bottom: 0; border-bottom: 0; }
  .settings-header { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
  .settings-actions { display: grid; grid-template-columns: 1fr auto; width: 100%; }
  .data-surface, .settings-section { padding: 14px; }
  .single-hero { min-height: auto; padding: 14px 2px 12px; flex-wrap: wrap; gap: 12px; }
  .single-hero-copy h2 { font-size: 20px; }
  .custom-result-count { padding-left: 12px; }
  .custom-result-count strong { font-size: 28px; }
  .mobile-nav {
    position: fixed; inset: auto 0 0; z-index: 50;
    height: calc(58px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
    display: grid; grid-template-columns: repeat(5, 1fr);
  }
  .mobile-nav button {
    border: 0; background: transparent; color: var(--muted);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    min-height: 44px; font-size: 9.5px; font-weight: 500;
  }
  .mobile-nav button svg { width: 19px; height: 19px; stroke-width: 1.8; }
  .mobile-nav button.active { color: var(--primary); }
  .mobile-nav button.active span { font-weight: 700; }
  .stock-drawer { width: 100vw; }
  footer { min-height: 56px; padding: 0 14px; align-items: flex-start; flex-direction: column; justify-content: center; gap: 3px; }
  .toast { right: 12px; bottom: 72px; }
}
@media (max-width: 420px) {
  .market-evidence strong { font-size: 19px; }
  .check-row label { width: calc(50% - 4px); }
  .title-row { gap: 8px; }
}

/* ----- 16. reduced motion ----- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* =====================================================================
   同花顺识股导出 Dialog（ths_export.js 动态构建；Canvas 不改）
   与主设计系统统一：浅色、克制动效、圆角与 token 一致。
   ===================================================================== */
.ths-export-button { flex-shrink: 0; }
.compact-filters .ths-export-button { padding: 0 12px; min-height: 32px; font-size: 12px; }
.compact-filters .ths-export-button span { white-space: nowrap; }
.page-toolbar .ths-export-button, .custom-toolbar .ths-export-button { min-height: 34px; }

body.ths-overlay-open { overflow: hidden; }
.ths-overlay-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(20, 24, 27, .42); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: clamp(12px, 3vw, 32px);
  animation: thsFade var(--t-slow) var(--ease) both;
}
@keyframes thsFade { from { opacity: 0; } to { opacity: 1; } }
.ths-dialog {
  width: min(560px, 100%); max-height: calc(100dvh - 48px);
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-lg);
  overflow: hidden; color: var(--text);
  animation: thsPop var(--t-slow) var(--ease) both;
}
@keyframes thsPop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.ths-image-dialog { width: min(720px, 100%); }
.ths-dialog-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--line);
}
.ths-dialog-head h3 { margin: 0; font-size: 15px; font-weight: 600; color: var(--ink); }
.ths-close {
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: 0;
  background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.ths-close:hover { background: var(--surface-soft); color: var(--ink); }
.ths-dialog-sub { padding: 10px 18px 0; font-size: 12px; color: var(--muted); }
.ths-text-box {
  flex: 1; min-height: 180px; max-height: 52dvh;
  margin: 12px 18px 0; padding: 12px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface-soft); color: var(--ink);
  font: 13px/1.65 ui-monospace, "SF Mono", Consolas, "PingFang SC", monospace;
  white-space: pre; resize: none; overflow: auto;
}
.ths-image-wrap { flex: 1; min-height: 0; padding: 12px 18px; display: flex; justify-content: center; }
.ths-image-scroll { overflow: auto; max-height: 58dvh; width: 100%; }
.ths-canvas-host { display: flex; justify-content: center; }
.ths-canvas-host canvas { max-width: 100%; height: auto; border-radius: var(--radius); box-shadow: var(--shadow); background: #fff; }
.ths-pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 6px 18px; }
.ths-page-no { font-size: 12.5px; color: var(--muted); min-width: 80px; text-align: center; }
.ths-dialog-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px 15px; border-top: 1px solid var(--line); flex-wrap: wrap;
}
.ths-dialog-foot > div { display: flex; gap: 8px; flex-wrap: wrap; }
.ths-count { font-size: 12px; color: var(--muted); }
.ths-tip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; color: var(--muted); font-size: 12px; }
.ths-tip i { width: 14px; height: 14px; }
.ths-tip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 600px) {
  .ths-dialog-foot { flex-direction: column; align-items: stretch; }
  .ths-dialog-foot > div { justify-content: flex-end; }
  .compact-filters .ths-export-button span { display: none; }
  .compact-filters .ths-export-button { padding: 0 10px; }
  .page-toolbar .ths-export-button span, .custom-toolbar .ths-export-button span { font-size: 12px; }
}
