:root, [data-theme="dark"] {
  --bg: #0f1216; --panel: #171b21; --line: #262c35; --text: #d8dee6; --muted: #7d8794;
  --ok: #2fb67c; --warn: #e3a72f; --bad: #e5534b; --green: #2fb67c; --red: #e5534b; --accent: #4c9aff;
  --header: #12161b; --hover: #1c222a; --detail: #13171c; --chip: #222932; --chip-on: #2c3440; --purple: #b58cff;
  --err-bg: #2a1716; --err-line: #4a2522; --grid: #262c35; --grid2: #1e242c; --svgbg: #13171c;
  color-scheme: dark;
}
[data-theme="light"] {
  --bg: #f4f6f9; --panel: #ffffff; --line: #e1e5eb; --text: #1f2933; --muted: #6b7684;
  --ok: #16a34a; --warn: #b7791f; --bad: #d92d20; --green: #16a34a; --red: #d92d20; --accent: #2563eb;
  --header: #ffffff; --hover: #f1f4f8; --detail: #f8fafc; --chip: #eef1f5; --chip-on: #dde3ea; --purple: #7c3aed;
  --err-bg: #fdecea; --err-line: #f5c2bd; --grid: #e1e5eb; --grid2: #eef1f5; --svgbg: #f8fafc;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  [data-theme="auto"] {
    --bg: #f4f6f9; --panel: #ffffff; --line: #e1e5eb; --text: #1f2933; --muted: #6b7684;
    --ok: #16a34a; --warn: #b7791f; --bad: #d92d20; --green: #16a34a; --red: #d92d20; --accent: #2563eb;
    --header: #ffffff; --hover: #f1f4f8; --detail: #f8fafc; --chip: #eef1f5; --chip-on: #dde3ea; --purple: #7c3aed;
    --err-bg: #fdecea; --err-line: #f5c2bd; --grid: #e1e5eb; --grid2: #eef1f5; --svgbg: #f8fafc;
    color-scheme: light;
  }
}
/* 涨跌颜色：默认红涨绿跌（用户习惯），设置里可切绿涨红跌；只影响涨跌，不影响"正常 / 异常"状态色 */
:root { --up: var(--red); --down: var(--green); }
[data-updown="green"] { --up: var(--green); --down: var(--red); }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 13px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
a { color: var(--accent); text-decoration: none; cursor: pointer; }
.muted { color: var(--muted); }
header { position: -webkit-sticky; position: sticky; top: 0; z-index: 100; isolation: isolate; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 10px 18px; padding-top: max(10px, env(safe-area-inset-top)); padding-left: max(18px, env(safe-area-inset-left)); padding-right: max(18px, env(safe-area-inset-right)); background: var(--header); background-color: var(--header, #12161b); border-bottom: 1px solid var(--line);
  -webkit-transform: translateZ(0); transform: translateZ(0); }
.brand { font-weight: 700; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.brand .logo { width: 26px; height: 26px; border-radius: 6px; box-shadow: 0 0 0 1px var(--line); }
.icon-btn { font-size: 16px; line-height: 1; width: 32px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.logout-btn { width: 100%; margin-top: 16px; padding: 9px; font-size: 14px; color: var(--bad); border-color: var(--line); }
/* 一级导航：标签页样式，选中项和下面内容区同底色、向下接上内容区（盖住顶栏底边线），融为一体 */
header { align-items: flex-end; padding-bottom: 0 !important; }
.brand, .tools { padding-bottom: 10px; align-self: center; }
nav#tabs { display: flex; gap: 2px; flex-wrap: wrap; align-self: flex-end; margin-bottom: -1px; }
nav#tabs a { color: var(--muted); font-size: 15px; font-weight: 600; padding: 9px 14px 10px; border: 1px solid transparent; border-bottom: 0;
  border-radius: 8px 8px 0 0; }
nav#tabs a:hover { color: var(--text); }
nav#tabs a.on { color: var(--text); background: var(--bg); border-color: var(--line); }
.tools { margin-left: auto; display: flex; gap: 12px; align-items: center; }
button { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 10px; cursor: pointer; }
main { padding: 16px 18px; max-width: 1800px; margin: 0 auto; position: relative; z-index: 0; isolation: isolate; }
footer { padding: 14px 18px max(28px, env(safe-area-inset-bottom)); text-align: center; font-size: 12px; }
h2 { font-size: 14px; margin: 22px 0 8px; display: flex; gap: 10px; align-items: baseline; }
h2 small { font-weight: normal; color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.card h3 { margin: 0 0 6px; font-size: 13px; display: flex; justify-content: space-between; gap: 8px; }
.big { font-size: 22px; font-weight: 700; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; }
.kv span:nth-child(odd) { color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); }
.up { color: var(--up); } .down { color: var(--down); } .ok-t { color: var(--ok); } .warn-t { color: var(--warn); } .bad-t { color: var(--bad); }
.tbl-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; white-space: nowrap; }
th, td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: normal; position: sticky; top: 0; background: var(--panel); }
th:first-child, td:first-child, td.l, th.l { text-align: left; }
th.sortable, th .sortable { cursor: pointer; user-select: none; } th.sortable:hover, th .sortable:hover { color: var(--text); } th.sortable.on, th .sortable.on { color: var(--accent); font-weight: 600; }
.sortbar { display: none; }
th .sortable .arrow, th.sortable .arrow { display: inline-flex; flex-direction: column; vertical-align: middle; margin-left: 3px; line-height: 0.62; font-size: 8px; }
th .sortable .arrow i, th.sortable .arrow i { font-style: normal; color: var(--muted); opacity: .45; } th.sortable .arrow i.hl, th .sortable .arrow i.hl { color: var(--accent); opacity: 1; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--hover); }
tr.detail td { background: var(--detail); white-space: normal; text-align: left; }
.chain { display: flex; flex-direction: column; gap: 0; }
.link { display: grid; grid-template-columns: 22px minmax(220px, 1.4fr) 90px 1.6fr; gap: 10px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--line); }
.link:last-child { border-bottom: 0; }
.link .arrow { color: var(--muted); text-align: center; }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--chip); color: var(--muted); font-size: 12px; margin-right: 4px; }
.tag.cat-volume { color: var(--accent); } .tag.cat-risk { color: var(--bad); } .tag.cat-background { color: var(--muted); }
.tag.cat-bottom { color: var(--purple); } .tag.cat-breakout { color: var(--ok); } .tag.cat-pullback { color: var(--warn); }
.bar { height: 6px; background: var(--chip); border-radius: 3px; overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.warn { background: var(--warn); } .bar i.bad { background: var(--bad); }
.regime { display: flex; gap: 14px; align-items: center; }
.regime .lv { font-size: 30px; font-weight: 800; min-width: 54px; text-align: center; }
.err-box { color: var(--bad); background: var(--err-bg); border: 1px solid var(--err-line); padding: 8px 12px; border-radius: 6px; }
.split { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); }
.login-body { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.login-wrap { display: flex; justify-content: center; align-items: center; min-height: calc(100vh - 80px); padding: 20px 0; }
body.login-mode header, body.login-mode footer { display: none; }
#loginApiBox input { width: 100%; }
#loginTitle { text-align: center; font-size: 26px; letter-spacing: 1px; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; cursor: default; }
.login details { font-size: 12px; } .login details input { width: 100%; margin-top: 6px; }
.login { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 28px; width: 320px; display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0; font-size: 20px; }
.login input { padding: 9px 10px; border-radius: 6px; border: 1px solid var(--line); background: var(--bg); color: var(--text); font-size: 14px; }
.login button { padding: 9px; font-size: 14px; background: var(--accent); border: 0; color: #fff; }
.theme { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; font-size: 12px; }
.err { color: var(--bad); margin: 0; }
/* 手机：table() 生成的列表从横向表格变成纵向卡片（每行一张卡，每个字段一行：左字段名、右数值） */
@media (max-width: 700px) {
  .tbl-wrap:has(table.cards) { overflow: visible; background: transparent; border: 0; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards thead { display: none; }
  .sortbar { display: block; margin: 0 0 8px; color: var(--muted); }
  .sortbar select { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 14px; }
  table.cards tr { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; margin-bottom: var(--gap); }
  table.cards tr.click:hover td { background: transparent; }
  table.cards td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 4px 0;
    border: 0; white-space: normal; text-align: right; word-break: break-word; }
  table.cards td::before { content: attr(data-l); color: var(--muted); font-size: 13px; text-align: left; flex: 0 0 auto; max-width: 42%; }
  table.cards td:first-child { display: block; text-align: left; font-size: 16px; padding: 2px 0 6px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  table.cards td:first-child::before { display: none; }
  table.cards td > div { text-align: right; min-width: 0 !important; }
  table.cards tr.detail td > div, table.cards tr.detail td { text-align: left; }
  table.cards tr.detail { margin-top: calc(-1px - var(--gap)); border-top: 0; border-radius: 0 0 8px 8px; background: var(--detail); }
  table.cards tr.detail td { display: block; text-align: left; }
  table.cards tr.detail td::before { display: none; }
}
@media (max-width: 700px) {
  body { font-size: 15px; line-height: 1.55; -webkit-text-size-adjust: 100%; }
  /* 手机：避开刘海 / 灵动岛 / 圆角（PWA 全屏时内容会延伸到状态栏下面），不能用 padding 简写覆盖掉安全区 */
  header { gap: 8px; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 8px max(12px, env(safe-area-inset-left)); }
  .brand { font-size: 17px; }
  .theme { max-width: 96px; }
  nav#tabs { order: 3; width: 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  nav#tabs a { padding: 9px 12px 10px; font-size: 16px; white-space: nowrap; }
  .subtabs a { padding: 8px 12px; font-size: 15px; white-space: nowrap; }
  .brand, .tools { padding-bottom: 4px; }

  .tools { gap: 10px; }
  .tools #updated, .hide-m { display: none; }
  .tools { margin-left: auto; }
  main { padding: 10px max(3px, env(safe-area-inset-right)) 12px max(3px, env(safe-area-inset-left)); }   /* 左右只留 3px，能看到卡片 / 表格边框即可（用户 10-13） */
  h2 { font-size: 16px; flex-wrap: wrap; } h2 small { font-size: 13px; }
  .card { padding: 12px; } .card h3 { font-size: 15px; flex-wrap: wrap; }
  .big { font-size: 26px; }
  th, td { padding: 8px 10px; font-size: 14px; }
  .tag { font-size: 13px; padding: 2px 7px; margin: 2px 4px 2px 0; }
  .link { grid-template-columns: 22px 1fr; padding: 10px 12px; }
  .link .owner, .link .detail { grid-column: 2; }
  .split { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 0; } .kv span:nth-child(odd) { margin-top: 6px; font-size: 13px; }
  footer { font-size: 13px; }
  button, .theme { font-size: 14px; padding: 5px 9px; }
  code { font-size: 13px; } pre.json { font-size: 13px; }
}

.subtabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.subtabs a { color: var(--muted); padding: 4px 12px; border-radius: 6px; font-size: 14px; font-weight: 600; }
.subtabs a.on { color: var(--text); background: var(--panel); }
a.tag { cursor: pointer; } a.tag.on { color: var(--text); background: var(--chip-on); }
.md { line-height: 1.7; } .md p { margin: 6px 0; } .md ul { margin: 6px 0; padding-left: 22px; }
.md blockquote { margin: 6px 0; padding: 4px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.md .md-h { margin: 18px 0 8px; } .md h2.md-h { font-size: 18px; } .md h3.md-h { font-size: 15px; }
.md .md-tbl { margin: 8px 0; } .md td { vertical-align: top; }
code { background: var(--chip); padding: 0 4px; border-radius: 3px; font-size: 12px; }
pre.json { margin: 0; max-height: 520px; overflow: auto; font-size: 12px; line-height: 1.45; }

/* 设置面板 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding: 60px 14px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; width: 420px; max-width: 100%; max-height: calc(100vh - 120px);
  overflow: hidden; display: flex; flex-direction: column; }   /* 外层负责圆角并裁掉溢出，滚动交给里层，滚动条就不会压住圆角 */
.modal-body { padding: 18px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.modal-body::-webkit-scrollbar { width: 6px; } .modal-body::-webkit-scrollbar-track { background: transparent; margin: 10px 0; }
.modal-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.modal h3 { margin: 0 0 4px; font-size: 16px; display: flex; justify-content: space-between; }
.modal h4 { margin: 16px 0 8px; font-size: 14px; color: var(--muted); font-weight: normal; }
.opt { border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; cursor: pointer; }
.opt.on { border-color: var(--text); }
.opt .ttl { font-weight: 600; margin-bottom: 6px; }
.opt .row { display: flex; align-items: center; justify-content: space-between; margin: 5px 0; color: var(--muted); }
.opt .ph { flex: 1; height: 14px; background: var(--chip); border-radius: 4px; margin: 0 12px; }
.opt .chg { color: #fff; border-radius: 5px; padding: 3px 10px; min-width: 78px; text-align: center; font-weight: 600; }
.seg { display: flex; gap: 6px; } .seg a { flex: 1; text-align: center; padding: 8px; border: 1.5px solid var(--line); border-radius: 8px; color: var(--text); }
.seg a.on { border-color: var(--text); }

/* 手机：二级导航单行横滑（放在最后，避免被上面的通用 .subtabs 规则覆盖） */
@media (max-width: 700px) {
  .subtabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .subtabs::-webkit-scrollbar, nav#tabs::-webkit-scrollbar { display: none; }
}

/* analyst 周期涨幅：选中的那一列高亮；指标标签按方向上色（涨色 = 利多，跌色 = 利空，跟随设置里的红涨 / 绿涨） */
.bar-cell, .bar-h { cursor: pointer; } .bar-cell.sel, .bar-h.sel { background: var(--chip); }
.ev { display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 12px; margin: 2px 2px 2px 0; border: 1px solid; }
.ev-up { color: var(--up); border-color: var(--up); } .ev-down { color: var(--down); border-color: var(--down); }
.ev-mid { color: var(--muted); border-color: var(--line); }

/* 横向数据表（不分手机电脑） */
/* 第一列：10-13 先改成不锁定、不加边框，当晚用户又要锁定（滑到右边要知道是哪个合约），只锁定、仍不加边框 */
table.wide td:first-child, table.wide th:first-child { position: -webkit-sticky; position: sticky; left: 0; z-index: 2; background: var(--panel); }
table.wide th:first-child { z-index: 3; }
table.wide td:first-child, table.wide th:first-child { padding-right: 0 !important; }   /* 第一列不要右内边距（用户 10-13） */
table.wide td:first-child > .coin2 { margin-right: -3px; }   /* 用户要 padding-right -3px：内边距不能为负，用内容负外边距让第一列再窄 3px，效果相同 */
table.wide td, table.wide th { white-space: nowrap; }
.chg-badge { display: inline-block; min-width: 72px; text-align: center; padding: 3px 8px; border-radius: 5px; color: #fff; font-weight: 600; background: var(--muted); }
.chg-badge.bg-up { background: var(--up); } .chg-badge.bg-down { background: var(--down); }

/* 电脑上的横向数据表放大一点（用户 10-13）：字号 14px、行更高 */
@media (min-width: 701px) {
  table.wide { font-size: 14px; }
  table.wide th, table.wide td { padding: 9px 14px; }
  table.wide td:first-child b { font-size: 15px; }
  .chg-badge { font-size: 14px; min-width: 80px; padding: 4px 10px; }
  .dl-form { font-size: 14px; } .dl-form .tag { font-size: 13px; padding: 2px 9px; }
}

.dl-fields summary { cursor: pointer; font-weight: normal; }
.dl-field-list { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 13px; }
.dl-field-list label { white-space: nowrap; cursor: pointer; }

.alert-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); margin-left: 4px; vertical-align: 2px; }

/* 数据列表的分界线：涨跌幅 | K 线；主表字段 | 指标字段（分隔列写当前窗口） */
table.wide th.div-left, table.wide td.div-left { border-left: 1px solid var(--line); }
table.wide th.sep-col, table.wide td.sep-col { background: var(--chip); border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  padding: 4px 10px; min-width: 76px; text-align: center; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* 开高低收合成一列：两行两组（开 高 / 低 收） */
.ohlc { display: grid; grid-template-columns: auto auto auto auto; gap: 1px 8px; justify-content: start; font-size: 13px; line-height: 1.35; }
td.ohlc-col, th.ohlc-col { text-align: left; }   /* 价格列左对齐（用户 10-14） */
.ohlc .muted { font-size: 11px; align-self: center; }

/* 数据列表：筛选卡、标题行、表格之间统一 8px 间距（用户 10-13：间隙不统一、太大） */
.dl-stack { display: flex; flex-direction: column; gap: 8px; }
.dl-stack > * { margin: 0; }
.dl-form > summary { cursor: pointer; font-weight: normal; }
/* 摘要和"筛选"同字号、加粗，用颜色区分层级：比正文颜色淡一档（用户 10-13） */
.dl-sum { font-size: 12px; font-weight: normal; color: var(--muted); margin-left: 4px; }   /* 和字段勾选的提示同样式（用户 10-13） */
.dl-form[open] > summary { margin-bottom: 6px; }
.dl-form .dl-fields { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.dl-head { font-size: 14px; line-height: 1.5; padding: 0 2px; } .dl-head .warn-t { font-weight: 600; margin-left: 6px; }
@media (max-width: 700px) { .dl-head, .dl-form > summary { font-size: 16px; } }

/* 筛选选项区字号加大（用户 10-13） */
.dl-result { display: flex; flex-direction: column; gap: 8px; }
.dl-loading { text-align: center; padding: 28px 12px; }
@media (max-width: 700px) { .dl-sum { font-size: 13px; } }
/* 筛选选项（用户 10-13：换行后要对齐）：左边标签固定宽，选项在右边一栏里换行；周期 / K 线 / 窗口用等宽格子，换行后上下对齐 */
.dl-row { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0; }
.dl-lab { flex: 0 0 40px; color: var(--muted); font-size: 14px; line-height: 32px; }
.dl-opts { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; }
.dl-opts.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); }
.dl-opts .tag { margin: 0; font-size: 15px; padding: 0 10px; line-height: 32px; text-align: center; white-space: nowrap; }
@media (min-width: 701px) { .dl-opts.grid { grid-template-columns: repeat(auto-fill, 60px); } }
@media (max-width: 700px) { .dl-opts.types { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); } .dl-lab { flex-basis: 42px; font-size: 15px; line-height: 36px; } .dl-opts .tag { font-size: 16px; line-height: 36px; padding: 0 8px; } }
.dl-opts .tag.dl-collapse { color: var(--accent); background: transparent; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; gap: 4px; padding: 0 6px; }
.dl-collapse .tri { font-size: .85em; line-height: 1; }   /* 收起：空心三角、文字和三角整体居中（用户 10-14） */
/* filter 排行：a / b 两套切换，做多 / 做空两栏并排（手机上下排）（filter 10-13） */
.f-set { margin-bottom: 10px; max-width: 360px; }
.f-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.f-two > div { min-width: 0; }
@media (max-width: 1100px) { .f-two { grid-template-columns: 1fr; } }
.tag.cat-short { color: var(--down); } .tag.cat-watch { color: var(--warn); }
/* 币图标（10-13）：一行时在名字前，两行时在左边跨两行 */
.coin { display: inline-block; width: 18px; height: 18px; border-radius: 50%; vertical-align: -4px; margin-right: 6px; object-fit: cover; background: var(--chip); }
.coin-l { font-size: 11px; line-height: 18px; text-align: center; color: var(--muted); font-weight: 600; }
.coin2 { display: flex; align-items: center; gap: 8px; } .coin2 .coin { width: 28px; height: 28px; margin: 0; flex: 0 0 28px; }
.coin2 .coin-l { line-height: 28px; font-size: 14px; }
/* 收盘后 2 分钟的提示：放在筛选区窗口那行下面，字号不超过左边标签，不加粗（用户 10-13） */
.dl-stale { font-size: 13px; font-weight: normal; margin: 4px 0 2px; }
@media (max-width: 700px) { .dl-stale { font-size: 14px; } }
/* 名次（第一格左上角，不占布局）和返回顶部按钮（用户 10-13） */
td.rk-cell { position: relative; }
.rk { position: absolute; left: 3px; top: 2px; font-size: 10px; line-height: 1; color: var(--muted); opacity: .8; pointer-events: none; }
#totop { position: fixed; right: max(14px, env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 50;
  width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; transition: opacity .2s; cursor: pointer; }
#totop.show { opacity: .92; pointer-events: auto; }
.dl-iv { color: var(--text); font-weight: 700; font-size: 14px; }   /* 标题行里的周期加重，表头不再写周期（用户 10-13） */
@media (max-width: 700px) { .dl-iv { font-size: 15px; } }
.dl-note { font-size: 13px; color: var(--muted); margin: 4px 0 2px; line-height: 1.6; }   /* 指标英文名的中文注解（10-14） */
@media (max-width: 700px) { .dl-note { font-size: 14px; } }
/* 筛选 / 字段：空心三角代替默认的实心三角，不加粗（用户 10-14） */
.dl-form > summary, .dl-fields > summary { list-style: none; }
.dl-form > summary::-webkit-details-marker, .dl-fields > summary::-webkit-details-marker { display: none; }
.dl-form > summary::before, .dl-fields > summary::before { content: '▷'; display: inline-block; width: 1.1em; color: var(--muted); font-size: .9em; }
.dl-form[open] > summary::before, .dl-fields[open] > summary::before { content: '▽'; }
.dl-ud .up, .dl-ud .down { font-weight: 700; } .dl-ud .down { margin-left: 4px; }
/* 手机导航字号（用户 10-14：不能比"筛选"16px 小）。放在文件末尾：原来 .subtabs a 的手机 15px 被后面的通用 14px 覆盖了，实际只有 14px */
@media (max-width: 700px) { nav#tabs a { font-size: 17px; } .subtabs a { font-size: 16px; } }
/* 数据列表：配置说明（10-14） */
.dl-cfg .cfg-rule { font-size: 13px; line-height: 1.6; margin-top: 6px; } .dl-cfg .cfg-rule ul { margin: 4px 0; padding-left: 18px; } .dl-cfg .cfg-rule p { margin: 4px 0; }
.cfg-tbl { font-size: 12px; white-space: normal; } .cfg-tbl td, .cfg-tbl th { padding: 5px 8px; vertical-align: top; } .cfg-tbl td.cfg-note { min-width: 260px; color: var(--muted); }
.cfg-tbl tr.cfg-on td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.cfg-fd { font-size: 12px; margin-top: 8px; line-height: 1.6; } .cfg-fd code { margin-right: 4px; }
@media (max-width: 700px) { .dl-cfg .cfg-rule { font-size: 14px; } }
.tag.use-on { position: relative; } .tag.use-on::after { content: ''; position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); }   /* 线上在用（analyst cfg usage，10-15） */
.use-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); vertical-align: 1px; }
/* Redis 板块（10-15） */
.rmean { font-size: 12px; white-space: normal; max-width: 460px; } .rsec { margin: 8px 0 4px; font-size: 13px; }
.rkv { grid-template-columns: 90px 1fr; white-space: normal; } .rkv code { word-break: break-all; }
.handoff { font-size: 12px; margin-top: 2px; } .handoff .dot { width: 7px; height: 7px; margin-right: 4px; }   /* 链路里的交接检查（原链路体检，10-15） */
/* 手机端一级导航放到底部（用户 10-15）：图标 + 文字，固定在屏幕底，避开 iPhone 底部横条；电脑端不变 */
nav#tabs .ti { display: none; }
@media (max-width: 700px) {
  nav#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 150; order: 0; width: auto; margin: 0; display: flex; flex-wrap: nowrap; overflow: visible;
    background: var(--header); border-top: 1px solid var(--line); padding: 4px max(6px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
  nav#tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 5px 0 3px; font-size: 12px; font-weight: 600;
    border: 0; border-radius: 8px; background: transparent !important; color: var(--muted); }
  nav#tabs a.on { color: var(--accent); }
  nav#tabs .ti .f { fill: currentColor; fill-opacity: 0; transition: fill-opacity .15s; }
  nav#tabs a.on .ti .f { fill-opacity: .22; }   /* 选中的图标填色，其他的是线框（常见 app 做法） */
  nav#tabs .ti { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  main { padding-bottom: calc(72px + env(safe-area-inset-bottom)) !important; }
  footer { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  #totop { bottom: calc(76px + env(safe-area-inset-bottom)); }
  header { align-items: center; padding-bottom: 8px !important; }
}
@media (max-width: 700px) { header > nav#tabs { visibility: hidden; } }   /* 脚本把导航挪到底部前先藏着，免得开头闪一下盖住顶栏 */
/* 顶栏按钮、返回顶部用矢量图标（10-15）；刷新中图标转圈 */
.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; display: block; }
#totop .ic { width: 20px; height: 20px; margin: auto; }
#refresh:disabled .ic { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* 鼠标停留有解释（title）的地方显示手型，提示这里能看说明（用户 10-15） */
#view [title], header [title], .dl-form [title] { cursor: pointer; }
.dl-form-lite .dl-fields { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; } .dl-form-lite .dl-row:first-child { margin-top: 0; }   /* 换手率 / 市场微观子页的选项区（10-15） */
/* 市场 → 排行（10-16） */
.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-bottom: 8px; }
.bd-card h3 { font-size: 15px; margin: 0 0 2px; align-items: baseline; } .bd-note { font-size: 12px; margin-bottom: 6px; min-height: 16px; }
table.bd { width: 100%; border-collapse: collapse; } table.bd td { padding: 4px 4px; border-top: 1px solid var(--line); text-align: right; white-space: nowrap; }
table.bd td.l { text-align: left; width: 100%; } table.bd .bd-rk { width: 18px; text-align: left; } table.bd .bd-sub { font-size: 12px; }
.bd-more { font-size: 12px; font-weight: normal; color: var(--muted); white-space: nowrap; } .bd-more:hover { color: var(--accent); } .bd-back { display: inline-block; margin: 0 0 10px; font-size: 15px; padding: 4px 0; }   /* 排行的「更多」和子页返回（10-16） */
/* 市场 → 单币（10-16） */
.coin-link { cursor: pointer; } .coin-link:hover b, b.coin-link:hover { text-decoration: underline; }
.coin-search { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; } .coin-search input { font-size: 16px; padding: 6px 10px; width: 220px; }
.kchart, .lchart { display: block; margin-top: 6px; } .coin-mx td, .coin-mx th { text-align: right; } .coin-mx td.l, .coin-mx th.l { text-align: left; }
/* 单币页左下角「返回」（10-16，样式同回到顶部，放左边） */
#coinback { position: fixed; left: max(14px, env(safe-area-inset-left)); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 50;
  width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: 0 2px 8px rgba(0,0,0,.25); opacity: .92; cursor: pointer; }
#coinback .ic { width: 22px; height: 22px; }
@media (max-width: 700px) { #coinback { bottom: calc(76px + env(safe-area-inset-bottom)); } }
/* 全站块间隙统一（用户 10-16：块之间的间隙保持一致，用手机卡片列表间隙 8px 的三分之一）：卡片、表格、网格、筛选区之间都是 --gap */
:root { --gap: 3px; }
.grid, .split, .bd-grid, .dl-stack, .dl-result { gap: var(--gap); }
:is(#view, #view :not(.grid, .split, .bd-grid)) > :is(.card, .tbl-wrap, .grid, .split, .bd-grid, details.card) + :is(.card, .tbl-wrap, .grid, .split, .bd-grid, details.card) { margin-top: var(--gap); }   /* 网格里的块已经有 gap，不再加 */
.bd-grid { margin-bottom: 0; }
.coin-info { margin-top: 8px; } .coin-info > summary { cursor: pointer; font-size: 13px; }   /* 单币页合约信息默认收起（10-16） */
.kc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; } .kc-head .kc-iv { font-size: 14px; padding: 2px 12px; }
.kc-ivs { margin: 6px 0 4px; } .kc-note { font-size: 11px; margin-top: 2px; }   /* 单币 K 线：周期默认收起（10-16） */
.kc-tip { font-size: 13px; min-height: 18px; margin-top: 4px; font-variant-numeric: tabular-nums; } .kchart { cursor: crosshair; } .kchart g.sel line, .kchart g.sel rect { stroke: var(--text); stroke-width: 1.5; }
[hidden] { display: none !important; }   /* hidden 属性永远优先（10-16：.dl-opts.grid 的 display: grid 盖过了浏览器默认的 hidden，单币页周期没藏住） */
.kc-tools { display: flex; align-items: center; gap: 4px; } .kc-n { font-size: 12px; padding: 2px 6px; border-radius: 6px; color: var(--muted); cursor: pointer; } .kc-n.on { color: var(--text); background: var(--chip-on); }
.kc-fs { display: inline-flex; padding: 4px; margin-left: 2px; cursor: pointer; color: var(--muted); } .kc-fs .ic { width: 20px; height: 20px; }
.kc-full { position: fixed; inset: 0; z-index: 300; background: var(--bg); display: flex; flex-direction: column; padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
.kc-full-bar { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 8px; } .kc-full-bar a { font-size: 22px; padding: 0 8px; cursor: pointer; }
.kc-full-body { flex: 1; overflow: auto; }   /* 单币 K 线：根数切换和全屏（10-16） */
.fav { font-style: normal; color: var(--muted); cursor: pointer; margin-left: 4px; font-size: 13px; } .fav.on { color: var(--warn); }   /* 自选星（10-16） */
.ml-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; } .ml-filter input { font-size: 15px; padding: 5px 8px; width: 140px; }
.ml-fg { display: inline-flex; gap: 4px; } .ml-fn { font-size: 11px; }
.coin-favs { width: 100%; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; font-size: 13px; }
.rflow { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; } .rflow > * { flex: none; }
@media (max-width: 700px) { .rflow { justify-content: flex-end; } table.cards td:first-child > div { text-align: left; } }   /* 手机卡片：模块名换行、说明左对齐（10-16） */
/* iPhone Safari 点进字号小于 16px 的输入框会自动放大页面且不缩回（10-16 用户截图整页被放大、右边被裁）：手机上输入框一律 16px */
@media (max-width: 700px) { input, select, textarea { font-size: 16px !important; } }
.thead-float { position: fixed; z-index: 90; overflow: hidden; display: none; border-radius: 0; border-top: 0; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.thead-float table { margin: 0; } .thead-float thead th { background: var(--panel); }   /* 表头吸顶副本（10-16） */
/* 筛选区字号不大于表头（用户 10-16：表头 14px，筛选标题、选项、标签、搜索框都不超过它） */
.dl-form > summary, .dl-lab, .dl-opts .tag { font-size: 14px; }
@media (max-width: 700px) {
  .dl-form > summary, .dl-lab, .dl-opts .tag, .ml-filter .tag { font-size: 14px; } .dl-note { font-size: 13px; }
  /* 输入框必须 16px（iPhone 小于 16px 会自动放大页面），用缩放显示成 14px */
  .ml-filter input, .coin-search input { transform: scale(.875); transform-origin: left center; margin-right: -18px; }
}
.dl-form-lite > .dl-fields:first-child { border-top: 0; margin-top: 0; padding-top: 0; }   /* 卡片里第一项就是「字段」时（微观页没有周期行）不要上面的分隔线和空白（10-16） */
.dl-fields > summary { font-size: 14px; }   /* 「字段」「配置说明」标题也不大于表头 14px（10-16） */
.ch-cond { font-size: 12px; white-space: normal; min-width: 150px; max-width: 280px; }   /* 时机 → 规则条件可换行，手机上第一列不撑宽（10-17） */
.dl-only { font-size: 14px; padding: 4px 2px; } .dl-only .tag { margin-left: 6px; }   /* 数据列表「只看这组合约」横幅（时机跳过来，10-17） */
.ch-eval { white-space: normal; min-width: 150px; max-width: 220px; font-size: 13px; }   /* 时机 → 规则评价可换行（10-17） */
/* 表格第二行横跨所有列（table opts.sub，10-17 时机规则表：先规则描述、再评价）：和上一行连成一组，左右滑动时文字留在可见处 */
table.wide tr.has-sub td { border-bottom: 0; padding-bottom: 2px; }
table.wide tr.sub-row td { position: static; text-align: left; white-space: normal; padding-top: 0; }
table.wide tr.sub-row td > div { position: -webkit-sticky; position: sticky; left: 12px; max-width: calc(100vw - 80px); }
.ch-cond { font-size: 12px; min-width: 0; max-width: none; } .ch-eval { font-size: 13px; margin-top: 2px; min-width: 0; max-width: none; }
.ch-basis { flex-wrap: wrap; } .ch-basis .tag { white-space: nowrap; }   /* 时机「历史数字看」选项不在字中间折行（10-17） */
@media (max-width: 700px) { table.wide td.ch-rn { white-space: normal; min-width: 110px; max-width: 150px; } }   /* 手机上规则名列可换行，别把后面的数字挤出屏幕 */
.ch-kv { display: inline-block; margin-right: 12px; font-size: 12px; } .tag.ch-rec { color: var(--accent); }   /* 时机：生效中每条的具体事实、推荐标签（10-17） */
.ml-chance { flex-wrap: wrap; align-items: center; } .ml-chance > .muted { margin-right: 2px; }   /* 行情筛选「机会」：chance 当前生效的规则（10-17） */
.nt-card > summary { cursor: pointer; } .nt-item { margin-top: 10px; } .nt-item .kv { margin-top: 4px; }   /* 链路 → 时效通知（10-17） */
.nt-when { white-space: normal; min-width: 260px; font-size: 12px; }
.ch-reason { color: var(--text); margin-top: 2px; }
/* 时机（10-17 手机样式）：卡片里第一格占整行，其余数字三列小格（字段名在上、数值在下）；第二行（描述 / 评价 / 具体事实）接在同一张卡片下面 */
@media (max-width: 700px) {
  table.cards.ch-grid tr:not(.sub-row) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; }
  table.cards.ch-grid tr:not(.sub-row) td { display: block; text-align: left; padding: 0; font-size: 14px; }
  table.cards.ch-grid tr:not(.sub-row) td::before { display: block; max-width: none; font-size: 11px; margin-bottom: 1px; }
  table.cards.ch-grid tr:not(.sub-row) td:first-child { grid-column: 1 / -1; font-size: 15px; padding: 0 0 6px; margin-bottom: 0; }
  table.cards.ch-grid td > div { text-align: left; }
  table.cards.ch-grid tr.has-sub { border-bottom: 0; border-radius: 8px 8px 0 0; margin-bottom: 0; padding-bottom: 4px; }
  table.cards.ch-grid tr.sub-row { border-top: 0; border-radius: 0 0 8px 8px; padding-top: 0; }
  table.cards.ch-grid tr.sub-row td { display: block; text-align: left; padding: 6px 0 0; border: 0; border-top: 1px dashed var(--line); font-size: 13px; margin: 0; }
  table.cards.ch-grid tr.sub-row td::before { display: none; }
  table.cards.ch-grid tr.sub-row td > div { position: static; max-width: none; }
  table.cards.ch-grid .coin2 { gap: 8px; }
  .ch-kv { margin-right: 10px; }
  table.cards.ch-grid td.ch-rn { max-width: none; }
}
.ch-fold > summary { cursor: pointer; } .ch-fold > summary > b { font-size: 15px; } details.ch-fold:not(.card) { margin-top: 8px; } details.ch-fold:not(.card) > summary { padding: 4px 0; }
.ch-rules .sortbar { display: none !important; }   /* 规则表不要排序下拉框（手机卡片模式会出现） */
@media (max-width: 700px) { table.cards.ch-grid tr:not(.sub-row) td:first-child::before { display: none; } }
.ch-tails { margin-top: 2px; }
