/* ==========================================================================
   fundflow-v8.css — 用户端「资金流向」样式（v9 统一令牌版）
   仅在 .ffv8 作用域内生效，避免影响首页 / 个股 / 板块详情 / 后台。
   v9 变更：局部令牌全部映射到 styles.css 的全局令牌，消除「暖白纸感」双体系；
   组件类名保持不变，仅取值跟随主设计体系。
   ========================================================================== */

.ffv8 {
  /* 局部令牌 → 全局令牌映射（保留旧名以免组件样式失效） */
  --8-paper: transparent;
  --8-card: var(--panel);
  --8-ink: var(--text);
  --8-ink2: var(--text-dim);
  --8-muted: var(--muted);
  --8-faint: var(--faint);
  --8-line: var(--border);
  --8-line2: var(--border-strong);
  --8-red: var(--up);
  --8-red2: var(--up);
  --8-redsoft: var(--up-dim);
  --8-green: var(--down);
  --8-green2: var(--down);
  --8-greenosft: var(--down-dim);
  --8-gold: var(--warn);
  --8-goldsoft: var(--warn-dim);
  --8-blue: var(--blue);
  --8-dark: #171b22;
  --8-dark2: #1f242d;
  --8-r: var(--radius-lg);
  --8-rm: var(--radius);
  --8-rs: var(--radius-sm);
  --8-sh1: var(--shadow-sm);
  --8-sh2: var(--shadow-lg);

  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 页头由 app.js 的 pageHead 提供，这里收紧其在资金流页的间距 */
.ffv8-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------------- 左侧子导航 ---------------- */
.ffv8-rail {
  position: sticky;
  top: 78px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ffv8-rail-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--8-faint);
  font-weight: 700;
  padding: 0 4px 2px;
}
.ffv8-rail-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px;
  background: color-mix(in srgb, var(--panel) 62%, transparent);
  border: 1px solid var(--8-line);
  border-radius: var(--8-r);
}
.ffv8-rail-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 9px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ffv8-rail-item:hover {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
}
.ffv8-rail-item.active {
  background: var(--8-card);
  border-color: var(--8-line);
  box-shadow: var(--8-sh1);
}
.ffv8-rail-ico {
  width: 25px;
  height: 25px;
  border-radius: 7px;
  border: 1px solid var(--8-line);
  background: var(--panel-2);
  display: grid;
  place-items: center;
  color: var(--8-ink2);
  flex: 0 0 auto;
  margin-top: 1px;
}
.ffv8-rail-item.active .ffv8-rail-ico {
  background: var(--8-red);
  border-color: var(--8-red);
  color: #fff;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--up) 25%, transparent);
}
.ffv8-rail-text strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--8-ink);
  line-height: 1.3;
}
.ffv8-rail-text em {
  display: block;
  font-style: normal;
  font-size: 10px;
  color: var(--8-faint);
  margin-top: 2px;
  line-height: 1.4;
}
.ffv8-rail-note {
  border: 1px dashed var(--8-line2);
  border-radius: var(--8-rm);
  padding: 11px 12px;
  background: color-mix(in srgb, var(--panel) 45%, transparent);
}
.ffv8-rail-note h4 {
  margin: 0 0 6px;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--8-ink2);
  display: flex;
  align-items: center;
  gap: 5px;
}
.ffv8-rail-note p {
  margin: 0;
  font-size: 10px;
  line-height: 1.65;
  color: var(--8-faint);
}
.ffv8-rail-note p + p {
  margin-top: 5px;
}

/* ---------------- 通用卡片 ---------------- */
.ffv8-card {
  background: var(--8-card);
  border: 1px solid var(--8-line);
  border-radius: var(--8-r);
  box-shadow: var(--8-sh1);
  min-width: 0;
  overflow: hidden;
}
.ffv8-card.dark {
  background:
    radial-gradient(600px 220px at 88% -30%, color-mix(in srgb, var(--up) 30%, transparent), transparent 62%),
    linear-gradient(158deg, var(--8-dark2), var(--8-dark) 62%);
  border-color: rgba(255, 255, 255, 0.07);
  color: #f2f3f5;
  box-shadow: var(--shadow-lg);
}
.ffv8-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--8-line);
  flex-wrap: wrap;
}
.ffv8-card.dark .ffv8-card-head {
  border-color: rgba(255, 255, 255, 0.08);
}
.ffv8-card-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
  min-width: 0;
}
.ffv8-card-title::before {
  content: "";
  width: 3px;
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--8-red), var(--warn));
  flex: 0 0 auto;
}
.ffv8-card.dark .ffv8-card-title::before {
  background: linear-gradient(180deg, #ff5a45, #f3c14b);
}
.ffv8-card-title small {
  font-weight: 400;
  font-size: 10px;
  color: var(--8-faint);
  margin-left: 2px;
}
.ffv8-card.dark .ffv8-card-title small {
  color: rgba(255, 255, 255, 0.46);
}
.ffv8-card-body {
  padding: 13px 14px;
}
.ffv8-card-body.tight {
  padding: 10px 12px;
}
.ffv8-card-body.flush {
  padding: 0;
}

/* ---------------- 指标卡 ---------------- */
.ffv8-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.ffv8-kpi {
  position: relative;
  background: var(--8-card);
  border: 1px solid var(--8-line);
  border-radius: var(--8-rm);
  padding: 10px 14px 10px 16px;
  overflow: hidden;
  min-width: 0;
  /* 四卡在宽屏下高度一致，避免内容多寡导致参差 */
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 74px;
}
.ffv8-kpi::after {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--8-line2);
}
.ffv8-kpi.is-up::after {
  background: var(--8-red);
}
.ffv8-kpi.is-down::after {
  background: var(--8-green);
}
.ffv8-kpi.is-gold::after {
  background: var(--warn);
}
.ffv8-kpi .k {
  font-size: 10px;
  color: var(--8-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ffv8-kpi .v {
  margin-top: 4px;
  font-size: 20px;
  font-weight: 650;
  line-height: 1.16;
  letter-spacing: -0.01em;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.ffv8-kpi .v small {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 500;
  margin-left: 3px;
  color: var(--8-faint);
}
.ffv8-kpi .s {
  margin-top: 5px;
  font-size: 9.5px;
  color: var(--8-faint);
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------- 分段控件 / chip / 徽标 ---------------- */
.ffv8-seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--panel-3);
  border-radius: 8px;
}
.ffv8-seg button {
  height: 24px;
  padding: 0 9px;
  border: 0;
  background: transparent;
  border-radius: 6px;
  font-size: 11px;
  color: var(--8-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.ffv8-seg button:hover {
  color: var(--8-ink);
}
.ffv8-seg button.on {
  background: var(--8-card);
  color: var(--8-red);
  font-weight: 650;
  box-shadow: var(--shadow-sm);
}

.ffv8-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding: 8px 11px;
  background: color-mix(in srgb, var(--panel) 66%, transparent);
  border: 1px solid var(--8-line);
  border-radius: var(--8-rm);
}
.ffv8-toolbar .spacer {
  flex: 1;
}
.ffv8-toolbar-note {
  font-size: 10px;
  color: var(--8-faint);
}

.ffv8-tag {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}
.ffv8-tag.accent {
  background: var(--8-redsoft);
  color: var(--8-red2);
}
.ffv8-tag.ok {
  background: var(--8-greenosft);
  color: var(--8-green2);
}
.ffv8-tag.warn {
  background: var(--8-goldsoft);
  color: var(--warn);
}
.ffv8-tag.neutral {
  background: var(--panel-3);
  color: var(--8-muted);
}

/* ---------------- 蝶形双极榜 ---------------- */
.ffv8-bf-head,
.ffv8-bf-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 168px 40px 168px minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}
.ffv8-bf-head {
  padding: 7px 10px;
  font-size: 9.5px;
  color: var(--8-faint);
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--8-line);
  background: var(--panel-2);
  position: sticky;
  top: 0;
  z-index: 2;
}
.ffv8-bf-head .l {
  text-align: right;
}
.ffv8-bf-head .r {
  text-align: left;
}
.ffv8-bf-head .c {
  text-align: center;
}
.ffv8-bf-row {
  padding: 5px 10px;
  border-bottom: 1px solid var(--hairline);
}
.ffv8-bf-row:hover {
  background: var(--panel-2);
}
.ffv8-bf-row:last-child {
  border-bottom: 0;
}
.ffv8-bf-side {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.ffv8-bf-side.l {
  justify-content: flex-end;
}
.ffv8-bf-side .bar {
  height: 15px;
  border-radius: 2px;
  min-width: 2px;
  transition: width 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.ffv8-bf-side .bar.pos {
  background: linear-gradient(90deg, color-mix(in srgb, var(--up) 35%, var(--panel)), var(--8-red));
}
.ffv8-bf-side .bar.neg {
  background: linear-gradient(90deg, var(--8-green), color-mix(in srgb, var(--down) 45%, var(--panel)));
}
.ffv8-bf-side .val {
  font-family: var(--font-mono);
  font-size: 10px;
  flex: 0 0 auto;
  min-width: 50px;
}
.ffv8-bf-side.l .val {
  text-align: right;
}
.ffv8-bf-center {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--8-faint);
  font-weight: 600;
}
.ffv8-bf-name {
  border: 0;
  background: none;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 0;
  width: 100%;
  transition: background 0.14s;
}
.ffv8-bf-name:hover {
  background: var(--panel-2);
}
.ffv8-bf-name.on {
  background: var(--8-redsoft);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 24%, transparent);
}
.ffv8-bf-name .t {
  font-size: 11.5px;
  font-weight: 600;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ffv8-bf-name .m {
  font-size: 8.5px;
  color: var(--8-faint);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ---------------- 榜单行（列表视图） ---------------- */
.ffv8-rank-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto 26px;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--hairline);
}
.ffv8-rank-row:hover {
  background: var(--panel-2);
}
.ffv8-rank-row:last-child {
  border-bottom: 0;
}
.ffv8-rank-no {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--8-faint);
  text-align: center;
}
.ffv8-rank-no.top {
  color: var(--8-red);
  font-weight: 700;
}
.ffv8-rank-name {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.ffv8-rank-name .nm {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ffv8-rank-meta {
  font-size: 9.5px;
  color: var(--8-faint);
  font-family: var(--font-mono);
  margin-top: 1px;
}
.ffv8-rank-val {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 650;
  min-width: 74px;
}
.ffv8-rank-add {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--8-line);
  background: var(--8-card);
  color: var(--8-muted);
  display: grid;
  place-items: center;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  justify-self: end;
}
.ffv8-rank-add:hover {
  border-color: var(--8-red);
  color: var(--8-red);
}
.ffv8-rank-add.on {
  background: var(--8-red);
  border-color: var(--8-red);
  color: #fff;
}

/* 行内进度条 */
.ffv8-track {
  height: 4px;
  border-radius: 2px;
  background: var(--panel-3);
  overflow: hidden;
  margin-top: 5px;
}
.ffv8-track > i {
  display: block;
  height: 100%;
  border-radius: 2px;
  background: var(--8-red);
  transition: width 0.4s ease;
}
.ffv8-track > i.neg {
  background: var(--8-green);
}

/* ---------------- 热力日历 ---------------- */
.ffv8-heat {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}
.ffv8-heat-cell {
  border-radius: 5px;
  padding: 6px 0;
  text-align: center;
  font-family: var(--font-mono);
  line-height: 1.2;
}
.ffv8-heat-cell b {
  display: block;
  font-size: 10.5px;
  font-weight: 650;
}
.ffv8-heat-cell span {
  display: block;
  font-size: 7.5px;
  opacity: 0.6;
  margin-top: 1px;
}
.ffv8-heat-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  color: var(--8-faint);
  margin-top: 7px;
  justify-content: flex-end;
}
.ffv8-heat-legend i {
  width: 13px;
  height: 7px;
  border-radius: 2px;
  display: inline-block;
}

/* ---------------- 多空力量 / 结构条 ---------------- */
.ffv8-power {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--panel-3);
}
.ffv8-power .r {
  background: linear-gradient(90deg, color-mix(in srgb, var(--up) 55%, var(--panel)), var(--8-red));
}
.ffv8-power .g {
  background: linear-gradient(90deg, color-mix(in srgb, var(--down) 55%, var(--panel)), var(--8-green));
}
.ffv8-power-legend {
  display: flex;
  justify-content: space-between;
  font-size: 9.5px;
  color: var(--8-muted);
  margin-top: 6px;
}
.ffv8-power-legend b {
  font-family: var(--font-mono);
  font-size: 10.5px;
}
.ffv8-stack {
  display: flex;
  height: 9px;
  border-radius: 3px;
  overflow: hidden;
}
.ffv8-stack i {
  display: block;
  height: 100%;
}
.ffv8-stack-lg {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.ffv8-stack-lg span {
  font-size: 9.5px;
  color: var(--8-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ffv8-stack-lg b {
  font-family: var(--font-mono);
  color: var(--8-ink2);
}

/* ---------------- 洞察卡 / 说明 ---------------- */
.ffv8-insight {
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--8-rm);
  padding: 11px 12px;
}
.ffv8-insight h5 {
  margin: 0 0 7px;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  color: var(--warn);
  display: flex;
  align-items: center;
  gap: 5px;
}
.ffv8-insight ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ffv8-insight li {
  font-size: 10.5px;
  line-height: 1.6;
  color: var(--8-ink2);
  padding-left: 11px;
  position: relative;
}
.ffv8-insight li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 6px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--warn);
}
.ffv8-note {
  display: flex;
  gap: 7px;
  font-size: 10px;
  line-height: 1.65;
  color: var(--8-faint);
  padding: 9px 11px;
  border-radius: var(--8-rs);
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.ffv8-note b {
  color: var(--8-muted);
  font-weight: 600;
}

/* ---------------- 布局工具 ---------------- */
.ffv8-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ffv8-grid-2.is-single {
  grid-template-columns: minmax(0, 1fr);
}
.ffv8-grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: 12px;
  align-items: start;
}
.ffv8-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.ffv8-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--8-ink2);
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.ffv8-subhead em {
  font-style: normal;
  color: var(--8-faint);
  font-size: 9.5px;
}
.ffv8-hint {
  font-size: 10px;
  color: var(--8-faint);
}

/* 图表容器：高度由类名驱动（媒体查询可覆盖），内联高度会挡住响应式 */
.ffv8 .chart {
  width: 100%;
}
.ffv8 .chart-flow-rank {
  height: 420px;
}
.ffv8-chart-intraday { height: 268px; }
.ffv8-chart-trend { height: 252px; }
.ffv8-chart-structure { height: 224px; }
.ffv8-chart-quad { height: 288px; }
.ffv8-chart-compare { height: 226px; }
.ffv8-chart-compare-sum { height: 226px; }
.ffv8-chart-detail { height: 238px; }

/* DOM 图例行（替代 canvas legend） */
.ffv8-legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 10px;
  color: var(--8-muted);
  margin-top: 6px;
}
.ffv8-lg-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.ffv8-lg-item i {
  width: 9px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

/* ---------------- 四象限图例（2×2，布局镜像图表象限） ---------------- */
.ffv8-quad-keys {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
  margin-top: 6px;
}
.ffv8-quad-keys span {
  font-size: 9px;
  color: var(--8-faint);
  line-height: 1.45;
  padding-left: 12px;
  position: relative;
}
.ffv8-quad-keys span::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  /* 颜色/透明度按气泡四态由 qk-up / qk-down / qk-faded 修饰 */
  background: currentColor;
  opacity: 0.9;
}
.ffv8-quad-keys span.qk-up::before {
  background: var(--up);
}
.ffv8-quad-keys span.qk-down::before {
  background: var(--down);
}
.ffv8-quad-keys span.qk-faded::before {
  opacity: 0.4;
}
.ffv8-quad-keys b {
  display: block;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.4;
}
.ffv8-quad-keys i {
  display: block;
  font-style: normal;
}

/* ---------------- 单只明细事实网格 ---------------- */
.ffv8-facts {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--8-line);
  border: 1px solid var(--8-line);
  border-radius: var(--8-rm);
  overflow: hidden;
}
.ffv8-facts > div {
  background: var(--8-card);
  padding: 9px 11px;
  min-width: 0;
}
.ffv8-facts .k {
  font-size: 9.5px;
  color: var(--8-faint);
  white-space: nowrap;
}
.ffv8-facts .v {
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 650;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   移动端（≤760px）：把 PC 网格改为单列 + 吸顶子导航
   ========================================================================== */
@media (max-width: 1180px) {
  .ffv8 {
    grid-template-columns: 196px minmax(0, 1fr);
    gap: 16px;
  }
  .ffv8-grid-main {
    grid-template-columns: minmax(0, 1fr) 262px;
  }
  .ffv8-bf-head,
  .ffv8-bf-row {
    grid-template-columns: minmax(0, 1fr) 150px 34px 150px minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .ffv8 {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  .ffv8-rail {
    position: static;
  }
  /* 移动端：左侧导航转为横向吸顶分段条 */
  .ffv8-rail-nav {
    flex-direction: row;
    gap: 4px;
    overflow-x: auto;
    padding: 5px;
    border-radius: 10px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .ffv8-rail-nav::-webkit-scrollbar {
    display: none;
  }
  .ffv8-rail-item {
    flex: 0 0 auto;
    padding: 6px 10px;
    border-radius: 8px;
    align-items: center;
  }
  .ffv8-rail-item .ffv8-rail-ico {
    width: 20px;
    height: 20px;
    margin-top: 0;
  }
  .ffv8-rail-text em {
    display: none;
  }
  .ffv8-rail-text strong {
    font-size: 11.5px;
    white-space: nowrap;
  }
  .ffv8-rail-label,
  .ffv8-rail-note {
    display: none;
  }
  .ffv8-grid-main,
  .ffv8-grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .ffv8-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ffv8-kpi .v {
    font-size: 17px;
  }
  .ffv8-facts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .ffv8 .chart-flow-rank { height: 360px; }
  .ffv8-chart-intraday { height: 216px; }
  .ffv8-chart-trend { height: 214px; }
  .ffv8-chart-structure { height: 196px; }
  .ffv8-chart-quad { height: 236px; }
  .ffv8-chart-compare,
  .ffv8-chart-compare-sum { height: 190px; }
  .ffv8-chart-detail { height: 204px; }

  /* 蝶形榜在窄屏收起条形，只留数值 + 名称，避免挤成一团 */
  .ffv8-bf-head,
  .ffv8-bf-row {
    grid-template-columns: minmax(0, 1fr) 96px 26px 96px minmax(0, 1fr);
    gap: 4px;
  }
  .ffv8-bf-side .bar {
    display: none;
  }
  .ffv8-bf-side .val {
    min-width: 0;
    font-size: 9.5px;
  }
  .ffv8-bf-name .t {
    font-size: 11px;
  }
  .ffv8-bf-name .m {
    display: none;
  }
}

@media (max-width: 560px) {
  .ffv8-kpis {
    gap: 8px;
  }
  .ffv8-kpi {
    padding: 9px 10px;
  }
  .ffv8-kpi .v {
    font-size: 16px;
  }
  .ffv8-kpi .k,
  .ffv8-kpi .s {
    font-size: 9px;
  }
  .ffv8-card-body {
    padding: 11px 11px;
  }
  .ffv8-card-head {
    padding: 10px 11px;
  }
  .ffv8-quad-keys b {
    font-size: 9.5px;
  }
  .ffv8-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ffv8-bf-head,
  .ffv8-bf-row {
    grid-template-columns: minmax(0, 1fr) 84px 22px 84px minmax(0, 1fr);
  }
  .ffv8-bf-side .val {
    font-size: 9px;
  }
  .ffv8-rail-item {
    padding: 6px 8px;
  }
  .ffv8-rail-text strong {
    font-size: 11px;
  }
}

/* 分时页标的 chip 区：与日期栏同排，允许换行但不挤压 */
.ffv8 .flow-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}
.ffv8 .intraday-datebar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}
.ffv8 .intraday-datebar .form-select {
  min-width: 128px;
}
/* axis note */
.ffv8-axis-note {
  font-size: 9.5px;
  color: var(--8-faint);
  text-align: right;
  margin-top: 4px;
}

/* ==========================================================================
   移动端页头精简：标题 + 状态 chips 一行，刷新按钮与副标题合并，减少纵向占用
   ========================================================================== */
@media (max-width: 860px) {
  .ffv8 .page-head {
    align-items: center;
    gap: 8px;
  }
  .ffv8 .page-head h1 {
    font-size: 19px;
  }
  .ffv8 .page-head h1::before {
    height: 16px;
    width: 3.5px;
  }
  .ffv8 .page-head-main {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
  }
  .ffv8 .page-eyebrow {
    display: none;
  }
  /* 副标题 chips 收到标题右侧，超长换行 */
  .ffv8 .page-head-main .page-sub {
    margin-top: 0;
    gap: 6px;
  }
  .ffv8 .page-head-main .page-sub .meta-chip {
    font-size: 9.5px;
    padding: 1px 6px;
  }
  /* 最后一个 chip 是口径描述，移动端隐藏（口径已在导航下方折叠） */
  .ffv8 .page-head-main .page-sub .meta-chip:last-child {
    display: none;
  }
  .ffv8 .head-actions {
    width: auto;
    margin-left: 0;
    flex: 0 0 auto;
  }
  .ffv8 .head-actions .btn {
    height: 28px;
    padding: 0 10px;
    font-size: 11px;
  }
}

@media (max-width: 560px) {
  .ffv8 .page-head {
    flex-wrap: nowrap;
    align-items: flex-start;
  }
  .ffv8 .page-head h1 {
    font-size: 17px;
  }
  .ffv8 .page-head-main {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .ffv8 .page-head-main .page-sub {
    width: 100%;
  }
}

/* ==========================================================================
 * 页内章节导航（PC 左栏竖排 / 移动端吸顶横排）+ 可折叠明细 + 移动端副导航
 * ========================================================================== */
.ffv8-sec {
  min-width: 0;
  scroll-margin-top: 96px;
}
.ffv8-secnav {
  display: none;
}
.ffv8-secnav.vertical {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px;
  background: color-mix(in srgb, var(--panel) 55%, transparent);
  border: 1px solid var(--8-line);
  border-radius: 10px;
}
.ffv8-secnav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: none;
  font-size: 11.5px;
  color: var(--8-muted);
  cursor: pointer;
  text-align: left;
  transition: background 0.14s, color 0.14s;
}
.ffv8-secnav-item::after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--8-line2);
  flex: 0 0 auto;
}
.ffv8-secnav-item:hover {
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  color: var(--8-ink);
}
.ffv8-secnav-item.on {
  background: var(--8-card);
  border-color: var(--8-line);
  color: var(--8-red);
  font-weight: 650;
  box-shadow: var(--shadow-sm);
}
.ffv8-secnav-item.on::after {
  background: var(--8-red);
}

/* 折叠明细 */
.ffv8-fold-toggle {
  height: 24px;
  padding: 0 9px;
  border-radius: 6px;
  border: 1px solid var(--8-line);
  background: var(--8-card);
  font-size: 10.5px;
  color: var(--8-ink2);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.ffv8-fold-toggle:hover {
  border-color: var(--8-line2);
  color: var(--8-ink);
}

/* 移动端：副导航 + 章节导航吸顶，rail 整体隐藏 */
.ffv8-subnav-m {
  display: none;
}

@media (max-width: 860px) {
  .ffv8-rail {
    display: none;
  }
  .ffv8-subnav-m {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding: 5px;
    margin-bottom: 8px;
    background: color-mix(in srgb, var(--panel) 85%, transparent);
    border: 1px solid var(--8-line);
    border-radius: 10px;
    position: sticky;
    top: 54px;
    z-index: 9;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    scrollbar-width: none;
  }
  .ffv8-subnav-m::-webkit-scrollbar {
    display: none;
  }
  .ffv8-subnav-m-item {
    flex: 0 0 auto;
    height: 28px;
    padding: 0 11px;
    display: inline-flex;
    align-items: center;
    border-radius: 7px;
    border: 1px solid transparent;
    font-size: 11.5px;
    color: var(--8-muted);
    background: none;
    cursor: pointer;
    white-space: nowrap;
  }
  .ffv8-subnav-m-item.on {
    background: var(--8-card);
    border-color: var(--8-line);
    color: var(--8-red);
    font-weight: 650;
    box-shadow: var(--shadow-sm);
  }
  .ffv8-secnav.horizontal {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding: 4px;
    margin-bottom: 6px;
    background: color-mix(in srgb, var(--panel) 80%, transparent);
    border: 1px solid var(--8-line);
    border-radius: 10px;
    position: sticky;
    top: 92px;
    z-index: 8;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    scrollbar-width: none;
  }
  .ffv8-secnav.horizontal::-webkit-scrollbar {
    display: none;
  }
  .ffv8-secnav-item {
    flex: 0 0 auto;
    height: 25px;
    padding: 0 9px;
    font-size: 10.5px;
    border-radius: 6px;
  }
  .ffv8-secnav-item::after {
    display: none;
  }
  .ffv8-sec {
    scroll-margin-top: 148px;
  }
}

/* 单行内联提示（分时缺失等常态降级） */
.ffv8-inline-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 9px 13px;
  border: 1px dashed var(--8-line2);
  border-radius: var(--8-rm);
  background: var(--8-paper, transparent);
  font-size: 12.5px;
  color: var(--8-ink2);
}
.ffv8-inline-note svg { color: var(--8-faint); flex: 0 0 auto; }
.ffv8-inline-note-hint { font-size: 11.5px; color: var(--8-muted); }
@media (max-width: 640px) {
  .ffv8-inline-note { padding: 8px 12px; }
  .ffv8-inline-note-hint { width: 100%; }
}
