/* ==========================================================================
   创金A — 纸感终端 v14（2026-11-18）
   在 styles.css / fundflow-v8.css 之后加载，只覆盖视觉表达，不改动 HTML 语义。

   设计要点
   - 冷白纸面 + 1px 发丝线，面板零投影（投影只给浮层：弹窗 / 抽屉 / Sheet）
   - 品牌红只用于：品牌标、当前项标记、主 CTA；红绿仅表达涨跌
   - 数字全等宽 + tabular-nums，表格行高固定，扫读不跳动
   - 侧栏分组全展开：17 个入口常驻可见，一次点击直达
   ========================================================================== */

/* ==========================================================================
   1. 设计令牌
   ========================================================================== */
:root {
  color-scheme: light;

  /* 纸面 / 表面 */
  --bg: #f4f5f7;
  --bg-soft: #eef0f2;
  --panel: #ffffff;
  --panel-2: #fafbfc;
  --panel-3: #f2f4f6;
  --paper: #fcfcfd;

  /* 发丝线 */
  --border: #e5e7ea;
  --border-strong: #d3d7dc;
  --hairline: #edeff1;

  /* 文字 */
  --text: #14181d;
  --text-dim: #2c333c;
  --muted: #5a6472;
  --faint: #8b939e;

  /* 品牌 / 语义 */
  --accent: #d6001c;
  --accent-deep: #ab0016;
  --accent-dim: color-mix(in srgb, var(--accent) 6%, transparent);
  --blue: #1c5aa5;
  --up: #d0021b;
  --up-dim: color-mix(in srgb, var(--up) 7%, transparent);
  --down: #0a7a54;
  --down-dim: color-mix(in srgb, var(--down) 8%, transparent);
  --flat: #66707d;
  --warn: #9c6b00;
  --warn-dim: color-mix(in srgb, var(--warn) 9%, transparent);
  --danger: #c0172b;

  /* 几何：更小的圆角，接近数据终端而非消费级卡片 */
  --radius: 7px;
  --radius-sm: 5px;
  --radius-lg: 10px;

  /* 投影：默认无；仅浮层使用 */
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: 0 18px 44px rgba(15, 22, 32, 0.16);

  /* 控件 */
  --ctrl-h: 32px;
  --ctrl-h-sm: 26px;
  --ctrl-h-lg: 40px;

  --font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", "Roboto Mono", ui-monospace, Menlo,
    Consolas, "Liberation Mono", monospace;

  --topbar-h: 52px;
  --sidebar-w: 232px;
}

/* ==========================================================================
   2. 基础
   ========================================================================== */
body {
  background-color: var(--bg);
  /* 去掉旧版的径向红晕：纸感终端不做装饰性渐变 */
  background-image: none;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
a { color: var(--accent); }
a:hover { color: var(--accent-deep); }
:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  outline-offset: 2px;
  border-radius: 3px;
}
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}
.num { font-variant-numeric: tabular-nums; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }

/* 滚动条：细、浅、仅在需要时出现 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: padding-box; }

/* ==========================================================================
   3. 布局骨架
   ========================================================================== */
.app {
  flex: 1;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 18px 24px 44px;
}
.page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: page-in 0.18s ease;
}
@keyframes page-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}

/* ==========================================================================
   4. 顶栏
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  flex: 0 0 auto;
}
/* 桌面：品牌已在侧栏，顶栏隐藏重复的品牌块 */
@media (min-width: 1024px) {
  .topbar .brand { display: none; }
}
.brand:hover { color: var(--text); }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  overflow: hidden;
  flex: 0 0 auto;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand-text strong {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

/* 顶栏搜索胶囊 */
.topbar-search-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  width: 300px;
  margin-left: 6px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--faint);
  font-size: 12.5px;
  transition: border-color 0.14s, background 0.14s;
}
.topbar-search-pill:hover {
  border-color: var(--border-strong);
  background: var(--panel-2);
  color: var(--muted);
}
.topbar-search-pill svg { flex: 0 0 auto; color: var(--faint); }
.topbar-search-text {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-search-kbd {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel-3);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  flex: 0 0 auto;
}

/* 状态胶囊：纸面上的一枚小标签，不做彩色大按钮 */
.status-capsule {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  transition: border-color 0.14s, background 0.14s;
}
.status-capsule:hover { border-color: var(--border-strong); background: var(--panel-2); color: var(--text); }
.status-capsule .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--up);
  flex: 0 0 auto;
}
.status-capsule.active { color: var(--text); }
.status-capsule.active .dot { background: var(--up); box-shadow: 0 0 0 3px var(--up-dim); }
.status-capsule.expired {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 28%, transparent);
  background: color-mix(in srgb, var(--danger) 5%, transparent);
}
.status-capsule.expired:hover { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.status-capsule.login {
  background: var(--text);
  border-color: var(--text);
  color: var(--panel);
  font-weight: 600;
}
.status-capsule.login:hover { background: color-mix(in srgb, var(--text) 82%, #000); border-color: color-mix(in srgb, var(--text) 82%, #000); color: var(--panel); }

.topbar-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-3);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  flex: 0 0 auto;
}
.topbar-avatar:hover { border-color: var(--border-strong); background: var(--panel-2); color: var(--text); }

/* ==========================================================================
   5. 侧栏（桌面）：分组全展开
   ========================================================================== */
.sidebar { display: none; }

@media (min-width: 1024px) {
  .sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    padding: 14px 10px 12px;
    background: var(--paper);
    border-right: 1px solid var(--border);
    z-index: 65;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body { padding-left: var(--sidebar-w); }
  .topbar, .app, .site-footer { max-width: none; }
  .topbar-inner {
    padding-left: 24px;
    padding-right: 24px;
  }
  .app { padding-left: 24px; padding-right: 24px; }
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 8px 12px;
  color: var(--text);
}
.sidebar-brand:hover { color: var(--text); }
.sidebar-brand .brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 7px;
}
.sidebar-brand-name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.sidebar-brand-name strong {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.sidebar-brand-name small {
  font-size: 10px;
  font-weight: 500;
  color: var(--faint);
  letter-spacing: 0.06em;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-bottom: 10px;
}
.sidebar-group-block { display: flex; flex-direction: column; gap: 1px; }
/* 旧版给导航容器加了写死的「行情导航」标签，与第一个组名（市场）叠成两行标题 */
.sidebar-nav::before { display: none; }
.sidebar-group-nav { display: flex; flex-direction: column; gap: 1px; }
/* 分组标签：小号、字重 500、留白建立节奏（替代旧版唯一一个「行情导航」） */
.sidebar-group {
  padding: 14px 10px 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--faint);
  text-transform: uppercase;
  user-select: none;
}
.sidebar-group:first-child { padding-top: 4px; }

/* 入口行：全部常驻，当前项用 2px 红条 + 浅红底标记 */
.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 32px;
  padding: 0 10px 0 11px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-link svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  color: var(--faint);
  transition: color 0.12s ease;
}
.sidebar-link .sidebar-link-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sidebar-link:hover { background: var(--panel-3); color: var(--text); }
.sidebar-link:hover svg { color: var(--text-dim); }
.sidebar-link.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
  box-shadow: none;
}
.sidebar-link.active svg { color: var(--accent); }
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 14px;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
/* 旧版手风琴箭头与二级磁贴：新结构下不再渲染，规则保留为空以免回归 */
.sidebar-link-chev { display: none; }
.sidebar-entries { display: none; }

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
}

/* 侧栏订阅卡：纸面上一块浅灰分区，不做彩色渐变 */
.sub-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 11px 12px;
}
.sub-card.pro { border-color: var(--border); background: var(--panel); }
.sub-card.expired { border-color: color-mix(in srgb, var(--danger) 26%, transparent); background: color-mix(in srgb, var(--danger) 3%, transparent); }
.sub-card-title {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-dim);
}
.sub-card-title svg { color: var(--accent); flex: 0 0 auto; }
.sub-card.expired .sub-card-title,
.sub-card.expired .sub-card-title svg { color: var(--danger); }
.sub-card-note {
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--faint);
  line-height: 1.45;
}
.sub-card-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 27px;
  margin-top: 9px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--panel);
  font-size: 11.5px;
  font-weight: 600;
  transition: background 0.14s ease;
}
.sub-card-cta:hover { color: var(--panel); background: color-mix(in srgb, var(--text) 82%, #000); transform: none; box-shadow: none; }
.sub-card-cta.ghost {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.sub-card-cta.ghost:hover { background: var(--panel-3); color: var(--text); border-color: var(--border-strong); }
/* 暗夜：主题层的「CTA 深色字」是给品牌金底按钮的，ghost 描边按钮会被误伤成
   深底深字；这里用更高优先级还原描边按钮的文字色（仅颜色，不改尺寸） */
:root[data-theme="dark"] .sub-card-cta.ghost { color: var(--text-dim); }
:root[data-theme="dark"] .sub-card-cta.ghost:hover { color: var(--text); }

/* ==========================================================================
   6. 移动端底部导航 + 二级 Sheet
   ========================================================================== */
.bottom-nav { display: none; }
.bottom-subnav { display: none; }

@media (max-width: 1023px) {
  .bottom-nav {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 66;
    height: calc(54px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--panel) 96%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--border);
  }
  .bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0;
    border: 0;
    background: none;
    font-family: inherit;
    color: var(--faint);
    font-size: 10px;
    font-weight: 500;
    position: relative;
    cursor: pointer;
    transition: color 0.12s ease;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav-item .bn-icon {
    display: inline-flex;
    transition: transform 0.12s ease;
  }
  .bottom-nav-item.active { color: var(--accent); font-weight: 600; }
  .bottom-nav-item.active::before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 22px;
    height: 2px;
    border-radius: 0 0 2px 2px;
    background: var(--accent);
  }
  .bottom-nav-item:active .bn-icon { transform: translateY(1px); }

  /* 二级入口 Sheet：贴在底栏之上的独立浮层，压暗背景以表明层级 */
  .bottom-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(54px + env(safe-area-inset-bottom));
    z-index: 65;
    padding: 13px 14px 14px;
    background: var(--panel);
    border-top: 1px solid var(--border);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -16px 40px rgba(15, 22, 32, 0.18);
    transform: translateY(112%);
    visibility: hidden;
    transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1), visibility 0.22s;
  }
  .bottom-subnav.open { transform: translateY(0); visibility: visible; }
  .bottom-subnav-label {
    flex: 1 0 100%;
    padding: 0 2px 4px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--faint);
    text-transform: uppercase;
  }
  .bottom-subnav-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 1 1 calc(50% - 4px);
    min-width: 0;
    height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--panel);
    color: var(--text-dim);
    font-size: 12.5px;
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .bottom-subnav-item svg { flex: 0 0 auto; color: var(--faint); }
  .bottom-subnav-item:active { background: var(--panel-3); }
  .bottom-subnav-item.active {
    border-color: color-mix(in srgb, var(--accent) 28%, transparent);
    background: var(--accent-dim);
    color: var(--accent);
    font-weight: 600;
  }
  .bottom-subnav-item.active svg { color: var(--accent); }
}

/* ==========================================================================
   7. 页头
   ========================================================================== */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 2px 0 0;
}
.page-head-main { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.page-eyebrow {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--faint);
  text-transform: uppercase;
}
.page-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.page-title-row h1,
.page-title-node {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--text);
}
.page-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--muted);
  flex: 0 0 auto;
}
.page-back:hover { border-color: var(--border-strong); background: var(--panel-3); color: var(--text); }
.page-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--faint);
}
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* 页头状态 chip：降到几乎无声的层级，只在需要时被读到 */
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.meta-chip.warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 28%, transparent);
  background: var(--warn-dim);
}
.meta-chip.cached { color: var(--faint); }
.live-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--up);
  flex: 0 0 auto;
  box-shadow: 0 0 0 2.5px var(--up-dim);
}

/* ==========================================================================
   8. 面板：白纸 + 发丝线，零投影
   ========================================================================== */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
  box-shadow: none;
  transition: none;
}
.panel:hover { box-shadow: none; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-height: 40px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius) var(--radius) 0 0;
}
.panel-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: 0;
  min-width: 0;
}
.panel-title::before {
  content: "";
  width: 2px;
  height: 11px;
  border-radius: 1px;
  background: var(--accent);
  flex: 0 0 auto;
  transform: translateY(1px);
}
.panel-title small {
  font-weight: 400;
  font-size: 11px;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.panel-body { padding: 14px; }
.panel-body.flush { padding: 0; }
.panel-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.panel-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 10px;
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

/* 面板内的次级分区：用一行发丝线 + 小标题分隔，不再嵌套带边框的卡片 */
.panel-body + .panel-body { border-top: 1px solid var(--hairline); }

/* ==========================================================================
   9. 按钮
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: var(--ctrl-h);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.13s, border-color 0.13s, background 0.13s;
  box-shadow: none;
}
.btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--panel-2);
}
.btn:active { transform: none; background: var(--panel-3); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary {
  color: var(--panel);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: none;
}
.btn.primary:hover { color: var(--panel); background: var(--accent-deep); border-color: var(--accent-deep); box-shadow: none; }
.btn.primary:active { background: var(--accent-deep); }
.btn.ghost { background: transparent; border-color: var(--border); color: var(--muted); }
.btn.ghost:hover { background: var(--panel-3); border-color: var(--border-strong); color: var(--text); }
.btn.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  background: color-mix(in srgb, var(--danger) 5%, transparent);
}
.btn.danger:hover { color: var(--panel); background: var(--danger); border-color: var(--danger); }
.btn.sm { height: var(--ctrl-h-sm); padding: 0 9px; font-size: 11.5px; }
.btn.block, .btn-block { width: 100%; }
.btn.lg, .btn-lg { height: var(--ctrl-h-lg); font-size: 13px; }
.btn-icon { width: 13px; height: 13px; }

/* 图标按钮（星标 / 删除） */
.star-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--faint);
  cursor: pointer;
  flex: 0 0 auto;
  transition: color 0.13s, background 0.13s, border-color 0.13s;
}
.star-btn:hover { color: var(--text-dim); background: var(--panel-3); }
.star-btn.active { color: var(--accent); background: var(--up-dim); border-color: color-mix(in srgb, var(--accent) 20%, transparent); }
.star-btn.lg { width: 32px; height: 32px; border-color: var(--border); background: var(--panel); }

/* ==========================================================================
   10. 表单
   ========================================================================== */
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.form-hint { font-size: 11px; color: var(--faint); line-height: 1.55; }
.form-input,
.form-select {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.13s, box-shadow 0.13s;
}
.form-input::placeholder { color: var(--faint); opacity: 1; }
.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent);
}
.form-stack { display: flex; flex-direction: column; gap: 12px; }

/* ==========================================================================
   11. Tabs / 分段控件
   ========================================================================== */
/* 下划线式页面 Tab（个股 / 板块详情）：最接近终端里的「视图切换」 */
.page-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.page-tabs::-webkit-scrollbar { display: none; }
.page-tabs .ptab {
  position: relative;
  padding: 8px 12px 9px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.13s;
}
.page-tabs .ptab:hover { color: var(--text); }
.page-tabs .ptab.active { color: var(--text); font-weight: 650; }
.page-tabs .ptab.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
}

/* 药丸式分段：灰底容器 + 白底选中（用于页内列表切换） */
.tabs {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  height: 24px;
  padding: 0 11px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s, background 0.12s;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text);
  background: var(--panel);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border);
}
.tabs.sm .tab { font-size: 11.5px; height: 22px; padding: 0 9px; }
.tab-badge {
  font-style: normal;
  font-size: 9.5px;
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 3px;
  background: var(--accent);
  color: var(--panel);
  font-family: var(--font-mono);
}
.tabs.plain { background: transparent; border: 0; padding: 0; gap: 14px; }
.tabs.plain .tab {
  height: auto;
  padding: 3px 0;
  border-radius: 0;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  box-shadow: none;
}
.tabs.plain .tab.active {
  color: var(--text);
  background: transparent;
  box-shadow: none;
  border-bottom-color: var(--accent);
}
.link-tabs { display: inline-flex; background: var(--panel-3); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 2px; gap: 1px; overflow-x: auto; max-width: 100%; }
.link-tabs .tab { text-decoration: none; }
.link-tabs .tab.active { color: var(--text); background: var(--panel); box-shadow: inset 0 0 0 1px var(--border); }

/* 全局分段控件（ui.js seg）：同一语言 */
.seg {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.seg::-webkit-scrollbar { display: none; }
.seg button {
  height: 24px;
  padding: 0 11px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}
.seg button:hover { color: var(--text); }
.seg button.on {
  color: var(--text);
  background: var(--panel);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border);
}
.seg.sm button { height: 22px; padding: 0 9px; font-size: 11.5px; }
.seg-wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.subnav { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.subnav-link {
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid transparent;
}
.subnav-link:hover { color: var(--text); background: var(--panel-3); }
.subnav-link.active { color: var(--accent); background: var(--accent-dim); font-weight: 600; box-shadow: none; }

/* ==========================================================================
   12. 数据表格：终端密度
   ========================================================================== */
.table-wrap { width: 100%; overflow: auto; border-radius: 0 0 var(--radius) var(--radius); }
.table-scroll { max-height: 560px; overflow: auto; }
.table-wrap.table-sticky thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel-2);
  box-shadow: inset 0 -1px 0 var(--border);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.data-table th {
  text-align: right;
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--faint);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--panel-2);
}
.data-table th:first-child,
.data-table td:first-child { text-align: left; }
.data-table td {
  text-align: right;
  height: 38px;
  padding: 0 12px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background 0.1s; }
.data-table tbody tr:hover { background: var(--panel-2); }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.data-table tbody tr.clickable:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); outline-offset: -2px; }
.data-table tbody tr.latest td { background: color-mix(in srgb, var(--accent) 3%, transparent); }
.data-table tbody tr.latest td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
.data-table .num { font-family: var(--font-mono); letter-spacing: -0.01em; }
.data-table .rank {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
  width: 38px;
  padding-right: 4px;
}
.data-table .rank.top { color: var(--accent); font-weight: 700; }
.data-table .sym { display: flex; flex-direction: column; gap: 0; text-align: left; }
.data-table .sym .nm {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}
.data-table .sym a.nm:hover { color: var(--accent); }
.data-table .sym .cd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
  line-height: 1.35;
}
.data-table .pct { font-weight: 600; }
.data-table .strong { font-weight: 600; }

/* 表格列宽节奏：名称列限宽，其余列按内容分布，避免名称一列吃掉半张表 */
.data-table th:first-child,
.data-table td:first-child { width: 44px; }
.data-table th:nth-child(2),
.data-table td:nth-child(2) { width: 34%; min-width: 140px; text-align: left; }
.data-table th:last-child,
.data-table td:last-child { padding-right: 16px; }
/* 3 列以内的窄表（订单/明细）不需要名称列特殊处理 */
.data-table th:nth-child(2):last-child,
.data-table td:nth-child(2):last-child { width: auto; min-width: 0; }

/* 资金流页的双向排行表：板块名列需要更宽，数值列给它让位 */
.flow-rank-panel .data-table th:nth-child(2),
.flow-rank-panel .data-table td:nth-child(2) { width: 40%; min-width: 120px; }
.flow-rank-panel .data-table th,
.flow-rank-panel .data-table td { padding-left: 8px; padding-right: 8px; }
.flow-rank-panel .data-table th:first-child,
.flow-rank-panel .data-table td:first-child { width: 28px; }
.table-note {
  padding: 7px 12px;
  border-top: 1px solid var(--hairline);
  font-size: 10.5px;
  color: var(--faint);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.table-caption { padding: 7px 12px; font-size: 10.5px; color: var(--faint); }
.order-table { min-width: 640px; }

/* 排行榜前三名的名次徽标：纸面上只用红色字重区分 */
.rank.top { color: var(--accent); }

/* ==========================================================================
   13. 涨跌胶囊 / 标签
   ========================================================================== */
.pct-chip {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 62px;
  height: 21px;
  padding: 0 6px;
  border-radius: 3px;
  background: var(--panel-3);
  color: var(--flat);
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.pct-chip.up { color: var(--up); background: var(--up-dim); }
.pct-chip.down { color: var(--down); background: var(--down-dim); }
.pct-chip.flat { color: var(--flat); background: var(--panel-3); }
.pct-chip.lg { height: 26px; min-width: 72px; padding: 0 10px; font-size: 13px; border-radius: 4px; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}

/* 状态徽标 */
.status-badge {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}
.status-badge.ok { color: var(--up); border-color: color-mix(in srgb, var(--up) 22%, transparent); background: var(--up-dim); }
.status-badge.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 26%, transparent); background: color-mix(in srgb, var(--danger) 5%, transparent); }
.status-badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 26%, transparent); background: var(--warn-dim); }

/* ==========================================================================
   14. 提示条 Banner
   ========================================================================== */
.banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.55;
}
.banner svg { flex: 0 0 auto; margin-top: 1px; color: var(--faint); }
.banner.info { border-left-color: var(--blue); }
.banner.info svg { color: var(--blue); }
.banner.warn { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 4%, transparent); }
.banner.warn svg { color: var(--warn); }
.banner.error { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 4%, transparent); }
.banner.error svg { color: var(--danger); }
.b-text { flex: 1 1 auto; min-width: 0; }
.b-title { font-weight: 650; margin-right: 4px; }
.b-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }

/* ==========================================================================
   15. 状态块 / 骨架屏
   ========================================================================== */
.state-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 44px 20px;
  text-align: center;
  color: var(--muted);
}
.state-block.compact { padding: 22px 14px; }
.state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--faint);
}
.state-title { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.state-desc { font-size: 11.5px; color: var(--faint); line-height: 1.6; max-width: 380px; }
.state-code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--faint);
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
}
.state-block.error .state-icon { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 24%, transparent); background: color-mix(in srgb, var(--danger) 5%, transparent); }

.spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-inline {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 16px 2px;
  color: var(--faint);
  font-size: 11.5px;
}

.sk {
  border-radius: 3px;
  background: linear-gradient(90deg, var(--panel-3) 25%, var(--panel-2) 37%, var(--panel-3) 63%);
  background-size: 400% 100%;
  animation: sk-shine 1.4s ease infinite;
}
@keyframes sk-shine {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.sk-line { height: 11px; margin: 4px 0; }
.sk-line.w100 { width: 100%; }
.sk-line.w80 { width: 80%; }
.sk-line.w60 { width: 60%; }
.sk-line.w40 { width: 40%; }
.sk-card { height: 78px; border-radius: var(--radius); }
.sk-table { display: flex; flex-direction: column; gap: 9px; padding: 14px; }
.sk-row { display: flex; align-items: center; gap: 10px; }
.sk-row .sk { height: 11px; flex: 1 1 auto; }
.sk-row .sk.short { flex: 0 0 60px; }

/* ==========================================================================
   16. 页脚
   ========================================================================== */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px 20px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 10.5px;
  background: transparent;
}
.site-footer .foot-sep { margin: 0 4px; color: var(--border-strong); }
.site-footer .mono { color: var(--muted); }

/* ==========================================================================
   17. 浮层：Toast / Modal / Drawer
   ========================================================================== */
.toast-root {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: min(360px, calc(100vw - 36px));
  padding: 9px 13px 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--panel);
  font-size: 12px;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  cursor: pointer;
  animation: toast-in 0.2s ease;
}
.toast::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
  flex: 0 0 auto;
}
.toast.success::before { background: var(--down); }
.toast.error::before { background: var(--danger); }
.toast.warn::before { background: var(--warn); }
.toast.info::before { background: var(--blue); }
.toast.leaving { animation: toast-out 0.18s ease forwards; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(4px); }
}

.modal-open { overflow: hidden; }
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(14, 20, 28, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade-in 0.16s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%;
  max-width: 480px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: none; }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 13.5px; font-weight: 650; color: var(--text); }
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--faint);
  cursor: pointer;
  flex: 0 0 auto;
}
.modal-close:hover { background: var(--panel-3); color: var(--text); }
.modal-body { padding: 16px; font-size: 12.5px; color: var(--text-dim); overflow-y: auto; }
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
}
.dialog-msg { display: flex; align-items: flex-start; gap: 10px; }
.dialog-msg-icon { flex: 0 0 auto; color: var(--faint); }
.dialog-msg.error .dialog-msg-icon { color: var(--danger); }
.dialog-msg-text { font-size: 12.5px; line-height: 1.65; color: var(--text-dim); }

.drawer-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  justify-content: flex-end;
  background: rgba(14, 20, 28, 0.42);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fade-in 0.16s ease;
}
.drawer {
  width: min(400px, 100vw);
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: drawer-in 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
@keyframes drawer-in {
  from { transform: translateX(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.drawer-head-main { flex: 1 1 auto; min-width: 0; }
.drawer-title { font-size: 14px; font-weight: 700; line-height: 1.35; color: var(--text); }
.drawer-sub { margin-top: 2px; font-size: 11.5px; color: var(--faint); }
.drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--faint);
  cursor: pointer;
  flex: 0 0 auto;
}
.drawer-close:hover { background: var(--panel-3); color: var(--text); }
.drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); }
.drawer-stack { display: flex; flex-direction: column; gap: 14px; }
.drawer-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--border);
  overflow: hidden;
}
.drawer-metric { background: var(--panel); padding: 10px 8px; text-align: center; min-width: 0; }
.drawer-metric-label { font-size: 10px; color: var(--faint); white-space: nowrap; }
.drawer-metric-value { margin-top: 2px; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.drawer-kv-list { display: flex; flex-direction: column; border-top: 1px solid var(--hairline); }
.drawer-kv {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.drawer-kv:last-child { border-bottom: 0; }
.drawer-kv-label { color: var(--muted); }
.drawer-kv-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.drawer-actions { display: flex; flex-direction: column; gap: 7px; }
.drawer-actions .btn { justify-content: center; }

/* ==========================================================================
   18. 市场总览：情绪带 / 指数条 / 热点 / 榜单
   ========================================================================== */
/* 情绪带：左侧温度计，右侧结论；整体压到 ~150px 高 */
.mood-body {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 16px;
}
.mood-gauge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
  width: 116px;
}
.mood-gauge { width: 116px; height: 66px; display: block; }
.mood-gauge path { opacity: 0.9; }
.mood-needle { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.mood-hub { fill: var(--text); }
.mood-score-line { display: flex; align-items: baseline; gap: 3px; }
.mood-score { font-size: 18px; font-weight: 700; line-height: 1; }
.mood-unit { font-size: 9.5px; color: var(--faint); }
.mood-label {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 5px;
  margin-left: 2px;
  border-radius: 3px;
  background: var(--panel-3);
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}
.mood-label.level-frozen,
.mood-label.level-cool { background: var(--down-dim); color: var(--down); }
.mood-label.level-warm,
.mood-label.level-hot { background: var(--up-dim); color: var(--up); }

.mood-detail { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.mood-conclusion {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  font-weight: 550;
}
.mood-conclusion-mark {
  flex: 0 0 auto;
  height: 17px;
  padding: 0 5px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  border-radius: 3px;
  background: var(--up-dim);
  color: var(--accent);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 15px;
}

/* 涨跌分布条：3px 细条 + 上下对齐的读数 */
.breadth-bar {
  display: flex;
  width: 100%;
  height: 3px;
  gap: 0;
  border-radius: 2px;
  overflow: hidden;
  background: var(--panel-3);
}
.breadth-bar .seg { height: 100%; }
.breadth-bar .seg-up { background: var(--up); }
.breadth-bar .seg-flat { background: var(--faint); }
.breadth-bar .seg-down { background: var(--down); }
.breadth-legend {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.breadth-legend span { display: inline-flex; align-items: center; gap: 5px; }
.breadth-legend i { width: 6px; height: 6px; border-radius: 1px; flex: 0 0 auto; }
.mood-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mood-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel-2);
  font-size: 11px;
}
.mood-chip i { font-style: normal; color: var(--faint); }
.mood-chip b { font-family: var(--font-mono); font-weight: 600; color: var(--text-dim); }

/* 指数条：一行 8 格，窄屏 2 列；格与格之间只用发丝线分隔 */
.idx-strip-block {
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
  overflow: hidden;
}
.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.block-head h2 {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
}
.block-head h2::before {
  content: "";
  width: 2px;
  height: 11px;
  border-radius: 1px;
  background: var(--accent);
  transform: translateY(1px);
}
.block-more { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.block-more:hover { color: var(--text); }

.idx-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  margin: 0;
  background: var(--border);
  overflow: visible;
  scroll-snap-type: none;
}
.idx-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 0;
  max-width: none;
  padding: 10px 12px 9px;
  border: 0;
  border-radius: 0;
  background: var(--panel);
  color: inherit;
  transition: background 0.12s ease;
}
.idx-card:hover { border-color: transparent; box-shadow: none; background: var(--panel-2); color: inherit; }
.idx-card-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.idx-card-price {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.idx-card-price.up { color: var(--up); }
.idx-card-price.down { color: var(--down); }
.idx-card-price.flat { color: var(--text); }
.idx-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-width: 0;
}
.idx-card-amt {
  font-size: 10px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.idx-spark { width: 100%; height: 16px; display: block; opacity: 0.9; }

/* 首页双栏：左右各一块，间距用网格 gap，不再各带一层阴影 */
.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
/* 榜单两块（.home-tables 由页面自身产出）跨满两列，内部再二分 */
.home-grid > .home-tables,
.home-grid > .home-watch {
  grid-column: 1 / -1;
}
.home-grid > .home-tables {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
@media (max-width: 1023px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-grid > .home-tables { grid-template-columns: minmax(0, 1fr); }
}
.home-tables { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; align-items: start; }

/* 热点板块：行式密度列表（名称 + 涨幅 + 龙头），替代散落的 chip 墙 */
.hot-chips { display: flex; flex-direction: column; gap: 0; }
.hot-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 33px;
  padding: 0 2px;
  /* 旧版是 chip（inline-flex + 999px 圆角 + 边框），改行式后必须显式撤销，
     否则每行两端都是胶囊圆角 */
  border: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: none;
  line-height: 1.4;
  max-width: none;
  color: var(--text-dim);
  font-size: 12.5px;
  transition: background 0.1s ease;
}
.hot-chip:last-child { border-bottom: 0; }
.hot-chip:hover { background: var(--panel-2); color: var(--text); border-color: transparent; box-shadow: none; transform: none; }
.hot-chip-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hot-chip-value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hot-chip-leader {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  max-width: 110px;
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hot-chip-leader::first-letter { color: var(--accent); }
.hot-chip-leader:hover { color: var(--accent); }
/* 资金榜的相对强度条：贴底 2px，不打断行高 */
.hot-chip-flow { position: relative; padding-bottom: 4px; }
.hot-chip-bar {
  position: absolute;
  left: 0;
  right: auto;
  bottom: 1px;
  height: 2px;
  max-width: 100%;
  border-radius: 1px;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
  width: 100%;
}
.hot-chip-bar i { display: block; height: 100%; border-radius: 1px; }
.hot-chip-bar.up i { background: var(--up); opacity: 0.55; }
.hot-chip-bar.down i { background: var(--down); opacity: 0.55; }

/* 自选速览 */
.watch-quick-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.watch-empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--faint);
  flex: 0 0 auto;
}
.watch-empty-icon.sm { width: 28px; height: 28px; }
.watch-quick-copy { font-size: 12px; color: var(--muted); }
.watch-quick-copy b { color: var(--text-dim); font-weight: 600; }
.watch-quick-go { margin-left: auto; }
.watch-hot-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.watch-hot-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 27px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.watch-hot-chip svg { color: var(--faint); flex: 0 0 auto; }
.watch-hot-chip span { font-size: 10px; color: var(--faint); }
.watch-hot-chip:hover {
  border-color: var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
}
.watch-hot-chip:active { background: var(--panel-3); }

/* ==========================================================================
   19. 自选页
   ========================================================================== */
.watchlist-page .searchbox { max-width: 520px; }
.watch-panel .watch-rows { padding: 0; }
.watch-rows { display: flex; flex-direction: column; }
/* （`.watch-row` 的最终布局见文件末尾「自选页」一节：滑动轨道结构） */
.watch-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 84px;
  grid-template-areas:
    "name price pct"
    "sub  sub   sub";
  align-items: center;
  column-gap: 10px;
  row-gap: 3px;
  padding: 9px 2px 9px 12px;
  color: inherit;
}
.watch-row-main:hover { color: inherit; }
.watch-row-name {
  grid-area: name;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.watch-row-name b {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.watch-row-code { font-size: 10px; color: var(--faint); flex: 0 0 auto; }
.watch-row-price {
  grid-area: price;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.watch-row-pct {
  grid-area: pct;
  font-size: 12.5px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.watch-row-sub {
  grid-area: sub;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 10.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.watch-row-sub i { font-style: normal; color: var(--faint); margin-right: 2px; }
.watch-row-actions {
  display: flex;
  align-items: center;
  padding-right: 8px;
  flex: 0 0 auto;
}
.watch-remove-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
}
.watch-remove-btn:hover {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 6%, transparent);
  border-color: color-mix(in srgb, var(--danger) 20%, transparent);
}
.watch-empty-body { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 38px 20px; text-align: center; }

/* 添加搜索：下拉浮在纸面上 */
.searchbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 36px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  transition: border-color 0.13s, box-shadow 0.13s;
}
.searchbox:focus-within {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent);
}
.searchbox .search-icon { width: 15px; height: 15px; color: var(--faint); flex: 0 0 auto; }
.searchbox input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
}
.searchbox input::placeholder { color: var(--faint); opacity: 1; }
.search-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 5px);
  z-index: 40;
  max-height: 340px;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(15, 22, 32, 0.14);
}
.search-note { padding: 14px 12px; font-size: 11.5px; color: var(--faint); text-align: center; }
.search-note.error { color: var(--danger); }
.search-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--hairline);
}
.search-item:last-child { border-bottom: 0; }
.search-item:hover,
.search-item.active { background: var(--panel-2); }
.watch-search-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  padding: 0 4px 0 11px;
  border: 0;
  background: none;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text-dim);
}
.si-code {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.si-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.si-board {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--faint);
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
}

/* ==========================================================================
   20. 个股详情
   ========================================================================== */
.stock-title,
.page-title-node .stock-title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
}
.stock-name { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.stock-title .code { font-size: 12px; color: var(--faint); font-weight: 500; }
.stock-title .tag { transform: translateY(-2px); }

/* 个股页头右侧：价格组 + 自选星标 */
.stock-head-side {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.stock-page .page-head { align-items: center; }
.stock-page .page-head .head-actions { align-items: center; }

/* 行情头部：价格大号在右，标签在左，形成一条横向读数带 */
.stock-price {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.stock-price .price {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.02em;
}
.stock-price .chg { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.stock-price .pct { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }
.stock-price .price.up, .stock-price .chg.up, .stock-price .pct.up { color: var(--up); }
.stock-price .price.down, .stock-price .chg.down, .stock-price .pct.down { color: var(--down); }
.stock-price .price.flat, .stock-price .chg.flat, .stock-price .pct.flat { color: var(--text); }

/* 行情快照网格：18 个字段 = 9 列 × 2 行，正好铺满不留空位 */
.quote-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 1px;
  background: var(--hairline);
  border-top: 1px solid var(--hairline);
}
@media (max-width: 1280px) {
  .quote-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .quote-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .quote-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
  .quote-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.quote-grid .quote-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  background: var(--panel);
  min-width: 0;
}
.quote-grid .quote-cell .k {
  font-size: 10.5px;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quote-grid .quote-cell .v {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quote-grid .quote-cell .v.up { color: var(--up); }
.quote-grid .quote-cell .v.down { color: var(--down); }

/* 资金流六宫格：发丝线分隔的连续读数带（不再每格画边框 + 左侧色条） */
.flow-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--hairline);
  border-top: 1px solid var(--hairline);
}
.flow-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  background: var(--panel);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 0;
  min-width: 0;
}
.flow-card::before { display: none; }
.flow-card .k { font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.flow-card .v {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flow-card .v.up { color: var(--up); }
.flow-card .v.down { color: var(--down); }
.flow-card .s { font-size: 9.5px; color: var(--faint); }

/* 通用 KPI 卡（板块列表 / 指数快照等）：默认也是发丝线网格，不再每卡带边框和色条 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: none;
}
.stat-grid.strip {
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}
.stat-grid.strip .stat-card {
  border: 0;
  border-right: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 11px 14px;
}
.stat-grid.strip .stat-card:nth-child(2n),
.stat-grid.strip .stat-card:nth-child(-n + 2) { border-right: 0; border-bottom: 0; }
.stat-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 14px;
  background: var(--panel);
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-width: 0;
  position: relative;
  overflow: visible;
}
/* 去掉旧版左侧 3px 色条：纸感终端用数值颜色本身表达涨跌 */
.stat-card::before { display: none; }
.stat-card.compact { padding: 9px 12px; }
.stat-label {
  font-size: 10.5px;
  font-weight: 500;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stat-value.up { color: var(--up); }
.stat-value.down { color: var(--down); }
.stat-sub { font-size: 10px; color: var(--faint); }

/* ==========================================================================
   21. 板块
   ========================================================================== */
/* 板块快照：名称 + 涨跌在左，四项读数在右，下方一行龙头 */
.sector-snapshot {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}
.sector-snapshot-main { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sector-name { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.sector-pct { font-family: var(--font-mono); font-size: 19px; font-weight: 650; }
.sector-pct.up { color: var(--up); }
.sector-pct.down { color: var(--down); }
/* 四项读数：与行情快照同一套发丝线网格语言 */
.sector-snapshot-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  width: 100%;
  background: var(--hairline);
  border-top: 1px solid var(--hairline);
}
.sector-snapshot-stats .stat-card {
  padding: 9px 12px;
  background: var(--panel);
  box-shadow: none;
  border: 0;
  border-radius: 0;
}
.sector-snapshot-stats .stat-card::before { display: none; }
.sector-leader {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  padding-top: 2px;
}
@media (max-width: 768px) {
  .sector-snapshot-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.leader-link { display: inline-flex; align-items: baseline; gap: 5px; color: var(--text-dim); font-size: 12px; }
.leader-link:hover { color: var(--accent); }
.leader-link.static { color: var(--text-dim); }
.mini-pct { font-family: var(--font-mono); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.mini-pct.up { color: var(--up); }
.mini-pct.down { color: var(--down); }

/* 指数行情快照头部 */
.idx-hero { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.idx-hero-price {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.02em;
}
.idx-hero-price.up { color: var(--up); }
.idx-hero-price.down { color: var(--down); }

/* ==========================================================================
   22. 搜索页
   规则见文件末尾「v16 · 搜索页（重做）」——旧类的样式已随页面重写一并移除。
   ========================================================================== */

/* ==========================================================================
   23. 账户页
   ========================================================================== */
.account-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.account-hero-main { display: flex; align-items: center; gap: 13px; min-width: 0; }
.profile-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel-3);
  color: var(--text-dim);
  font-size: 17px;
  font-weight: 600;
  flex: 0 0 auto;
}
.profile-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-name h2 { font-size: 15px !important; font-weight: 650 !important; letter-spacing: -0.01em; }
.profile-name-edit {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel);
  color: var(--muted);
  font-family: inherit;
  font-size: 10.5px;
  cursor: pointer;
}
.profile-name-edit:hover { border-color: var(--border-strong); background: var(--panel-2); color: var(--text); }
.profile-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 3px;
  font-size: 11px;
  color: var(--faint);
}
.dot-sep { color: var(--border-strong); }
.account-hero-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.account-status-text { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; }
.account-status-text.up { color: var(--text); }
.account-status-text.down { color: var(--danger); }
.account-hero-actions { display: flex; gap: 6px; margin-top: 4px; }
.account-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) { .account-grid { grid-template-columns: minmax(0, 1fr); } }
.account-kv { display: flex; flex-direction: column; margin-top: 10px; border-top: 1px solid var(--hairline); }
.account-kv .kv-row { padding: 8px 0; font-size: 12px; }
.card-mini-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.card-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel);
  color: var(--text-dim);
}
.card-mini:hover { border-color: var(--border-strong); background: var(--panel-2); color: var(--text); }
.card-mini-name { font-size: 11px; color: var(--muted); }
.card-mini-price { font-size: 15px; font-weight: 650; color: var(--text); }
.card-mini-days { font-size: 10px; color: var(--faint); }
.quick-links { display: flex; flex-direction: column; gap: 0; padding: 0 !important; }
.quick-link {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-bottom: 1px solid var(--hairline);
  border-radius: 0;
  background: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}
.quick-link:last-child { border-bottom: 0; }
.quick-link svg:first-child { color: var(--faint); flex: 0 0 auto; }
.quick-link svg:last-child { margin-left: auto; color: var(--faint); flex: 0 0 auto; }
.quick-link:hover { background: var(--panel-2); color: var(--text); }
.quick-link.danger-link { color: var(--danger); }
.quick-link.danger-link svg:first-child { color: var(--danger); }
.quick-link.danger-link:hover { background: color-mix(in srgb, var(--danger) 5%, transparent); }
.page-actions-center { display: flex; justify-content: center; padding: 10px 0; }

/* 卡密兑换：单行输入 + 按钮。
   .card-key-row 同时带 .form-field（默认 column），这里必须显式改回 row，
   否则其中的 flex-basis 260px 会被当作高度，把输入框拉成 260px 高。 */
.card-key-wrap { margin: 0; }
.card-key-body { display: flex; flex-direction: column; gap: 9px; width: 100%; }
.card-key-row {
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}
.card-key-row > .form-field {
  flex: 1 1 260px;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.card-key-row .form-input { height: 36px; flex: 0 0 auto; font-size: 13px; }
.card-key-message { font-size: 11.5px; line-height: 1.55; min-height: 0; }
.card-key-message.up { color: var(--down); }
.card-key-message.down,
.card-key-message.is-error { color: var(--danger); }
.card-key-submit { flex: 0 0 auto; padding-bottom: 0; }

/* ==========================================================================
   24. 订阅页
   ========================================================================== */
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .plan-grid { grid-template-columns: minmax(0, 1fr); } }
.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
  padding: 15px 15px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.13s, background 0.13s;
}
.plan-card:hover { border-color: var(--border-strong); background: var(--panel-2); }
/* 选中态：1px 边框已足够表达选中；
   之前的 inset 双层描边在手机上看起来像一条粗红框压住卡片 */
.plan-card.selected {
  border-color: var(--accent);
  background: var(--panel);
  box-shadow: none;
}
/* 推荐标：贴右上角的窄标签。卡片上内边距留出 22px 让它不压住卡种名 */
.plan-card { padding-top: 22px; }
.plan-flag {
  position: absolute;
  top: 0;
  left: 0;
  /* 用 inline-flex + 固定宽度内容，避免在 flex 父级里被拉伸成整条横栏
     （实测「推荐」被拉成 780px 宽的红条盖住卡种名） */
  display: inline-flex;
  align-items: center;
  width: auto;
  height: 16px;
  padding: 0 6px;
  border-radius: 6px 0 4px 0;
  background: var(--accent);
  color: var(--panel);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.02em;
  white-space: nowrap;
  pointer-events: none;
}
.plan-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-name { font-size: 12px; font-weight: 600; color: var(--muted); }
.plan-selected { font-size: 10.5px; font-weight: 600; color: var(--accent); }
.plan-price { display: flex; align-items: baseline; gap: 4px; margin-top: 3px; color: var(--text); }
.plan-price b {
  font-family: var(--font-mono);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.plan-price span { font-size: 11px; color: var(--faint); }
.plan-note { margin-top: 3px; font-size: 11px; color: var(--faint); line-height: 1.5; }
.pricing-loading { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 900px) { .pricing-loading { grid-template-columns: minmax(0, 1fr); } }

.benefit-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 20px; }
.benefit { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; color: var(--text-dim); line-height: 1.55; }
.benefit svg { flex: 0 0 auto; margin-top: 2px; color: var(--down); }

/* 结算条：不再是粉色渐变 sticky 条，改成纸面上的一块普通结算区 */
.purchase-bar {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  position: static;
}
.buy-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.buy-bar-info { flex: 1 1 auto; min-width: 0; font-size: 12.5px; color: var(--muted); }
.buy-bar-info b { font-weight: 650; color: var(--text); }
.buy-bar-price {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.purchase-unavailable {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--warn);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--warn) 4%, transparent);
  font-size: 12px;
  color: var(--text-dim);
}
.purchase-unavailable svg { flex: 0 0 auto; margin-top: 1px; color: var(--warn); }
.purchase-unavailable-title { font-weight: 650; color: var(--text); margin-bottom: 2px; }
.purchase-unavailable-desc { font-size: 11.5px; color: var(--muted); line-height: 1.55; }
.buy-dock { display: none; }
.subscription-footnote {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: 11px;
  color: var(--faint);
  line-height: 1.6;
}
.subscription-footnote svg { flex: 0 0 auto; margin-top: 1px; }
.pay-summary { display: flex; flex-direction: column; gap: 8px; }
.pay-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-size: 12.5px; }
.pay-row span { color: var(--muted); }
.pay-row b { font-family: var(--font-mono); font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.pay-total { border-top: 1px solid var(--hairline); padding-top: 8px; }
.pay-total b { font-size: 17px; color: var(--accent); }
.pay-tip { font-size: 11px; color: var(--faint); line-height: 1.6; }
.pay-error { font-size: 11.5px; color: var(--danger); min-height: 0; }

/* ==========================================================================
   25. 登录 / 注册页
   ========================================================================== */
.lg-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  min-height: calc(100vh - var(--topbar-h) - 60px);
  gap: 0;
  margin: -18px -24px -44px;
}
.lg-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  padding: 36px 40px;
  background: #14181d;
  /* 去掉旧版的红色径向晕与网格底纹：纸感终端不做装饰性背景 */
  background-image: none;
  color: #eef1f4;
  min-width: 0;
  overflow: hidden;
}
.lg-brand::before,
.lg-brand::after { display: none; }
.lg-brand-top { display: flex; align-items: center; gap: 8px; }
.lg-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  flex: 0 0 auto;
}
.lg-brand-name { font-size: 14px; font-weight: 700; letter-spacing: 0.01em; }
.lg-brand-kind {
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.4);
  text-transform: uppercase;
  padding-left: 8px;
  border-left: 1px solid rgba(255, 255, 255, 0.16);
}
.lg-brand-main { max-width: 460px; margin: 0; padding: 0; }
.lg-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: rgba(255, 255, 255, 0.42);
  text-transform: uppercase;
}
.lg-brand-main h1 {
  margin: 12px 0 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -0.02em;
  color: #fff;
}
/* 关键短语只改颜色，不再用红色下划线块（旧版在暗底上会出现红块伪影） */
.lg-brand h1 em {
  font-style: normal;
  color: #ff6b7d;
  background: none;
  padding: 0;
  margin: 0;
}
.lg-brand-sub {
  margin: 14px 0 0;
  font-size: 12.5px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.58);
  max-width: 380px;
}
/* 三级导轨：细竖线 + 时间轴式节点，当前层用红色填充 */
.lg-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 28px 0 0;
  padding-left: 20px;
  max-width: 380px;
}
.lg-rail::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 16px;
  bottom: 16px;
  width: 1px;
  background: rgba(255, 255, 255, 0.14);
}
.lg-tier {
  position: relative;
  padding: 11px 0;
  border-left: 0;
}
.lg-tier::before {
  content: "";
  position: absolute;
  left: -20px;
  top: 17px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #14181d;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: none;
}
.lg-tier.on::before {
  border-color: #ff6b7d;
  background: #ff6b7d;
  box-shadow: 0 0 0 3px rgba(255, 107, 125, 0.16);
}
.lg-tier-name { font-size: 12.5px; font-weight: 600; color: rgba(255, 255, 255, 0.8); }
.lg-tier.on .lg-tier-name { color: #fff; }
.lg-tier-note { margin-top: 2px; font-size: 11px; line-height: 1.5; color: rgba(255, 255, 255, 0.42); }

.lg-form-col {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 28px;
  background: var(--bg);
}
.lg-form-box { width: 100%; max-width: 340px; }
.lg-m-brand { display: none; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin-bottom: 22px; }
.lg-m-brand .lg-mark { background: var(--text); color: var(--panel); width: 26px; height: 26px; }
.lg-form-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--faint);
  text-transform: uppercase;
}
.lg-form-title { margin: 7px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.lg-form-sub { margin: 5px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }
.lg-form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; }
.lg-field { display: flex; flex-direction: column; gap: 5px; }
.lg-field > label { font-size: 11.5px; font-weight: 500; color: var(--muted); }
.lg-inp {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--panel);
  transition: border-color 0.13s, box-shadow 0.13s;
}
.lg-inp:focus-within { border-color: color-mix(in srgb, var(--accent) 50%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent); }
.lg-inp.bad { border-color: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 8%, transparent); }
.lg-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.lg-input::placeholder { color: var(--faint); opacity: 1; }
.lg-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 3px;
  background: none;
  color: var(--faint);
  cursor: pointer;
  flex: 0 0 auto;
}
.lg-eye:hover { background: var(--panel-3); color: var(--text-dim); }
.lg-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 18px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-3);
}
.lg-seg button {
  height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}
.lg-seg button.on { background: var(--panel); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--border); }
.lg-chk {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.lg-chk input { accent-color: var(--accent); width: 13px; height: 13px; margin: 0; }
.lg-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 42px;
  margin-top: 4px;
  border: 1px solid var(--text);
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--panel);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s;
}
.lg-submit:hover { background: color-mix(in srgb, var(--text) 82%, #000); }
.lg-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.lg-submit.busy { opacity: 0.75; }
.lg-err {
  display: none;
  padding: 8px 10px;
  border: 1px solid color-mix(in srgb, var(--danger) 24%, transparent);
  border-left: 2px solid var(--danger);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--danger) 5%, transparent);
  color: var(--danger);
  font-size: 11.5px;
  line-height: 1.55;
}
.lg-err.on { display: block; }
.lg-legal { margin: 14px 0 0; font-size: 10.5px; color: var(--faint); line-height: 1.6; }

/* ==========================================================================
   26. 通用小块
   ========================================================================== */
/* 键值行（账户订阅信息、抽屉等） */
.kv-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px;
}
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { color: var(--muted); flex: 0 0 auto; }
.kv-row .v { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 1px; background: var(--hairline); }
.kv-cell { padding: 9px 12px; background: var(--panel); }
.kv-cell .k { font-size: 10.5px; color: var(--faint); }
.kv-cell .v { font-family: var(--font-mono); font-size: 13px; font-weight: 600; }

/* 今日涨跌/额度等语义色文字块 */
.success-block {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border: 1px solid color-mix(in srgb, var(--down) 22%, transparent);
  border-left: 2px solid var(--down);
  border-radius: var(--radius-sm);
  background: var(--down-dim);
  font-size: 12px;
  color: var(--down);
}
.success-icon { display: inline-flex; color: var(--down); flex: 0 0 auto; }

/* 图表容器：纸面上不加边框，交给外层面板 */
.chart-panel .panel-body { padding: 10px 12px 8px; }
.chart-panel-body { padding: 10px 12px 8px; }
.chart-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-intraday { height: 300px; }
.chart-kline { height: 460px; }
.chart-flow { height: 240px; }
.intraday-datebar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }

/* 少行数的榜单页：让表格在宽屏上不显得空旷——行高随视口微增 */
@media (min-width: 1024px) {
  .stocks-page .data-table td,
  .market-content .data-table td { height: 40px; }
}

/* ==========================================================================
   27. 响应式
   ========================================================================== */
@media (max-width: 1180px) {
  /* 中等宽度仍保持 4 列（8 个指数两行），2 列只留给手机 */
  .idx-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
  /* 平板（底部导航区间）：8 个指数排 2 列太宽，4 列更紧凑 */
  .idx-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* 底部留白只由 .app 承担（body 的旧版 padding-bottom 会叠加成两倍空白） */
  body { padding-bottom: 0; }
  .site-footer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .app { padding: 14px 14px calc(76px + env(safe-area-inset-bottom)); }
  .page { gap: 10px; }
  .page { gap: 10px; }
  .topbar { height: 52px; }
  .topbar-inner { padding: 0 14px; gap: 10px; }
  .topbar-search-pill {
    width: auto;
    height: 30px;
    margin-left: 0;
    padding: 0 9px;
    gap: 0;
  }
  .topbar-search-text, .topbar-search-kbd { display: none; }
  .topbar-right { gap: 8px; }
  .status-capsule { max-width: 132px; overflow: hidden; text-overflow: ellipsis; }
  .page-title-row h1, .page-title-node { font-size: 17px; }
  .stock-name { font-size: 17px; }
  .stock-price .price { font-size: 23px; }
  .panel-body { padding: 12px; }
  .panel-head { padding: 8px 12px; min-height: 38px; }
  .page-head { align-items: flex-start; }
  .mood-body { flex-direction: column; align-items: stretch; gap: 12px; padding: 13px; }
  .mood-gauge-wrap { width: 100%; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; }
  .mood-gauge { width: 96px; height: 54px; }
  .mood-score { font-size: 18px; }
  .idx-card { padding: 10px 11px 9px; }
  .idx-card-price { font-size: 17px; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .home-grid > .home-tables { grid-template-columns: minmax(0, 1fr); }
  .welcome-break { display: none; }
  .stat-grid, .flow-cards, .quote-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lg-shell { grid-template-columns: minmax(0, 1fr); margin: -14px -14px calc(-76px - env(safe-area-inset-bottom)); min-height: auto; }
  .lg-brand { display: none; }
  .lg-form-col { padding: 26px 18px 40px; }
  .lg-m-brand { display: flex; }
  .lg-form-box { max-width: 100%; }
  .lg-inp { height: 46px; }
  .lg-submit { height: 46px; }
  .buy-dock {
    display: flex;
    align-items: center;
    gap: 10px;
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(54px + env(safe-area-inset-bottom));
    z-index: 64;
    padding: 9px 14px;
    background: color-mix(in srgb, var(--panel) 97%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
  }
  .buy-dock .buy-bar-info { flex: 1 1 auto; font-size: 11.5px; }
  .buy-dock .buy-bar-price { font-size: 15px; }
  .buy-dock .btn { flex: 0 0 auto; height: 38px; }
  .purchase-bar .buy-bar { display: none; }
  .subscription-page { padding-bottom: 64px; }
  .watch-row-main { grid-template-columns: minmax(0, 1fr) 82px 72px; column-gap: 8px; padding-left: 12px; }
  .watch-row-price { font-size: 13px; }
  .watch-row-pct { font-size: 12px; }
  .watch-remove-btn { width: 38px; height: 38px; }
  .toast-root { right: 12px; left: 12px; bottom: calc(70px + env(safe-area-inset-bottom)); align-items: stretch; }
  .toast { max-width: none; }
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal {
    max-width: 100%;
    max-height: 88vh;
    border-radius: 14px 14px 0 0;
    border-bottom: 0;
    animation: sheet-in 0.22s cubic-bezier(0.32, 0.72, 0, 1);
  }
  @keyframes sheet-in {
    from { transform: translateY(24px); }
    to { transform: none; }
  }
  .modal-head { padding: 12px 16px 10px; }
  .modal-head::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 3px;
    border-radius: 2px;
    background: var(--border-strong);
  }
  .modal-head { position: relative; padding-top: 18px; }
  .modal-body { padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); }
  .modal-actions { padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); }
  .drawer { width: 100vw; }
  .page-tabs .ptab { padding: 8px 10px 9px; }
  .quote-grid, .flow-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .account-hero { flex-direction: column; align-items: flex-start; }
  .account-hero-side { align-items: flex-start; text-align: left; }
  .plan-grid { grid-template-columns: minmax(0, 1fr); }
  .pricing-loading { grid-template-columns: minmax(0, 1fr); }
  .benefit-list { grid-template-columns: minmax(0, 1fr); }
  .search-page { max-width: none; }
  .stock-price { gap: 7px; }
}

@media (max-width: 560px) {
  .app { padding: 12px 12px calc(74px + env(safe-area-inset-bottom)); }
  .topbar-inner { padding: 0 12px; }
  .topbar-search-pill { display: none; }
  .brand-text strong { font-size: 14px; }
  .status-capsule { height: 26px; padding: 0 9px; font-size: 11px; max-width: 118px; }
  .topbar-avatar { width: 26px; height: 26px; }
  .page-title-row h1, .page-title-node { font-size: 16px; }
  .panel-title { font-size: 12px; }
  .panel-title small { max-width: 130px; }
  .quote-grid, .flow-cards, .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quote-grid .quote-cell { padding: 8px 10px; }
  .quote-grid .quote-cell .v { font-size: 12.5px; }
  .flow-card .v { font-size: 14px; }
  .idx-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mood-chips { gap: 5px; }
  .mood-chip { font-size: 10.5px; height: 21px; padding: 0 7px; }
  .breadth-legend { gap: 11px; font-size: 11px; }
  .data-table { font-size: 12px; }
  .data-table th { padding: 7px 9px; }
  .data-table td { padding: 0 9px; height: 36px; }
  .data-table .sym .nm { max-width: 104px; }
  .watch-row-main { grid-template-columns: minmax(0, 1fr) 74px 66px; column-gap: 6px; padding: 8px 0 8px 11px; }
  .watch-row-sub { gap: 10px; font-size: 10px; }
  .hot-chip { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; min-height: 34px; }
  .hot-chip-leader { display: none; }
  .search-bar { height: 42px; }
  .idx-hero-price { font-size: 26px; }
  .stock-price .price { font-size: 21px; }
  .stock-price .chg, .stock-price .pct { font-size: 12px; }
  .buy-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .buy-bar .btn { width: 100%; }
  .account-hero { padding: 13px 14px; }
  .sector-name, .sector-pct { font-size: 17px; }
}

@media (max-width: 420px) {
  .app { padding: 10px 10px calc(72px + env(safe-area-inset-bottom)); }
  .topbar-inner { padding: 0 10px; }
  .panel-body { padding: 11px; }
  .panel-head { padding: 8px 11px; }
  .idx-card { padding: 9px 10px 8px; }
  .idx-card-price { font-size: 16px; }
  .watch-row-main { grid-template-columns: minmax(0, 1fr) 68px 62px; padding-left: 10px; }
}

@media (max-width: 560px) {
  /* 小屏：8 个指数压成 2 列会让单格太窄，改 2 列 × 4 行但不留空白 */
  .idx-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .idx-card { width: auto; min-width: 0; }
}

/* 触屏：去掉 hover 依赖，保留按压反馈 */
@media (hover: none) {
  .data-table tbody tr:hover { background: transparent; }
  .data-table tbody tr.clickable:hover { background: transparent; }
  .idx-card:hover { background: var(--panel); }
  .plan-card:hover { border-color: var(--border); background: var(--panel); }
  .watch-row:hover { background: transparent; }
  .hot-chip:hover { background: transparent; }
  .btn:hover { color: var(--text-dim); border-color: var(--border-strong); background: var(--panel); }
  .btn:active { background: var(--panel-3); }
  .btn.primary:hover { background: var(--accent); }
  .btn.primary:active { background: var(--accent-deep); }
}

/* ==========================================================================
   v15 · 端差异化交互
   原则：PC 用 hover / 键盘 / 折叠提高密度；移动端用触控手势、拇指可达区、
        卡片化降级替代横向滚动。输入方式以 <html data-input> 为准，
        比单纯宽度断点更准（触屏笔记本按触控处理）。
   ========================================================================== */

/* ---------- 1. 交互反馈基线：所有可点元素都有 hover 与 press ---------- */
:root {
  --tap-min: 44px;        /* 移动端触控目标下限（iOS HIG / Material 48dp 折中） */
  --tap-min-dense: 36px;  /* 数据密集区下限 */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
}

button,
a,
[role='tab'],
[role='button'] {
  -webkit-tap-highlight-color: transparent;
}

/* 按下态：轻微下沉 + 变暗，比颜色变化更接近物理反馈 */
.btn:active,
.tab:active,
.seg button:active,
.page-tabs .ptab:active,
.sidebar-link:active,
.bottom-nav-item:active,
.quick-link:active,
.plan-card:active,
.watch-hot-chip:active,
.star-btn:active,
.watch-remove-btn:active {
  transform: translateY(1px);
  transition-duration: 0.05s;
}
@media (prefers-reduced-motion: reduce) {
  .btn:active,
  .tab:active,
  .seg button:active,
  .sidebar-link:active,
  .bottom-nav-item:active,
  .quick-link:active,
  .plan-card:active,
  .watch-hot-chip:active,
  .star-btn:active,
  .watch-remove-btn:active {
    transform: none;
  }
}

/* 键盘焦点：统一 2px 环，且不依赖 hover 才可见 */
a:focus-visible,
button:focus-visible,
[role='tab']:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* 可点击表格行：PC 有 hover 指示 + 右侧箭头暗示可进 */
@media (hover: hover) {
  .data-table tbody tr.clickable { position: relative; }
  .data-table tbody tr.clickable td:last-child::after {
    content: '›';
    display: inline-block;
    margin-left: 8px;
    color: var(--border-strong);
    transition: transform 0.14s var(--ease-out), color 0.14s;
  }
  .data-table tbody tr.clickable:hover td:last-child::after {
    color: var(--accent);
    transform: translateX(2px);
  }
}

/* ---------- 2. PC：侧栏可折叠为图标轨（提升数据区宽度） ---------- */
.sidebar-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 12px;
}
.sidebar-head .sidebar-brand { padding: 2px 8px 0; flex: 1 1 auto; min-width: 0; }
.sidebar-collapse {
  display: none;
}
@media (min-width: 1024px) {
  .sidebar-collapse {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    margin-left: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--panel);
    color: var(--faint);
    cursor: pointer;
    flex: 0 0 auto;
  }
  .sidebar-collapse:hover { background: var(--panel-3); color: var(--text); border-color: var(--border-strong); }

  /* 折叠态：只留图标，标签隐藏；把侧栏宽度收窄到 60px */
  html[data-rail='on'] { --sidebar-w: 62px; }
  html[data-rail='on'] .sidebar { padding-left: 8px; padding-right: 8px; }
  html[data-rail='on'] .sidebar-brand-name,
  html[data-rail='on'] .sidebar-group,
  html[data-rail='on'] .sidebar-link-text,
  html[data-rail='on'] .sub-card,
  html[data-rail='on'] .sidebar-head { justify-content: center; padding-bottom: 6px; }
  html[data-rail='on'] .sidebar-head .sidebar-brand {
    display: flex;
    justify-content: center;
    padding: 0;
    flex: 0 0 auto;
  }
  html[data-rail='on'] .sidebar-head .brand-mark { width: 26px; height: 26px; }
  html[data-rail='on'] .sidebar-collapse { margin: 0 auto; }
  html[data-rail='on'] .sidebar-link {
    justify-content: center;
    padding: 0;
    height: 36px;
  }
  html[data-rail='on'] .sidebar-link svg { width: 17px; height: 17px; }
  /* 折叠态用 title 气泡代替文字标签 */
  html[data-rail='on'] .sidebar-link[data-label]::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%) translateX(-4px);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: var(--text);
    color: var(--panel);
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s, transform 0.12s;
    z-index: 70;
  }
  html[data-rail='on'] .sidebar-link:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
  }
  html[data-rail='on'] .sidebar-group-block { margin-bottom: 2px; }
  html[data-rail='on'] .sidebar-group-block + .sidebar-group-block {
    border-top: 1px solid var(--hairline);
    padding-top: 6px;
    margin-top: 4px;
  }
  /* 折叠态隐藏激活竖条左侧留白，改为整块浅红底 */
  html[data-rail='on'] .sidebar-link.active::before { display: none; }
  /* 侧栏折叠后主区变宽，内容上限跟着放宽 */
  html[data-rail='on'] .app { max-width: none; }
}

/* ---------- 3. 移动端：触控尺寸与拇指可达区 ---------- */
@media (max-width: 1023px) {
  /* 触控目标：常规控件 44px，数据密集区不低于 36px */
  .btn { min-height: var(--tap-min); }
  .btn.sm { min-height: var(--tap-min-dense); }
  .tab { min-height: var(--tap-min-dense); padding: 0 13px; }
  .seg button { min-height: var(--tap-min-dense); }
  .page-tabs .ptab { min-height: var(--tap-min); display: inline-flex; align-items: center; }
  .form-input,
  .form-select { height: var(--tap-min); }
  .star-btn { width: var(--tap-min); height: var(--tap-min); }
  .watch-remove-btn { width: var(--tap-min); height: var(--tap-min); }
  .quick-link { min-height: 48px; }
  .bottom-nav-item { min-height: var(--tap-min); }

  /* 分段控件横向滑动，不换行挤压 */
  .seg,
  .tabs {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .seg::-webkit-scrollbar,
  .tabs::-webkit-scrollbar { display: none; }
  .seg button,
  .tab { flex: 0 0 auto; }

  /* 页头操作区：主操作占满宽度，符合右手拇指区；单个按钮时不拉满 */
  .page-head { align-items: flex-start; }
  .head-actions { width: 100%; justify-content: flex-start; }
  .head-actions > .btn { flex: 0 0 auto; }
  /* 账户页：卡内已有「续费」，页头只保留购买入口，避免同一动作两个按钮 */
  body[data-page='account'] .page-head .head-actions { display: none; }

  /* 底部固定主操作条（购买 / 保存等），位于底栏之上 */
  .thumb-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(54px + env(safe-area-inset-bottom));
    z-index: 63;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    background: color-mix(in srgb, var(--panel) 97%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    transform: translateY(0);
    transition: transform 0.2s var(--ease-out);
  }
  .thumb-bar[hidden] { display: none; }
  .thumb-bar .thumb-bar-info { flex: 1 1 auto; min-width: 0; font-size: 11.5px; color: var(--muted); }
  .thumb-bar .btn { flex: 0 0 auto; min-width: 128px; }
}

/* ---------- 4. 移动端：宽表格降级为「主信息行」 ----------
   在 390px 里排 4 个以上字段，无论怎么调列宽都会有一项被挤到下一行。
   所以明确分两层：
     第 1 行（flex，不换行）= 名次 + 名称 + 主数值
     第 2 行（独立块）= 次要字段，横向排列，空间不足时省略
   HTML 结构不变，靠 CSS 把次列「视觉上」收到第二行。 */
@media (max-width: 767px) {
  .table-to-cards .table-wrap,
  .table-to-cards.table-wrap { overflow: visible; max-height: none; }

  .table-to-cards .data-table thead { display: none; }
  .table-to-cards .data-table,
  .table-to-cards .data-table tbody { display: block; width: 100%; }

  /* 行 = 卡片：整体 block，内部再由两个子层控制 */
  .table-to-cards .data-table tbody tr {
    display: block;
    position: relative;
    padding: 11px 12px 10px;
    border-bottom: 1px solid var(--hairline);
    background: var(--panel);
  }
  .table-to-cards .data-table tbody tr:last-child { border-bottom: 0; }

  .table-to-cards .data-table td {
    display: block;
    height: auto;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
    font-size: 12px;
  }

  /* —— 第 1 行：名次 + 名称，绝对固定的左右关系 —— */
  .table-to-cards .data-table td:nth-child(1) {
    display: inline-block;
    width: 18px;
    vertical-align: top;
    font-size: 10.5px;
    line-height: 22px;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
  }
  .table-to-cards .data-table td:nth-child(2) {
    display: inline-block;
    width: calc(100% - 152px);
    vertical-align: top;
    margin-left: 4px;
  }
  .table-to-cards .data-table .sym { gap: 0; min-width: 0; }
  .table-to-cards .data-table .sym .nm {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 22px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .table-to-cards .data-table .sym .cd { font-size: 10.5px; color: var(--faint); }

  /* 主数值：固定在右上，与名称同一行 */
  .table-to-cards .data-table td[data-mobile='primary'] {
    display: inline-block;
    width: 130px;
    vertical-align: top;
    text-align: right;
    font-size: 14px;
    font-weight: 650;
    line-height: 22px;
    font-variant-numeric: tabular-nums;
  }

  /* —— 第 2 行：次列独立成行，缩进到名称下方 —— */
  .table-to-cards .data-table td[data-mobile='secondary'] {
    display: inline;
    font-size: 11px;
    color: var(--faint);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }
  /* 用第一个次列之前的块级断行把整组推到下一行 */
  .table-to-cards .data-table td[data-mobile='primary'] + td[data-mobile='secondary']::before {
    content: '';
    display: block;
  }
  /* 只保留前 2 个次列，其余进详情页（390px 放不下） */
  .table-to-cards .data-table td:nth-child(n + 6) { display: none; }
  .table-to-cards .data-table td[data-mobile='secondary'] + td[data-mobile='secondary']::before {
    content: ' · ';
    color: var(--border-strong);
  }

  .table-to-cards .data-table td[data-mobile='hide'],
  .table-to-cards .data-table th[data-mobile='hide'] { display: none !important; }
  .table-to-cards .data-table td[data-empty='1'] { display: none; }

  .table-to-cards .data-table tbody tr.clickable td:last-child::after { display: none; }

  /* 解除旧版宽表横滑假设 */
  .table-to-cards .data-table,
  .table-to-cards table,
  .table-to-cards .data-table tbody,
  .table-to-cards .data-table tbody tr { min-width: 0; width: 100%; max-width: 100%; }
  .table-to-cards .data-table th:first-child,
  .table-to-cards .data-table td:first-child {
    position: static;
    box-shadow: none;
    background: transparent;
  }
  .table-to-cards::after,
  .table-to-cards .table-wrap::after { display: none; }
}

/* ---------- 5. 移动端左滑露出操作 ---------- */
.swipe-row {
  position: relative;
  overflow: hidden;
}
.swipe-row > .swipe-track {
  position: relative;
  z-index: 1;
  background: var(--panel);
  will-change: transform;
  touch-action: pan-y;
}
.swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: stretch;
  z-index: 0;
  width: var(--reveal, 0px);
  overflow: hidden;
  transition: width 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.swipe-action {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 76px;
  flex: 0 0 auto;
  border: 0;
  background: var(--danger);
  color: var(--panel);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}
.swipe-action:active { background: color-mix(in srgb, var(--danger) 82%, #000); }
@media (hover: hover) {
  /* PC 永远不显示滑出按钮：用行尾图标按钮 */
  .swipe-actions { display: none; }
}

/* ---------- 6. 下拉刷新指示器（仅触屏） ---------- */
.ptr {
  position: fixed;
  left: 50%;
  top: 0;
  z-index: 88;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  box-shadow: 0 6px 18px rgba(15, 22, 32, 0.1);
  transform: translate3d(-50%, -120%, 0);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}
.ptr-spin {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
}
.ptr[data-state='ready'] { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.ptr[data-state='busy'] .ptr-spin { animation: spin 0.7s linear infinite; }
.ptr[data-state='done'] { color: var(--down); border-color: color-mix(in srgb, var(--down) 30%, transparent); }
.ptr[data-state='done'] .ptr-spin { border-color: var(--down); }
@media (prefers-reduced-motion: reduce) {
  .ptr[data-state='busy'] .ptr-spin { animation-duration: 2s; }
}

/* ---------- 7. 移动端详情页：内容优先，头部可折叠 ---------- */
@media (max-width: 1023px) {
  /* 个股 / 板块详情：价格头随滚动折叠为一条紧凑条，给图表腾出高度 */
  .sticky-quote-bar {
    position: sticky;
    top: 0;
    z-index: 55;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: -14px -14px 0;
    padding: 8px 14px;
    background: color-mix(in srgb, var(--panel) 95%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    transform: translateY(0);
    transition: transform 0.2s var(--ease-out);
  }
  .sticky-quote-bar .sqb-name { font-size: 12.5px; font-weight: 650; white-space: nowrap; }
  .sticky-quote-bar .sqb-price {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
  }
  .sticky-quote-bar .sqb-pct {
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 600;
    margin-left: auto;
  }
  /* 图表页：给图例/工具条留出粘性偏移 */
  .sticky-quote-bar + .page-tabs { position: sticky; top: 42px; z-index: 54; background: var(--bg); }
}

/* ---------- 8. 移动端「回到顶部 / 快速刷新」浮动按钮 ---------- */
.fab-stack {
  position: fixed;
  right: 14px;
  bottom: calc(70px + env(safe-area-inset-bottom));
  z-index: 62;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.fab-stack .fab {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: color-mix(in srgb, var(--panel) 96%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--text-dim);
  box-shadow: 0 4px 14px rgba(15, 22, 32, 0.12);
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.18s, transform 0.18s var(--ease-out);
}
.fab-stack .fab.is-shown { opacity: 1; transform: none; }
.fab-stack .fab:active { transform: scale(0.94); }
@media (min-width: 1024px) {
  .fab-stack { display: none; }
}

/* ---------- 9. 横向滚动可供性（移动端） ---------- */
@media (max-width: 1023px) {
  .scroll-hint {
    position: relative;
  }
  .scroll-hint::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 26px;
    background: linear-gradient(to right, transparent, var(--panel));
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.2s;
  }
  .scroll-hint.is-end::after { opacity: 0; }
}

/* ---------- 10. 键盘用户：跳转到主内容 ---------- */
.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 200;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--text);
  color: var(--panel);
  font-size: 12.5px;
  font-weight: 600;
  transition: top 0.15s var(--ease-out);
}
.skip-link:focus {
  top: 8px;
  color: var(--panel);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 11. 交易时段提示：让用户知道数据是否在跳 ---------- */
.session-flag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 500;
  white-space: nowrap;
}
.session-flag i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--flat);
  flex: 0 0 auto;
}
.session-flag.open i { background: var(--up); box-shadow: 0 0 0 2.5px var(--up-dim); animation: live-pulse 2.4s ease-in-out infinite; }
.session-flag.closed i { background: var(--faint); }
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 2.5px var(--up-dim); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--up) 5%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .session-flag.open i { animation: none; }
}

/* ---------- 12. 自选页：排序工具栏 + 滑动轨道 ---------- */
.watch-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.watch-toolbar-hint {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--faint);
  white-space: nowrap;
}

/* 行结构：.swipe-row > .swipe-track（内容）+ .swipe-actions（滑出的删除区）
   滑开时轨道整体左移，因此左内边距要足够小，让名称文字仍完整可见 */

.watch-row {
  position: relative;
  overflow: hidden;
  display: block;
  /* 内边距只能由 .swipe-track / .watch-row-main 承担：
     行级 padding 会让滑出的删除区与内容错位（旧版 v6 段有 padding:10px 12px） */
  padding: 0;
  margin: 0;
  gap: 0;
  border-bottom: 1px solid var(--hairline);
}
.watch-row:last-child { border-bottom: 0; }
/* 轨道占满整行；右侧按 --reveal 让出空间，删除按钮从底下滑入。
   内容不位移，所以左侧名称永远完整可见。 */
.watch-row > .swipe-track {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  padding-right: var(--reveal, 0px);
  min-height: 100%;
  background: var(--panel);
  transition: padding-right 0.2s cubic-bezier(0.32, 0.72, 0, 1);
}
.watch-row:hover > .swipe-track { background: var(--panel-2); }
.watch-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px 84px;
  grid-template-areas:
    "name price pct"
    "sub  sub   sub";
  align-items: center;
  column-gap: 10px;
  row-gap: 3px;
  padding: 9px 2px 9px 14px;
  color: inherit;
}
.watch-row-main:hover { color: inherit; }
.watch-row-actions {
  display: flex;
  align-items: center;
  padding-right: 8px;
  flex: 0 0 auto;
}
/* 移动端：左滑删除是主交互，行尾按钮作为保底保留。
   不能 display:none —— 那会让删除操作从键盘与读屏用户的路径上消失，
   也让触控目标尺寸无法被验收。保持 44px 可见目标即可。 */
@media (max-width: 1023px) {
  .watch-row-actions { padding-right: 2px; }
  .watch-row-actions .watch-remove-btn {
    width: var(--tap-min);
    height: var(--tap-min);
    color: var(--faint);
  }
  .watch-row > .swipe-actions { display: flex; }
}
@media (hover: hover) and (min-width: 1024px) {
  /* PC：hover 时删除按钮才显色，平时保持安静 */
  .watch-row .watch-remove-btn { color: var(--faint); }
  .watch-row:hover .watch-remove-btn { color: var(--muted); }
}

/* ---------- 13. 卡片模式必须解除旧版的「宽表横向滚动」假设 ----------
   styles.css 在 ≤768px 给 .table-scroll table 设了 min-width:560px，
   并给首列加 position:sticky —— 那是「横滑读表」方案的前提。
   卡片模式下这两条都会让行宽超出视口（实测 560px 宽的行被裁到 390px），
   所以在此显式撤销。 */
@media (max-width: 767px) {
  .table-to-cards.table-scroll,
  .table-to-cards .table-scroll {
    overflow-x: visible;
    max-height: none;
  }
  .table-to-cards .data-table,
  .table-to-cards table,
  .table-to-cards .data-table tbody,
  .table-to-cards .data-table tbody tr {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }
  .table-to-cards .data-table th:first-child,
  .table-to-cards .data-table td:first-child {
    position: static;
    box-shadow: none;
    background: transparent;
  }
  /* 旧版给表格容器右缘加的渐隐遮罩在卡片模式下没有意义 */
  .table-to-cards::after,
  .table-to-cards .table-wrap::after { display: none; }
  /* 列宽百分比规则（PC 的 34% / 40%）在卡片模式失效 */
  .table-to-cards .data-table td:nth-child(2),
  .table-to-cards .data-table th:nth-child(2) { width: auto; }
}

/* 卡片行里，值为空（-- / - / 空串）的次列不显示：
   「成交额 --」这类占位在窄屏只会挤掉真正有信息的字段。
   用 :empty 无法覆盖只含 "--" 的情况，改由 JS 打 data-empty 标记 */
@media (max-width: 767px) {
  .table-to-cards .data-table td[data-empty='1'] { display: none; }
}

/* 滑开时右侧让出 76px：价格/涨跌幅列收窄，避免与删除按钮重叠 */
.watch-row.is-open .watch-row-main {
  grid-template-columns: minmax(0, 1fr) 68px 62px;
  padding-right: 6px;
}
@media (max-width: 560px) {
  .watch-row.is-open .watch-row-main { grid-template-columns: minmax(0, 1fr) 62px 58px; }
}

/* ==========================================================================
   v16 · 搜索页（重做）
   旧版问题：手机屏上显示「↑↓ Enter Esc」键盘提示、输入框内边距按桌面留白、
   热门标的全挤成 2 列 chip、空态白板撑满下半屏、结果行没有价格。
   ========================================================================== */
.search-page {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
  margin: 0 auto;
}

/* ---------- 搜索框 ---------- */
.search-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 44px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color 0.13s, box-shadow 0.13s;
}
.search-bar:focus-within {
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 8%, transparent);
}
.search-bar-icon {
  display: inline-flex;
  flex: 0 0 auto;
  color: var(--faint);
}
.search-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  /* 旧版沿用桌面的左右 42px/40px 内边距（给图标和清除按钮留位），
     在 390px 宽屏上把可用输入区压到不足 280px */
  padding: 0;
}
.search-input::placeholder { color: var(--faint); opacity: 1; }
.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 3px;
  background: var(--panel-3);
  color: var(--muted);
  cursor: pointer;
  flex: 0 0 auto;
}
.search-clear:hover { background: var(--border); color: var(--text); }
.search-clear[hidden] { display: none; }

/* ---------- 状态行 ---------- */
.search-status[hidden] { display: none; }
.search-status-text {
  display: inline-block;
  font-size: 11px;
  color: var(--faint);
}
.search-status-text.warn { color: var(--danger); }

/* ---------- 结果列表 ---------- */
.search-panel { display: flex; flex-direction: column; gap: 12px; }
.search-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.search-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--hairline);
}
.search-row:last-child { border-bottom: 0; }
.search-row.is-active { background: var(--panel-2); }
.search-row-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 4px 10px 14px;
  color: inherit;
}
.search-row-main:hover { color: inherit; }
.search-row-ident {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.search-row-name {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-row-code {
  font-size: 10.5px;
  color: var(--faint);
}
/* 价格与涨跌幅：搜索时就能判断，不必点进去 */
.search-row-quote {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
  font-variant-numeric: tabular-nums;
}
.search-row-price { font-size: 13.5px; font-weight: 600; }
.search-row-pct { font-size: 11px; font-weight: 600; }
.search-row-price.up, .search-row-pct.up { color: var(--up); }
.search-row-price.down, .search-row-pct.down { color: var(--down); }
.search-row-price.flat, .search-row-pct.flat { color: var(--text-dim); }
.search-row-board {
  flex: 0 0 auto;
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--faint);
  font-size: 10px;
}
.search-row-star {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  flex: 0 0 44px;
  border: 0;
  background: none;
  color: var(--faint);
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
}
.search-row-star:hover { color: var(--text-dim); background: var(--panel-3); }
.search-row-star.is-on { color: var(--accent); }

/* ---------- 空态：最近查看 / 热门标的 ---------- */
.search-block {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}
.search-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.search-block-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 650;
  color: var(--text-dim);
}
.search-block-clear {
  border: 0;
  background: none;
  color: var(--faint);
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 2px;
}
.search-block-clear:hover { color: var(--danger); }
.search-picks { display: flex; flex-direction: column; }
/* 行式而不是 chip：整行可点，拇指命中率高，也省纵向空间 */
.search-pick {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 0 14px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text-dim);
}
.search-pick:last-child { border-bottom: 0; }
.search-pick:hover { background: var(--panel-2); color: var(--text); }
.search-pick:active { background: var(--panel-3); }
.search-pick-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-pick-code { flex: 0 0 auto; font-size: 10.5px; color: var(--faint); }
.search-pick svg { flex: 0 0 auto; color: var(--faint); }

/* PC 键盘提示：只在精细指针下出现 */
.search-kbd-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin: 0;
  font-size: 10.5px;
  color: var(--faint);
}
.search-kbd-hint kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel-3);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}
@media (pointer: coarse) {
  .search-kbd-hint { display: none; }
}

/* ---------- 空结果 ---------- */
.search-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 36px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
}
.search-empty-title { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.search-empty-desc { font-size: 11.5px; color: var(--faint); }

/* ---------- 移动端：再压一档 ---------- */
@media (max-width: 560px) {
  .search-page { gap: 10px; }
  .search-bar { height: 42px; }
  .search-input { font-size: 15px; } /* ≥16px 会阻止 iOS 聚焦缩放，这里取 15 保持紧凑 */
  .search-row-main { min-height: 58px; padding: 9px 2px 9px 12px; gap: 10px; }
  .search-row-name { font-size: 14px; }
  .search-row-price { font-size: 14px; }
  .search-row-pct { font-size: 11.5px; }
  .search-pick { min-height: 48px; padding: 0 12px; }
  .search-block-head { padding: 8px 12px; }
}

/* ==========================================================================
   v17 · 移动端图表尺寸
   手机上一屏 844px，图表 460px 会把工具条和结论都挤出可视区。
   高度按「一屏能同时看到标题 + 完整图 + 一段上下文」重新定。
   ========================================================================== */
@media (max-width: 1023px) {
  .chart-kline { height: 340px; }
  .chart-intraday { height: 240px; }
  .chart-flow { height: 200px; }
  .chart-flow-rank { height: 320px; }
  .chart-flow-compare { height: 210px; }
  .chart-flow-compare-sm { height: 170px; }
  /* 图表容器左右内边距收紧，把宽度让给数据 */
  .chart-panel .panel-body,
  .chart-panel-body { padding: 8px 6px 4px; }
}

/* ---------- v17：列表「加载更多」 ---------- */
.list-more {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-top: 1px solid var(--hairline);
  background: var(--panel-2);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.list-more:hover { background: var(--panel-3); color: var(--text); }
.list-more:active { background: var(--border); }

/* ==========================================================================
   v17 · 移动端触控目标收口
   分两类处理，不一刀切：
   1. 独立控件（顶栏按钮、图标按钮）→ 必须 ≥44px
   2. 表格行内链接（板块名 / 龙头股）→ 保持文本尺寸，但把点击热区纵向撑满整行，
      既满足可点性，又不破坏数据密度
   ========================================================================== */
@media (max-width: 1023px) {
  /* 顶栏：三个可点元素统一 44px 触控高度 */
  .topbar-avatar {
    width: 44px;
    height: 44px;
    margin-right: -10px;
  }
  .status-capsule {
    height: 32px;
    padding: 0 11px;
  }
  .brand {
    min-height: 44px;
  }
  .brand-mark { width: 30px; height: 30px; }

  /* 行内链接：加一层伪元素把热区撑到整行高（不改变视觉与布局） */
  .data-table td .nm,
  .data-table td .leader-link,
  .search-row-main,
  .search-pick {
    position: relative;
  }
  .data-table td .nm::after,
  .data-table td .leader-link::after {
    content: '';
    position: absolute;
    inset: -12px -6px;
  }
  /* 同一行两个链接时，右侧的优先，避免热区互相覆盖 */
  .data-table td .leader-link::after { inset: -12px -4px -12px 0; }
}

/* 卡片模式下整行已是点击区，行内链接不再扩容，防止误触 */
@media (max-width: 767px) {
  .table-to-cards .data-table td .nm::after,
  .table-to-cards .data-table td .leader-link::after { display: none; }
}

/* ==========================================================================
   v17 · 首页（移动端）
   8 个指数换成 4 行 × 2 列 = 390px；榜单双表各 10 行 = 1100px。
   手机上这两块占了 4 屏里的 2.5 屏，而它们都是「点进去看更多」的摘要。
   ========================================================================== */
@media (max-width: 1023px) {
  /* 指数：一行横滑，每张 132px。一眼看到 3 个，滑动看其余，
     比堆 4 行更符合「先扫一眼大盘」的用法 */
  .idx-strip {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 1px;
  }
  .idx-strip::-webkit-scrollbar { display: none; }
  /* 卡宽按「容器宽 / 2.3」计算：让第 3 张露出 30% 作为可滑动的视觉提示，
     而不是卡在正中间被切成一半（那更像渲染错误）。 */
  .idx-card {
    flex: 0 0 calc((100% - 2px) / 2.3);
    width: calc((100% - 2px) / 2.3);
    min-width: 120px;
    scroll-snap-align: start;
    gap: 3px;
    padding: 10px 10px 8px;
  }
  .idx-card .pct-chip {
    min-width: 0;
    height: 19px;
    padding: 0 5px;
    font-size: 11px;
  }
  .idx-card-amt { display: none; }
  /* 右缘渐隐：提示还能往右滑 */
  .idx-strip-block { position: relative; }
  .idx-strip-block::after {
    content: '';
    position: absolute;
    top: 38px;
    right: 0;
    bottom: 0;
    width: 28px;
    background: linear-gradient(to right, transparent, var(--panel));
    pointer-events: none;
  }

  /* 榜单：移动端每张只显示前 6 行，其余进「查看全部」 */
  .home-tables .data-table tbody tr:nth-child(n + 7) { display: none; }
  /* 热点板块与资金榜：各显示前 6 条 */
  .hot-chips .hot-chip:nth-child(n + 7) { display: none; }
}


/* ---------- v17：情绪带在移动端更紧凑 ----------
   原布局：仪表 96px + 结论两行 + 分布条 + legend + 3 个 chip ≈ 400px。
   手机上这是首屏最大的一块，压到 ~250px 让指数与热点能进首屏。 */
@media (max-width: 1023px) {
  .mood-body { padding: 12px 13px; gap: 10px; }
  .mood-gauge-wrap { gap: 6px; }
  .mood-gauge { width: 84px; height: 48px; }
  .mood-score { font-size: 16px; }
  .mood-unit { font-size: 9px; }
  .mood-conclusion { font-size: 12.5px; line-height: 1.5; }
  .mood-detail { gap: 7px; }
  .breadth-legend { gap: 12px; font-size: 11px; }
  /* 三个 chip 并成一行紧凑读数 */
  .mood-chips { gap: 6px; }
  .mood-chip { height: 22px; font-size: 10.5px; padding: 0 7px; }
  /* 结论块的「结论」角标在窄屏上占一行宽度，改为内联前缀 */
  .mood-conclusion-mark { height: 16px; line-height: 14px; font-size: 9px; }
}

/* ---------- v17：移动端字号下限 11px ----------
   审计发现 5 个页面存在 10.5px 正文。这里统一提到底线，
   但不改 PC —— 桌面密度依赖这些小字号。 */
@media (max-width: 1023px) {
  .idx-card-name,
  .panel-title small,
  .meta-chip,
  .watch-row-sub,
  .flow-card .s,
  .stat-sub,
  .data-table th,
  .search-row-code,
  .search-pick-code,
  .table-note,
  .subscription-footnote,
  .quick-link,
  .site-footer { font-size: 11px; }
  /* 表格里的小字（名次/代码）仍保持 10.5：它们是装饰性序号，不是正文 */
  .data-table .rank,
  .data-table .sym .cd { font-size: 10.5px; }
}

/* ---------- v17：资金流「自选板块资金流对比」的 picker ----------
   移动端 30+ 个 chip 平铺 ≈ 900px，把页面拉到 3.5 屏。
   改为横向滑动一行 + 渐隐，点选行为不变。 */
@media (max-width: 1023px) {
  .flow-picker {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 4px;
    margin-bottom: 8px;
  }
  .flow-picker::-webkit-scrollbar { display: none; }
  .flow-pick-chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }
  .flow-pick-clear { flex: 0 0 auto; }
  /* picker 之外的热点/图例块同样横滑，避免再占一屏 */
  .ffv8-legend-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .ffv8-legend-row::-webkit-scrollbar { display: none; }
}

/* ---------- v17：情绪带与卡片行的字号补丁 ----------
   审计确认这几处是「正文级信息」而非装饰：
   • /100 与档位标签（用户判断冷热程度）
   • 结论角标（语义标记）
   • 涨跌榜卡片行里的价格与成交额（第二行关键数值）
   统一提到 11px 以上。 */
@media (max-width: 1023px) {
  .mood-unit { font-size: 11px; }
  .mood-label { font-size: 11px; height: 20px; }
  .mood-conclusion-mark { font-size: 10px; height: 17px; line-height: 15px; }
  .mood-chip { font-size: 11px; }
  /* 卡片行：次列（价格/成交额/占比）从 10.5 提到 11.5 */
  .table-to-cards .data-table td[data-mobile='secondary'] { font-size: 11.5px; }
  .table-to-cards .data-table td[data-mobile='primary'] { font-size: 14px; }
  /* 代码行保持 10.5（装饰性标识），但提高对比度以补偿 */
  .table-to-cards .data-table .sym .cd { color: var(--muted); }
}

/* v17：个股行情页的「看 K 线 / 看资金流」与页内 Tab 重复，移动端隐藏 */
@media (max-width: 1023px) {
  .quote-jump { display: none; }
}

/* v17：行情快照的「更多项」折叠 */
.quote-more { margin-top: 10px; }
.quote-more-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--muted);
  font-family: inherit;
  font-size: 11.5px;
  cursor: pointer;
}
.quote-more-toggle:hover { background: var(--panel-3); color: var(--text); }
.quote-extra { margin-top: 10px; }
.quote-extra[hidden] { display: none; }
@media (max-width: 1023px) {
  .quote-more-toggle { min-height: 44px; font-size: 12.5px; }
}

/* ---------- v17：资金流页的两组分段控件 ----------
   行业/概念（一级）与 榜单/蝶形/条形（视图）是不同层级，
   但外观一样大、各占整行，看起来像叠了两层同等重要的控件。
   处理：一级保持常规尺寸，视图那一层降为小号并右对齐。 */
@media (max-width: 1023px) {
  .ffv8-toolbar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: stretch;
  }
  .ffv8-toolbar .seg {
    width: 100%;
  }
  .ffv8-toolbar .seg:last-child,
  .ffv8-toolbar > div:last-child .seg {
    /* 视图切换：小一号，视觉层级降下去 */
    background: transparent;
    border-color: transparent;
    padding: 0;
    gap: 4px;
  }
  .ffv8-toolbar .seg:last-child button,
  .ffv8-toolbar > div:last-child .seg button {
    height: 28px;
    padding: 0 10px;
    font-size: 11.5px;
    border: 1px solid var(--border);
    background: var(--panel);
  }
  .ffv8-toolbar .seg:last-child button.on,
  .ffv8-toolbar > div:last-child .seg button.on {
    background: var(--accent-dim);
    border-color: color-mix(in srgb, var(--accent) 28%, transparent);
    color: var(--accent);
  }
}
