/* ════════════════════════════════════════════════════════════════
   期货研究终端 — shared design system (blue / white)
   "Research broadsheet": 白底 · 极淡冷调方格纸 · 编辑体衬线标题 ·
   克制的钢蓝强调色 · 红=利多/做多 绿=利空/做空（中国期货习惯）。
   Linked by index.html / scan.html / news.html.
   ════════════════════════════════════════════════════════════════ */

:root {
  --paper:    #ffffff;            /* 基础白 */
  --paper-2:  #fbfcfe;            /* 极淡冷调面板（接近纯白）*/
  --paper-3:  #f2f5fb;            /* 加深/hover */
  --ink:      #11141b;            /* 冷近黑（更深，拉开与白底对比）*/
  --ink-soft: #3d434f;
  --muted:    #6d7380;            /* 次要文字：加深以提高在白底上的可读性 */
  --line:     #eef1f7;            /* 发丝线 / 网格（更淡，整体更白）*/
  --line-2:   #dee3ed;
  --accent:    #2456d6;           /* 钢蓝强调色 */
  --accent-hi: #3d70f5;
  --accent-bg: rgba(36,86,214,0.09);
  --bull:     #d23a2e;            /* 利多 / 做多 红 */
  --bull-bg:  #fbeae7;
  --bear:     #1c9b6a;            /* 利空 / 做空 绿 */
  --bear-bg:  #e6f5ee;
  --blue:     #2456d6;            /* 进场 / 中性数据 = 强调蓝 */
  --warn:     #b3802a;
  --warn-bg:  rgba(232,163,61,0.14);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%232456d6' stroke-width='1.5'/%3E%3C/svg%3E");
  --chart-current: var(--accent);
  --chart-axis: #88909f;
  --chart-grid: rgba(20,23,31,0.07);
  --chart-axis-line: rgba(20,23,31,0.18);
  --chart-tooltip-bg: rgba(255,255,255,0.98);
  --chart-band-line: rgba(90,98,112,0.35);
  --chart-band-bg: rgba(36,86,214,0.08);
  --chart-zoom-bg: rgba(20,23,31,0.03);
  --chart-zoom-area: rgba(20,23,31,0.05);
  /* 分位线（25% / 中位数 / 75%）：低=绿、高=红。股指贴水页用 */
  --chart-p25: #2f9e6f;
  --chart-p50: #e08a2f;
  --chart-p75: #d0483c;
  --chrome-bg: rgba(255,255,255,0.84);
  --body-glow: rgba(36,86,214,0.06);
  --serif:    "Fraunces", "Noto Serif SC", Georgia, serif;
  --cjk:      "Noto Serif SC", Georgia, serif;            /* 正文：衬线 */
  --sans:     "Hanken Grotesk", "Noto Sans SC", system-ui, sans-serif;
  --mono:     "JetBrains Mono", ui-monospace, monospace;
  --shadow:   0 18px 42px -30px rgba(20,30,70,0.30);

  /* 奢华金：VIP 权益专属色（情报速递的转化位）。
     浅色下 --gold 要压深才在白底上读得清；--gold-ink 是金底上的文字，
     两种主题都保持深色——金色填充始终是亮的。 */
  --gold:      #9a7418;
  --gold-hi:   #d8b45f;
  --gold-ink:  #2f2306;
  --gold-bg:   rgba(154,116,24,0.08);
  --gold-line: rgba(154,116,24,0.30);

  /* 旧 token 别名（暗色/黄铜时代遗留），映射到新蓝白 token，免逐条改写内联样式 */
  --paper-hi:  var(--paper-2);
  --ink-2:     var(--paper-2);
  --hair:      var(--line);
  --hair-2:    var(--line-2);
  --text:      var(--ink);
  --text-soft: var(--ink-soft);
  --amber:     var(--accent);
  --amber-hi:  var(--accent-hi);
  --amber-dim: var(--accent-bg);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --paper:    #0f1012;
  --paper-2:  #16181b;
  --paper-3:  #202329;
  --ink:      #f0f2f4;
  --ink-soft: #c5cad1;
  --muted:    #8c949f;
  --line:     #282c32;
  --line-2:   #383e46;
  --accent:    #8fa6bd;
  --accent-hi: #b2c2d2;
  --accent-bg: rgba(143,166,189,0.15);
  --bull:     #f06d64;
  --bull-bg:  rgba(240,109,100,0.13);
  --bear:     #4fc08b;
  --bear-bg:  rgba(79,192,139,0.13);
  --blue:     #8fa6bd;
  --warn:     #c89b55;
  --warn-bg:  rgba(200,155,85,0.14);
  /* 奢华金深色版：比浅色更亮更饱和，--gold-ink 仍取深色 */
  --gold:      #e0bd76;
  --gold-hi:   #f3e0ab;
  --gold-ink:  #2f2306;
  --gold-bg:   rgba(224,189,118,0.10);
  --gold-line: rgba(224,189,118,0.32);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238fa6bd' stroke-width='1.5'/%3E%3C/svg%3E");
  --chart-current: #c9d8e8;
  --chart-axis: #858d98;
  --chart-grid: rgba(197,202,209,0.08);
  --chart-axis-line: rgba(197,202,209,0.16);
  --chart-tooltip-bg: rgba(22,24,27,0.98);
  --chart-band-line: rgba(169,181,195,0.32);
  --chart-band-bg: rgba(143,166,189,0.11);
  --chart-zoom-bg: rgba(240,242,244,0.045);
  --chart-zoom-area: rgba(240,242,244,0.07);
  /* 分位线深色版：比浅色更亮更饱和（深底会吃掉对比度） */
  --chart-p25: #5fc79a;
  --chart-p50: #f0b25c;
  --chart-p75: #e8695c;
  --chrome-bg: rgba(15,16,18,0.88);
  --body-glow: rgba(143,166,189,0.04);
  --amber: var(--warn);
  --amber-hi: var(--warn);
  --amber-dim: var(--warn-bg);
  --shadow:   0 20px 48px -30px rgba(0,0,0,0.78);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); background: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  /* 极淡的方格纸 + 右上角冷光，呼应图表工具气质 */
  background-image:
    radial-gradient(80% 50% at 92% -8%, var(--body-glow), transparent 60%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 100% 100%, 48px 48px, 48px 48px;
  background-attachment: fixed;
  min-height: 100vh;
}

.app-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 4200;
  min-width: 280px;
  max-width: min(88vw, 520px);
  padding: 14px 18px;
  border: 1px solid var(--line-2);
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 70px -32px rgba(17, 20, 27, .45);
  transform: translate(-50%, calc(-50% - 12px));
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  font: 700 13px/1.5 var(--sans);
  text-align: center;
}
.app-toast.show {
  opacity: 1;
  transform: translate(-50%, -50%);
}
.app-toast.error {
  border-left-color: var(--bull);
}
.app-toast.success {
  border-left-color: var(--bear);
}

/* ───────────── 图标（static/icons.svg）─────────────
   模板用 {{ icon('名字') }} 引用 sprite 里的 <symbol>。
   尺寸用 em 跟随所在文字，描边是 currentColor——深浅主题、hover 变色都不用另写。 */
.icon {
  display: inline-block; flex: none;
  width: 1em; height: 1em;
  vertical-align: -0.15em;
  stroke-width: 2;
}
.icon-sm { width: .85em; height: .85em; stroke-width: 2.2; }
.icon-lg { width: 1.2em; height: 1.2em; }
.nav-drop-menu .icon { margin-right: 7px; opacity: .85; }

/* ───────────── masthead ───────────── */
/* 只匹配站点页头。用裸 `header` 会把页面内的 <header>（文章标题、区块标题）
   一起变成 sticky + z-index:3000，滚动时会盖在导航栏上面。 */
body > header {
  position: sticky; top: 0; z-index: 3000; isolation: isolate;
  background: var(--chrome-bg);
  backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--line-2);
}
.mast {
  width: 100%; max-width: 100%; padding: 16px 28px;
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 13px; }
.logo {
  width: 46px; height: 46px; flex: none; border-radius: 14px;
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  border: 1px solid color-mix(in srgb, var(--line-2) 82%, transparent);
  display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 10px 24px -18px color-mix(in srgb, var(--ink) 36%, transparent);
}
.logo img {
  width: 100%; height: 100%; display: block; object-fit: cover;
}
.brand .titles { display: flex; flex-direction: column; gap: 1px; }
.brand .company {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--ink);
}
.brand .kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.30em;
  text-transform: uppercase; color: var(--accent);
}
.brand h1 {
  margin: 0; font-family: var(--serif); font-weight: 700;
  font-size: 20px; line-height: 1.08; letter-spacing: -0.005em; color: var(--ink);
}
.brand .brand-heading {
  margin: 0; font-family: var(--serif); font-weight: 700;
  font-size: 20px; line-height: 1.08; letter-spacing: -0.005em; color: var(--ink);
}
.brand h1 em,
.brand .brand-heading em { font-style: italic; font-weight: 500; color: var(--accent); }
nav { position: relative; z-index: 3100; display: flex; gap: 22px; align-items: center; margin-left: 6px; }
nav a {
  font-family: var(--sans); font-size: 14px; font-weight: 500;
  text-decoration: none; color: var(--muted);
  padding: 4px 1px; border-bottom: 2px solid transparent; transition: all .18s ease;
}
nav a:hover { color: var(--ink); }
nav a.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
/* 机会扫描下拉样式已内联到 base.html（随页面返回，避免静态 CSS 缓存问题） */
.source {
  margin-left: auto; text-align: right;
  font-family: var(--mono); font-size: 11px; line-height: 1.55;
  color: var(--muted); letter-spacing: 0.03em; max-width: 320px;
}
.source b { color: var(--ink-soft); font-weight: 500; }
.logout-link {
  font-family: var(--mono); font-size: 11px; text-decoration: none;
  color: var(--muted); margin-left: 12px; white-space: nowrap;
  padding: 6px 14px; border-radius: 8px;
  border: 1px solid var(--line-2);
  background: var(--paper-2);
  transition: all .15s ease;
}
.logout-link:hover { color: var(--bull); border-color: var(--bull); background: var(--bull-bg); }
/* live ticker strip (news) */
.tape {
  overflow: hidden; border-top: 1px solid var(--line);
  background: var(--paper-2);
  font-family: var(--mono); font-size: 11px; color: var(--ink-soft);
}
.tape-track {
  display: inline-flex; gap: 38px; white-space: nowrap;
  padding: 7px 0; animation: marquee 32s linear infinite;
}
.tape-track span { letter-spacing: 0.06em; }
.tape-track .dot { color: var(--accent); }
@keyframes marquee { from { transform: translateX(0) } to { transform: translateX(-50%) } }

/* ───────────── layout ───────────── */
main { width: 100%; max-width: 100%; padding: 26px 28px 80px; }
.panel {
  border: 1px solid var(--line); border-radius: 16px; background: var(--paper);
  box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 20px;
}
/* 表格面板：允许横向滚动，不裁剪内容 */
.table-panel { padding: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ───────────── command bar ───────────── */
.cmd {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 16px 20px; border: 1px solid var(--line); border-radius: 14px;
  background: var(--paper); box-shadow: var(--shadow); margin-bottom: 18px;
}
/* form fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field .lbl {
  font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: 0.03em;
  color: var(--muted);
}
.field.inline { flex-direction: row; align-items: center; gap: 8px;
  font-family: var(--sans); font-size: 12.5px; font-weight: 500; color: var(--ink-soft); }

input, select {
  font-family: var(--sans); font-size: 13.5px; height: 38px; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 0 12px; transition: border-color .16s ease, box-shadow .16s ease;
}
input:hover, select:hover { border-color: var(--muted); }
input[type=number] { width: 92px; font-family: var(--mono); }
select {
  padding-right: 30px; cursor: pointer; appearance: none; min-width: 122px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat; background-position: right 11px center;
}
input:focus, select:focus, button:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg);
}

button {
  font-family: var(--sans); font-size: 13.5px; font-weight: 600; letter-spacing: 0.01em;
  height: 38px; padding: 0 18px; cursor: pointer; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--paper); color: var(--ink);
  transition: all .16s ease;
}
button:hover { background: var(--paper-3); border-color: var(--muted); transform: translateY(-1px); }
button.primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
button.primary:hover {
  background: var(--accent-hi); border-color: var(--accent-hi);
  box-shadow: 0 12px 26px -12px color-mix(in srgb, var(--accent) 60%, transparent);
}
button.accent { border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); background: var(--paper); }
button.accent:hover { background: var(--accent-bg); border-color: var(--accent); color: var(--accent); }
button.secondary { border-color: var(--line); color: var(--ink-soft); background: var(--paper); }
button.secondary:hover { background: var(--paper-3); color: var(--ink); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none;
  background: var(--paper-2); color: var(--muted); border-color: var(--line); box-shadow: none; }
/* 扫描表头不可排序列的按钮保持正常颜色（disabled 不淡出，与可排序列一致） */
.scan-table thead button:disabled { opacity: 1; color: inherit; background: transparent; border: none; }

  .chart-actions {
    position: absolute;
    top: 6px;
    right: 14px;
    z-index: 2;
  }
  .chart-actions button {
    height: 24px;
    padding: 0 9px;
    border-radius: 6px;
    border: 1px solid var(--line-2);
    background: rgba(255, 255, 255, .88);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 10.5px;
    cursor: pointer;
    backdrop-filter: blur(8px);
  }
  .chart-actions button.active {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 60%, transparent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
  }
  html[data-theme="dark"] .chart-actions button {
    background: rgba(22, 24, 27, .9);
    border-color: var(--line-2);
    color: var(--ink-soft);
  }
  html[data-theme="dark"] .chart-actions button.active {
    color: var(--accent-hi);
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 16%, transparent);
  }

  /* ── 分面铺开视图（跨期 / 跨品种 / 蝶式 共用；逻辑在 static/facet_view.js）──
     tab 按钮由脚本插进 .chart-actions，外观直接复用上面的 button 规则 */
  .chart-actions.has-tabs { display: flex; align-items: center; gap: 4px; }
  .chart-tabs {
    display: flex; gap: 4px;
    margin-left: 4px; padding-left: 8px;
    border-left: 1px solid var(--line-2);   /* 和左边那组系列开关分开 */
  }
  /* 分面视图下系列开关收起，分隔线也就不用留 */
  .chart-panel.view-facet .chart-tabs { margin-left: 0; padding-left: 0; border-left: none; }
  .chart-panel.view-facet .chart-toggle { display: none; }
  .chart-pane { display: none; }
  .chart-pane.active { display: block; }
  .facet-pane { flex-direction: column; }
  .facet-pane.active { display: flex; }
  .facet-hint {
    font-family: var(--mono); font-size: 10.5px; color: var(--muted);
    padding: 0 22px 8px;
  }
  .facet-scroll { flex: 1; display: flex; align-items: center; }
  /* 画布宽高由脚本按容器/全屏状态给 */
  .facet-chart { flex: 0 0 auto; width: 100%; }

  /* 共享帮助弹框（原生 <dialog>）：季节性「规则说明」、矩阵「配色说明」共用。
     用 dialog 而不是自绘浮层，是为了吃到浏览器的 top layer——弹框永远压在
     页面所有局部内容之上，父容器 overflow 也裁不到它。 */
  .help-dialog {
    width: min(640px, calc(100vw - 40px));
    max-height: calc(100vh - 80px);
    margin: auto; padding: 0;
    color: var(--ink); background: var(--paper);
    border: 1px solid var(--line-2); border-radius: 12px;
    box-shadow: 0 24px 60px -20px rgba(20, 30, 70, 0.35);
  }
  .help-dialog::backdrop { background: rgba(12, 18, 32, 0.42); }
  .help-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; border-bottom: 1px solid var(--line-2);
  }
  .help-head b { font-size: 14px; }
  .help-close {
    padding: 2px 7px; font-size: 13px; line-height: 1.5;
    color: var(--ink-soft); background: transparent;
    border: 0; border-radius: 6px; cursor: pointer;
  }
  .help-close:hover { background: var(--line); }
  .help-body {
    margin: 0; padding: 14px 18px 18px; overflow: auto;
    max-height: calc(100vh - 140px);
  }
  .help-body dt { margin-top: 13px; font-size: 12.5px; font-weight: 700; color: var(--ink); }
  .help-body dt:first-child { margin-top: 0; }
  .help-body dd { margin: 4px 0 0; font-size: 12.5px; line-height: 1.8; color: var(--ink-soft); }
  .help-body dd b { color: var(--ink); font-weight: 700; }

  /* 打开帮助弹框的文字链接（与季节性页的 .hint-link 同一视觉语言） */
  .help-link {
    margin-left: 2px; padding: 0;
    font: inherit; font-size: 12px; line-height: inherit;
    color: var(--accent); background: none; border: 0;
    cursor: pointer;
    text-decoration: underline dotted;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  }
  .help-link:hover {
    text-decoration-style: solid;
    text-decoration-color: var(--accent);
  }

  /* 表头「?」悬浮说明（共享组件，各扫描页复用；hover 走浮动提示） */
  .help-tip {
    appearance: none;
    -webkit-appearance: none;
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    padding: 0;
    margin: 0 0 0 2px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(180deg, #d9d9dc, #c6c7cb);
    color: rgba(255, 255, 255, .96);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    line-height: 16px;
    cursor: help;
    user-select: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .34), 0 1px 2px rgba(18, 24, 38, .08);
    flex: none;
    z-index: 5;
    pointer-events: auto;
    transform: none;
    vertical-align: middle;
  }
  .help-tip:hover,
  .help-tip:focus-visible {
    background: linear-gradient(180deg, #cfd1d6, #babcc2);
    color: #ffffff;
    outline: none;
    transform: none;
  }
  .floating-help-tip {
    position: fixed;
    box-sizing: border-box;
    width: min(585px, calc(100vw - 24px));
    max-height: min(431px, calc(100vh - 24px));
    overflow: auto;
    padding: 18px 19px 19px;
    border-radius: 14px;
    background: rgba(7, 10, 24, .985);
    border: 1px solid rgba(117, 137, 190, .18);
    color: #f7f8fc;
    font-family: var(--sans);
    font-size: 12px;
    line-height: 1.55;
    letter-spacing: 0;
    text-transform: none;
    white-space: normal;
    box-shadow: 0 32px 80px -32px rgba(3, 6, 20, .88);
    opacity: 0;
    pointer-events: none;
    z-index: 2147483647;
    transition: opacity .12s ease;
  }
  .floating-help-tip-title {
    margin: 0 0 14px;
    color: #f9fbff;
    font-size: 22px;
    line-height: 1.28;
    font-weight: 700;
    letter-spacing: -0.02em;
  }
  .floating-help-tip-section + .floating-help-tip-section { margin-top: 19px; }
  .floating-help-tip-heading {
    margin: 0 0 7px;
    font-size: 14px;
    line-height: 1.3;
    font-weight: 800;
  }
  .floating-help-tip-heading.is-blue { color: #3281ff; }
  .floating-help-tip-heading.is-orange { color: #ffad24; }
  .floating-help-tip-heading.is-purple { color: #b44bff; }
  .floating-help-tip-heading.is-green { color: #2fda83; }
  .floating-help-tip-paragraph {
    margin: 0;
    color: rgba(245, 248, 255, .98);
    font-size: 12px;
    line-height: 1.55;
    font-weight: 600;
  }
  .floating-help-tip-list {
    margin: 0;
    padding: 0;
    list-style: none;
  }
  /* 紧凑小卡片：整卡 hover 的附注，宽度随内容、一行一项 */
  .floating-help-tip.is-compact {
    width: auto;
    max-width: min(200px, calc(100vw - 24px));
    padding: 7px 9px;
    border-radius: 8px;
  }
  .floating-help-tip-rows {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .floating-help-tip-row {
    color: rgba(245, 248, 255, .98);
    font-size: 15.6px;
    line-height: 1.5;
    font-weight: 600;
    white-space: nowrap;
  }
  .floating-help-tip-list li {
    position: relative;
    padding-left: 17px;
    color: rgba(245, 248, 255, .98);
    font-size: 12px;
    line-height: 1.55;
    font-weight: 600;
  }
  .floating-help-tip-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    top: 0;
    color: #ffffff;
    font-size: 14px;
    line-height: 1.55;
  }
  .floating-help-tip::-webkit-scrollbar { width: 6px; }
  .floating-help-tip::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .24); border-radius: 3px; }
  .floating-help-tip.show { opacity: 1; }

.toggle {
  font-family: var(--sans); font-size: 12.5px; font-weight: 500; color: var(--ink-soft);
  display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none;
}
.toggle input { accent-color: var(--accent); width: 15px; height: 15px; }
.sep { width: 1px; height: 24px; background: var(--line-2); }
.count {
  margin-left: auto; font-family: var(--mono); font-size: 12px;
  color: var(--muted); letter-spacing: 0.04em;
}
.count b { color: var(--accent); font-weight: 700; }

/* ───────────── status message ───────────── */
.msg {
  min-height: 18px; margin: 14px 2px 6px; font-family: var(--sans);
  font-size: 12.5px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 9px;
}
.msg:not(:empty)::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
  background: var(--accent);
}
.msg.error { color: var(--bull); }
.msg.error::before { background: var(--bull); }
.msg.warn { color: var(--accent-hi); }
.msg.warn::before { animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .25 } }

/* ───────────── page notice（页面级风险提示条）─────────────
   原本只在信号页内联定义（.signals-meta）；三个机会扫描页也要在顶部放同一条
   提示，所以提到这里共用。左侧竖条用 ::before 画，颜色一律走 token。 */
.page-notice {
  /* 正文用主题蓝并加粗：这条提示是要读者看见的，不是背景说明。
     --accent 本身就是主题色，浅/深色各有一套值，无需另写 dark 覆盖块。 */
  font-size: 12px; color: var(--accent); font-weight: 600;
  padding: 10px 14px 10px 40px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: linear-gradient(180deg, var(--paper), var(--paper-2));
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; flex-wrap: wrap;
  position: relative;
  margin-bottom: 14px;
}
.page-notice::before {
  content: ""; position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 16px; border-radius: 2px; background: var(--accent); opacity: .7;
}

/* ───────────── 图片灯箱（情报速递前台/后台共用，脚本见 static/lightbox.js）─────────────
   灯箱底色与控件是**主题无关**的：看图的场景要的就是一块稳定的深色底，
   跟着浅色主题变白反而看不清图。所以这里不引用 --paper/--ink 这些随主题
   翻转的 token，只在组件内部定一套自己的调色板。 */
.lb-overlay {
  --lb-fg: #fff;
  --lb-scrim: rgba(0, 0, 0, .88);
  --lb-control-bg: rgba(255, 255, 255, .12);
  --lb-control-bg-hover: rgba(255, 255, 255, .22);
  --lb-control-line: rgba(255, 255, 255, .30);

  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 28px;
  background: var(--lb-scrim);
  backdrop-filter: blur(3px);
  animation: lb-fade .16s ease;
}
.lb-overlay[hidden] { display: none; }
@keyframes lb-fade { from { opacity: 0 } to { opacity: 1 } }

body.lb-locked { overflow: hidden; }

.lb-image {
  max-width: 100%; max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .85);
  cursor: default;
}

.lb-close, .lb-nav {
  position: absolute;
  display: grid; place-items: center;
  margin: 0; padding: 0;
  border: 1px solid var(--lb-control-line); border-radius: 12px;
  background: var(--lb-control-bg); color: var(--lb-fg);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.lb-close:hover, .lb-nav:hover { background: var(--lb-control-bg-hover); }
.lb-close:focus-visible, .lb-nav:focus-visible {
  outline: 2px solid var(--lb-fg); outline-offset: 2px;
}
.lb-close { top: 16px; right: 16px; width: 42px; height: 42px; font-size: 24px; line-height: 1; }
.lb-nav { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; font-size: 28px; line-height: 1; }
.lb-nav[hidden] { display: none; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }

.lb-count {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  color: var(--lb-fg); opacity: .72;
  font: 12px var(--mono); letter-spacing: .04em;
}

@media (max-width: 700px) {
  .lb-overlay { padding: 12px; }
  .lb-close { top: 10px; right: 10px; width: 38px; height: 38px; font-size: 21px; }
  .lb-nav { width: 40px; height: 40px; font-size: 24px; }
  .lb-prev { left: 8px; }
  .lb-next { right: 8px; }
  .lb-count { bottom: 12px; }
}

/* ───────────── hint / footnote ───────────── */
.hint {
  font-family: var(--sans); font-size: 12.5px; line-height: 1.8;
  color: var(--muted);
}
.hint b { color: var(--ink-soft); font-weight: 600; }

/* ───────────── tags (利多/利空/中性 · 做多/做空) ───────────── */
.tag {
  font-family: var(--sans); font-size: 12.5px; font-weight: 600;
  border-radius: 7px; padding: 3px 10px;
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent;
}
.tag.bull, .tag.long  { color: var(--bull); background: var(--bull-bg); border-color: color-mix(in srgb, var(--bull) 24%, transparent); }
.tag.bear, .tag.short { color: var(--bear); background: var(--bear-bg); border-color: color-mix(in srgb, var(--bear) 24%, transparent); }
.tag.neutral { color: var(--ink-soft); background: var(--paper-3); border-color: var(--line-2); }

/* ───────────── summary cards（指标卡：首页今日数字 / 仓单汇总等） ───────────── */
.summary-grid {
  display: grid; gap: 12px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.sum-card {
  background: var(--paper-2); border: 1px solid var(--line-2);
  border-radius: 10px; padding: 12px 14px;
}
.sum-card .sum-label {
  font-family: var(--sans); font-size: 10.5px; color: var(--muted);
  letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px;
}
.sum-card .sum-value {
  font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--ink);
}
.sum-card .sum-sub { font-family: var(--sans); font-size: 11px; color: var(--muted); margin-top: 2px; }
/* 状态着色一律走 token，不写死主题色 */
.sum-card.is-stale   .sum-value { color: var(--warn); }
.sum-card.is-failed  .sum-value { color: var(--bull); }
.sum-card.is-missing .sum-value,
.sum-card.is-pending .sum-value { color: var(--muted); font-size: 15px; font-weight: 600; }

/* ───────────── 统计横幅（跨期页 / 跨品种页 折线图上方） ───────────── */
.analysis-summary {
  display: none;
  padding: 5px 14px;
  margin-bottom: 6px;
  background: linear-gradient(100deg, #dff7ff 0%, #b9d7ff 42%, #d7c7ff 100%);
}
/* 这里的选择器带 .analysis-summary 前缀：.summary-grid 在下面「指标卡」段
   已经有一套（gap 12px / minmax 180px），不加前缀会互相覆盖。 */
.analysis-summary .summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
}
.analysis-summary .summary-item { min-height: 27px; text-align: center; }
.analysis-summary .summary-item span {
  display: block; font-family: var(--mono); font-size: 10px; font-weight: 700;
  color: rgba(17, 20, 27, .68); letter-spacing: .08em;
}
.analysis-summary .summary-item b {
  display: block; margin-top: 1px; font-family: var(--mono);
  font-size: 15px; color: var(--ink);
}
html[data-theme="dark"] .analysis-summary {
  background: linear-gradient(100deg, rgba(143,166,189,.15) 0%, rgba(30,36,48,.94) 42%, rgba(58,48,80,.9) 100%);
}
html[data-theme="dark"] .analysis-summary .summary-item span { color: rgba(240, 242, 244, .58); }

/* ───────────── 数据新鲜度（首页第一屏） ───────────── */
.fresh-list { display: flex; flex-direction: column; gap: 1px; }
.fresh-row {
  display: grid; grid-template-columns: 1fr auto auto 84px;
  gap: 12px; align-items: center;
  padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--paper-2);
}
.fresh-row .fn { font-family: var(--sans); font-size: 13px; color: var(--ink); font-weight: 600; }
.fresh-row .fd,
.fresh-row .ft { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.fresh-row .fs {
  font-family: var(--sans); font-size: 11.5px; font-weight: 600;
  text-align: right; padding: 2px 8px; border-radius: 6px;
}
.fresh-row .fs.ok      { color: var(--accent); background: var(--accent-bg); }
.fresh-row .fs.stale   { color: var(--warn);   background: var(--warn-bg); }
.fresh-row .fs.failed  { color: var(--bull);   background: var(--bull-bg); }
.fresh-row .fs.missing { color: var(--muted);  background: var(--paper-3); }
.fresh-row.is-bad { border-color: color-mix(in srgb, var(--warn) 34%, transparent); }

/* ───────────── empty state ───────────── */
.empty {
  text-align: center; padding: 56px 20px; color: var(--muted);
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em;
}
.empty .cursor { color: var(--accent); animation: blink 1.1s steps(2) infinite; }

@media (prefers-reduced-motion: reduce) {
  .tape-track, .dispatch { animation: none !important; }
}
@media (max-width: 900px) {
  main { max-width: 100%; }
}
@media (max-width: 720px) {
  .mast { padding: 12px 16px; gap: 14px; }
  .brand h1,
  .brand .brand-heading { font-size: 17px; }
  .source { display: none; }
  main { padding: 18px 14px 60px; }
  .count { margin-left: 0; }
  .cmd { padding: 12px 14px; gap: 10px; }
  input[type=number] { width: 76px; }
  select { min-width: 100px; }
}
@media (max-width: 480px) {
  .brand .company { font-size: 10px; letter-spacing: 0.12em; }
  .brand .kicker { display: none; }
  nav { gap: 14px; }
  nav a { font-size: 13px; }
  .cmd { padding: 10px 12px; }
  .panel { padding: 14px 14px; border-radius: 12px; }
}
