/* ============================================================
   PN.Quant V4.0 设计系统 design.css
   令牌 + 组件库。类名统一 v4- 前缀，仅引入本文件的页面生效，
   未升级页面零影响。色彩沿用全站语义色板（白底均≥4.5:1）。
   ============================================================ */

/* ---------- 1. 设计令牌 ----------
   色彩分三层：品牌色 / 语义色 / 中性色。
   括号内为该色在对应底色上的 WCAG 对比度（AA 正文需 ≥4.5:1，大字/图形 ≥3:1）。
   旧令牌名（--v4-ink / --v4-card 等）保留为别名，历史页面无需改动。 */
:root {
  color-scheme: light;

  /* ===== A. 品牌色（取自 LOGO 深红 + 金属银点缀） ===== */
  --v4-brand-700: #7F121A;        /* 9.19 */
  --v4-brand-600: #8F141C;        /* 深红，悬停/强调 */
  --v4-brand-500: #B01B24;        /* 6.93 主色 */
  --v4-brand-400: #C0262E;        /* 5.90 辅助红（渐变亮端） */
  --v4-brand-100: #FBE9EA;
  --v4-brand-50:  #FDF3F4;
  --v4-brand-line: #F3C9CC;
  --v4-brand-solid: #B01B24;      /* 实心填充（按钮底），其上白字 6.93 */
  --v4-brand-solid-hover: #8F141C;

  /* ===== B. 语义色（文本级，白底对比度均 ≥4.5:1） ===== */
  --v4-up: #dc2626;               /* 4.83 涨 / 危险 */
  --v4-up-strong: #b91c1c;        /* 6.47 */
  --v4-up-bg: #fef2f2;
  --v4-up-line: #fecaca;
  --v4-down: #15803d;             /* 5.02 跌 / 成功（原 #16a34a 仅 3.30，已替换） */
  --v4-down-strong: #166534;
  --v4-down-bg: #f0fdf4;
  --v4-down-line: #bbf7d0;
  --v4-warn: #b45309;             /* 5.02 警示 */
  --v4-warn-bg: #fffbeb;
  --v4-warn-line: #fde68a;
  --v4-info: #1d4ed8;             /* 6.70 信息 / 链接 */
  --v4-info-bg: #eff6ff;
  --v4-ai: #6d28d9;               /* 7.10 AI / 预测 */
  --v4-ai-bg: #f5f3ff;
  --v4-cyan: #0e7490;             /* 5.36 数据 / 资金流 */
  --v4-cyan-bg: #ecfeff;

  /* ===== C. 中性色（文字三级 + 表面四级 + 描边三级） ===== */
  --v4-text-1: #0f172a;           /* 17.85 标题 */
  --v4-text-2: #475569;           /* 7.58 正文 */
  --v4-text-3: #64748b;           /* 4.76 辅助 / 标签（AA 下限） */
  --v4-surface: #ffffff;
  --v4-surface-2: #f8fafc;
  --v4-fill: #f8fafc;
  --v4-fill-2: #f1f5f9;
  --v4-bg: #f6f8fb;
  --v4-line: #e2e8f0;
  --v4-line-2: #eef1f6;
  --v4-line-strong: #cbd5e1;
  --v4-glass-top: rgba(255,255,255,.86);
  --v4-glass-nav: rgba(255,255,255,.94);
  --v4-topnav-glass: rgba(246,248,251,.92);
  --v4-topbar-bg: linear-gradient(135deg, #181B20 0%, #2A2E35 100%);
  --v4-topbar-line: rgba(255,255,255,.10);
  --v4-focus: 0 0 0 3px rgba(176,27,36,.16);

  /* ===== 兼容旧令牌名 ===== */
  --v4-brand: var(--v4-brand-500);
  --v4-brand-dark: var(--v4-brand-600);
  --v4-brand-light: var(--v4-brand-50);
  --v4-brand-grad: linear-gradient(135deg, #A61820 0%, #C0262E 100%);
  --v4-ink: var(--v4-text-1);
  --v4-ink-2: var(--v4-text-2);
  --v4-ink-3: var(--v4-text-3);
  --v4-card: var(--v4-surface);

  /* 字阶 */
  --v4-fs-xs: 12px; --v4-fs-sm: 13px; --v4-fs-md: 14px;
  --v4-fs-lg: 16px; --v4-fs-xl: 18px; --v4-fs-2xl: 22px; --v4-fs-3xl: 28px;

  /* 圆角 */
  --v4-r-sm: 8px; --v4-r-md: 12px; --v4-r-lg: 16px; --v4-r-xl: 24px;

  /* 阴影 */
  --v4-sh-1: 0 1px 3px rgba(15,23,42,.06);
  --v4-sh-2: 0 1px 3px rgba(15,23,42,.06), 0 4px 14px rgba(15,23,42,.06);
  --v4-sh-3: 0 4px 12px rgba(15,23,42,.08), 0 12px 32px rgba(15,23,42,.10);

  /* 动效 */
  --v4-ease: cubic-bezier(.22,.61,.36,1);

  /* 安全区（刘海屏 / 手势条 / 状态栏）——APP 内边到边显示时自动生效 */
  --v4-safe-top: env(safe-area-inset-top, 0px);
  --v4-safe-bottom: env(safe-area-inset-bottom, 0px);
  --v4-topbar-h: 54px;
}

/* ---------- 1.1 暗色令牌 ----------
   深色不是简单反色：品牌色提高明度用于文字/描边，实心填充保持饱和；
   语义色全部换成高明度版本（深底对比度均 ≥6:1），表面色改用低饱和深蓝灰，
   避免纯黑导致的视觉疲劳与"发光"感。 */
:root[data-theme="dark"] {
  color-scheme: dark;

  --v4-brand-700: #F7C2C4;
  --v4-brand-600: #F87171;        /* 5.97 */
  --v4-brand-500: #E5484D;        /* 4.78 深底主色文字 */
  --v4-brand-400: #FF8F85;
  --v4-brand-100: rgba(229,72,77,.16);
  --v4-brand-50: rgba(229,72,77,.10);
  --v4-brand-line: rgba(229,72,77,.34);
  --v4-brand-solid: #B01B24;      /* 实心按钮保持饱和，白字 6.93 */
  --v4-brand-solid-hover: #C0262E;

  --v4-up: #ff8f85;               /* 8.49 */
  --v4-up-strong: #fca5a5;
  --v4-up-bg: rgba(255,143,133,.14);
  --v4-up-line: rgba(255,143,133,.32);
  --v4-down: #3ecf8e;             /* 9.38 */
  --v4-down-strong: #86efac;
  --v4-down-bg: rgba(62,207,142,.14);
  --v4-down-line: rgba(62,207,142,.32);
  --v4-warn: #fbbf24;             /* 11.22 */
  --v4-warn-bg: rgba(251,191,36,.14);
  --v4-warn-line: rgba(251,191,36,.30);
  --v4-info: #93c5fd;             /* 10.38 */
  --v4-info-bg: rgba(147,197,253,.14);
  --v4-ai: #c4b5fd;               /* 10.14 */
  --v4-ai-bg: rgba(196,181,253,.14);
  --v4-cyan: #67e8f9;             /* 12.92 */
  --v4-cyan-bg: rgba(103,232,249,.14);

  --v4-text-1: #EDEFF2;           /* 16.6 */
  --v4-text-2: #B9BEC6;           /* 10.4 */
  --v4-text-3: #9CA3AE;           /* 7.5 */
  --v4-surface: #14171B;
  --v4-surface-2: #1A1D22;
  --v4-fill: #1A1D22;
  --v4-fill-2: #20242A;
  --v4-bg: #0B0D10;
  --v4-line: #2A2F36;
  --v4-line-2: #23272D;
  --v4-line-strong: #3A4048;
  --v4-glass-top: rgba(20,23,27,.86);
  --v4-glass-nav: rgba(20,23,27,.94);
  --v4-topnav-glass: rgba(11,13,16,.92);
  --v4-topbar-bg: linear-gradient(135deg, #0C0E11 0%, #171A1F 100%);
  --v4-topbar-line: rgba(255,255,255,.08);
  --v4-focus: 0 0 0 3px rgba(229,72,77,.30);

  --v4-sh-1: 0 1px 2px rgba(0,0,0,.50);
  --v4-sh-2: 0 1px 3px rgba(0,0,0,.55), 0 6px 18px rgba(0,0,0,.45);
  --v4-sh-3: 0 8px 28px rgba(0,0,0,.60);

  --v4-brand-grad: linear-gradient(135deg, #A61820 0%, #C0262E 100%);
}

/* ---------- 2. 页面骨架 ---------- */
body.v4-body {
  background: var(--v4-bg);
  color: var(--v4-ink);
  font-size: var(--v4-fs-md);
  -webkit-font-smoothing: antialiased;
}
/* 仅淡入、不使用 transform：一旦元素（尤其是 body）带 transform，
   就会成为 fixed 子元素的包含块，导致底部 TabBar 不再贴视口底部 */
.v4-fadein { animation: v4-fadein .25s var(--v4-ease) both; }
@keyframes v4-fadein { from { opacity: 0; } to { opacity: 1; } }

.v4-container { max-width: 1200px; margin: 0 auto; padding: 20px 16px 96px; }
@media (min-width: 768px) { .v4-container { padding: 28px 24px 48px; } }

/* 数字 */
.v4-num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.v4-up { color: var(--v4-up); }
.v4-down { color: var(--v4-down); }

/* ---------- 3. 顶栏（品牌主题色渐变） ---------- */
.v4-topbar {
  position: sticky; top: 0; z-index: 900;
  /* APP 边到边显示：把状态栏高度补进顶栏，避免内容被状态栏遮挡 */
  padding-top: var(--v4-safe-top);
  background: var(--v4-topbar-bg);
  color: #fff;
  border-bottom: 1px solid var(--v4-topbar-line);
  box-shadow: 0 1px 12px rgba(15,23,42,.20);
}
/* 顶栏内元素统一反白，避免在品牌底上出现深色文字 */
.v4-topbar .v4-logo,
.v4-topbar .v4-logo span { color: #fff; }
.v4-topbar .v4-topbar-title { color: rgba(255,255,255,.80); }
.v4-topbar .v4-icon-btn { color: rgba(255,255,255,.92); }
.v4-topbar .v4-icon-btn:hover { background: rgba(255,255,255,.16); }
.v4-topbar-inner {
  max-width: 1200px; margin: 0 auto; height: var(--v4-topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 16px;
}
.v4-logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: var(--v4-fs-lg); color: var(--v4-ink); text-decoration: none; }
/* 品牌 LOGO（红色圆角 APP 图标，四周留白已在图片内处理，不再叠加圆角与描边） */
.v4-logo-img {
  width: 30px; height: 30px; border-radius: 0; object-fit: contain; flex: none;
  filter: drop-shadow(0 1px 2px rgba(15,23,42,.22));
}
/* 兼容旧 "Q" 字标（未替换完的页面仍可显示） */
.v4-logo-mark {
  width: 28px; height: 28px; border-radius: 9px; background: var(--v4-brand-grad);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; flex: none;
}
.v4-topbar-title { font-weight: 600; font-size: var(--v4-fs-md); color: var(--v4-ink-2); }
.v4-topbar-spacer { flex: 1; }
.v4-topbar-actions { display: flex; align-items: center; gap: 6px; }
.v4-icon-btn {
  width: 36px; height: 36px; border-radius: var(--v4-r-sm); border: none; background: transparent;
  color: var(--v4-ink-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  font-size: 17px; text-decoration: none; transition: background .15s var(--v4-ease);
}
.v4-icon-btn:hover { background: var(--v4-fill); }
.v4-icon-btn:active { transform: scale(.94); }

/* 顶栏返回键（子页面自动注入，一级页面不显示） */
.v4-btn-back {
  width: 34px; height: 34px; margin-left: -4px; flex: none;
  border: none; border-radius: 10px; background: transparent; color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background .15s var(--v4-ease), transform .12s var(--v4-ease);
}
.v4-btn-back:hover { background: rgba(255,255,255,.16); }
.v4-btn-back:active { transform: scale(.92); }
.v4-btn-back svg { width: 20px; height: 20px; }
/* 空间紧张时优先保证返回键与页面标题 */
@media (max-width: 430px) {
  .v4-topbar.has-back .v4-logo span { display: none; }
}

/* 页面顶部进度条 */
.v4-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--v4-brand-grad); z-index: 1001; border-radius: 0 3px 3px 0; transition: width .25s var(--v4-ease), opacity .3s; opacity: 0; pointer-events: none; }

/* ---------- 4. 移动端底部 TabBar ---------- */
.v4-tabbar {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 950;
  background: var(--v4-glass-nav);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-top: 1px solid var(--v4-line-2);
  padding: 6px 4px calc(8px + var(--v4-safe-bottom));
  box-shadow: 0 -1px 12px rgba(15,23,42,.04);
}
.v4-tabbar a {
  flex: 1; text-align: center; text-decoration: none; color: var(--v4-ink-3);
  font-size: 11px; line-height: 1.25; padding: 3px 0; border-radius: var(--v4-r-sm);
  transition: color .15s var(--v4-ease), transform .12s var(--v4-ease);
  -webkit-tap-highlight-color: transparent;
}
.v4-tabbar a .tb-ic { display: block; font-size: 19px; margin-bottom: 1px; }
.v4-tabbar a:active { transform: scale(.92); }
.v4-tabbar a.on { color: var(--v4-brand); font-weight: 600; }
@media (max-width: 767px) { .v4-tabbar { display: flex; } }

/* ---------- 5. 卡片 ---------- */
.v4-card {
  background: var(--v4-card); border-radius: var(--v4-r-lg);
  box-shadow: var(--v4-sh-1); padding: 20px; margin-bottom: 16px;
  transition: box-shadow .25s var(--v4-ease), transform .25s var(--v4-ease);
}
.v4-card-hover:hover { box-shadow: var(--v4-sh-2); transform: translateY(-2px); }
.v4-card-title { display: flex; align-items: center; gap: 10px; font-size: var(--v4-fs-lg); font-weight: 700; margin-bottom: 14px; }
.v4-card-sub { font-size: var(--v4-fs-sm); color: var(--v4-ink-3); font-weight: 400; margin-left: auto; }

/* 图标底座（功能入口标配） */
.v4-ico {
  width: 40px; height: 40px; border-radius: var(--v4-r-md); flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 19px; color: #fff; background: var(--v4-brand-grad);
}
.v4-ico.cyan { background: linear-gradient(135deg, #0e7490, #0891b2); }
.v4-ico.amber { background: linear-gradient(135deg, #b45309, #d97706); }
.v4-ico.green { background: linear-gradient(135deg, #16a34a, #15803d); }
.v4-ico.violet { background: linear-gradient(135deg, #6d28d9, #7c3aed); }
.v4-ico.blue { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.v4-ico.red { background: linear-gradient(135deg, #dc2626, #ef4444); }

/* ---------- 6. 按钮 ---------- */
.v4-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; cursor: pointer; text-decoration: none; user-select: none;
  font-size: var(--v4-fs-md); font-weight: 600; font-family: inherit;
  padding: 11px 22px; border-radius: var(--v4-r-md);
  transition: all .15s var(--v4-ease); position: relative; white-space: nowrap;
}
.v4-btn:active { transform: scale(.97); }
.v4-btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.v4-btn-primary { background: var(--v4-brand-solid); color: #fff; }
.v4-btn-primary:hover { background: var(--v4-brand-solid-hover); box-shadow: 0 4px 14px rgba(176,27,36,.32); }
.v4-btn-grad { background: var(--v4-brand-grad); color: #fff; }
.v4-btn-grad:hover { filter: brightness(1.06); box-shadow: 0 4px 14px rgba(176,27,36,.32); }
.v4-btn-secondary { background: var(--v4-brand-light); color: var(--v4-brand); }
.v4-btn-secondary:hover { background: var(--v4-brand-100); }
.v4-btn-ghost { background: transparent; color: var(--v4-ink-2); box-shadow: inset 0 0 0 1px var(--v4-line); }
.v4-btn-ghost:hover { background: var(--v4-fill); }
.v4-btn-danger { background: #dc2626; color: #fff; }
.v4-btn-sm { padding: 7px 14px; font-size: var(--v4-fs-sm); border-radius: var(--v4-r-sm); }
.v4-btn-block { width: 100%; }
/* 提交中 loading 态 */
.v4-btn.loading { color: transparent !important; pointer-events: none; }
.v4-btn.loading::after {
  content: ""; position: absolute; width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%;
  animation: v4-spin .7s linear infinite;
}
.v4-btn-ghost.loading::after, .v4-btn-secondary.loading::after { border-color: rgba(176,27,36,.3); border-top-color: var(--v4-brand); }
@keyframes v4-spin { to { transform: rotate(360deg); } }

/* ---------- 7. 表单 ---------- */
.v4-field { margin-bottom: 16px; }
.v4-label { display: block; font-size: var(--v4-fs-sm); font-weight: 600; color: var(--v4-ink-2); margin-bottom: 7px; }
.v4-input, .v4-select, .v4-textarea {
  box-sizing: border-box;
  width: 100%; padding: 12px 14px; font-size: var(--v4-fs-md); font-family: inherit;
  border: 1.5px solid var(--v4-line); border-radius: var(--v4-r-md);
  background: var(--v4-surface); color: var(--v4-ink); outline: none;
  transition: border-color .15s var(--v4-ease), box-shadow .15s var(--v4-ease), background-color .15s var(--v4-ease);
}
/* 悬停：边框加深一档，提供可点击暗示 */
.v4-input:hover, .v4-select:hover, .v4-textarea:hover { border-color: var(--v4-line-strong); }
/* 聚焦：表面底 + 品牌边框 + 品牌光圈 */
.v4-input:focus, .v4-select:focus, .v4-textarea:focus { border-color: var(--v4-brand); box-shadow: var(--v4-focus); }
/* 禁用/只读：浅灰填充 + 灰字，与普通态明确区分 */
.v4-input:disabled, .v4-select:disabled, .v4-textarea:disabled,
.v4-input[readonly], .v4-select[readonly], .v4-textarea[readonly] {
  background: var(--v4-fill); color: var(--v4-ink-3); cursor: not-allowed; border-color: var(--v4-line-2);
  box-shadow: none; -webkit-text-fill-color: var(--v4-ink-3);
}
.v4-input::placeholder, .v4-textarea::placeholder { color: var(--v4-ink-3); opacity: 1; }
/* 浏览器自动填充修复：Chrome/Safari 会注入淡蓝灰底，统一回白色 */
.v4-input:-webkit-autofill, .v4-input:-webkit-autofill:hover, .v4-input:-webkit-autofill:focus,
.v4-select:-webkit-autofill, .v4-select:-webkit-autofill:hover, .v4-select:-webkit-autofill:focus,
.v4-textarea:-webkit-autofill, .v4-textarea:-webkit-autofill:hover, .v4-textarea:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--v4-surface) inset;
  -webkit-text-fill-color: var(--v4-ink);
  caret-color: var(--v4-ink);
  transition: background-color 59999s ease-in-out 0s;
}
/* 下拉框跨浏览器统一：去原生外观，改用与主题一致的浅灰箭头 */
.v4-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; background-size: 14px;
}
.v4-select::-ms-expand { display: none; }
/* 数字输入：去除各浏览器差异化的原生步进按钮 */
.v4-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.v4-input[type="number"]::-webkit-outer-spin-button,
.v4-input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
/* 日期输入在 Firefox/Safari 下强制透明背景，避免系统灰 */
.v4-input[type="date"] { min-width: 0; }
.v4-textarea { resize: vertical; min-height: 0; }
/* 同步各页自定义输入类（strategy/day_trade/kline 等）的状态体系 */
.search-input:hover, .cond-sel:hover, .cond-inp:hover, .tool-select:hover, .tool-num:hover { border-color: #c7d0dd; }
.search-input:disabled, .cond-sel:disabled, .cond-inp:disabled, .tool-select:disabled, .tool-num:disabled {
  background: var(--v4-fill); color: var(--v4-ink-3); cursor: not-allowed; -webkit-text-fill-color: var(--v4-ink-3);
}
.search-input:-webkit-autofill, .cond-sel:-webkit-autofill, .cond-inp:-webkit-autofill,
.tool-select:-webkit-autofill, .tool-num:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 1000px var(--v4-surface) inset; -webkit-text-fill-color: var(--v4-ink);
  transition: background-color 59999s ease-in-out 0s;
}
.cond-sel, .tool-select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 12px;
}
.cond-sel::-ms-expand, .tool-select::-ms-expand { display: none; }
.cond-inp[type="number"], .tool-num { -moz-appearance: textfield; appearance: textfield; }
.cond-inp[type="number"]::-webkit-outer-spin-button, .cond-inp[type="number"]::-webkit-inner-spin-button,
.tool-num::-webkit-outer-spin-button, .tool-num::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.v4-field-err { font-size: var(--v4-fs-xs); color: var(--v4-up); margin-top: 5px; display: none; }
.v4-field.error .v4-input { border-color: var(--v4-up); }
.v4-field.error .v4-field-err { display: block; }
.v4-input-wrap { position: relative; }
.v4-input-eye { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); border: none; background: none; color: var(--v4-ink-3); cursor: pointer; font-size: 16px; padding: 4px; }

/* ---------- 8. 徽章 / Chips ---------- */
.v4-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 99px; font-size: var(--v4-fs-xs); font-weight: 600; }
.v4-badge.brand { background: var(--v4-brand-light); color: var(--v4-brand); }
.v4-badge.up { background: var(--v4-up-bg); color: var(--v4-up); }
.v4-badge.down { background: var(--v4-down-bg); color: var(--v4-down); }
.v4-badge.warn { background: var(--v4-warn-bg); color: var(--v4-warn); }
.v4-badge.gray { background: var(--v4-fill); color: var(--v4-ink-2); border: 1px solid var(--v4-line); }
.v4-badge.gold { background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff; }

.v4-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px; scrollbar-width: none; }
.v4-chips::-webkit-scrollbar { display: none; }
.v4-chip {
  flex: none; padding: 7px 16px; border-radius: 99px; font-size: var(--v4-fs-sm); font-weight: 500;
  background: var(--v4-card); color: var(--v4-ink-2); border: 1.5px solid var(--v4-line);
  cursor: pointer; transition: all .15s var(--v4-ease); white-space: nowrap; font-family: inherit;
}
.v4-chip:hover { border-color: var(--v4-brand-line); }
.v4-chip.on { background: var(--v4-brand-solid); border-color: var(--v4-brand-solid); color: #fff; font-weight: 600; }

/* ---------- 9. Toast ---------- */
.v4-toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: 92vw; }
.v4-toast {
  display: flex; align-items: center; gap: 9px; padding: 11px 18px;
  background: rgba(15,23,42,.92); color: #fff; font-size: var(--v4-fs-sm); font-weight: 500;
  border-radius: var(--v4-r-md); box-shadow: var(--v4-sh-3);
  animation: v4-toast-in .3s var(--v4-ease) both; max-width: 100%;
}
.v4-toast.out { animation: v4-toast-out .25s var(--v4-ease) both; }
.v4-toast .t-ic { font-size: 15px; }
.v4-toast.success .t-ic { color: #4ade80; }
.v4-toast.error .t-ic { color: #f87171; }
.v4-toast.warn .t-ic { color: #fbbf24; }
@keyframes v4-toast-in { from { opacity: 0; transform: translateY(-14px) scale(.95); } to { opacity: 1; transform: none; } }
@keyframes v4-toast-out { to { opacity: 0; transform: translateY(-10px) scale(.96); } }

/* ---------- 10. 对话框 ---------- */
.v4-dialog-mask { position: fixed; inset: 0; z-index: 1500; background: rgba(15,23,42,.45); display: flex; align-items: center; justify-content: center; padding: 24px; animation: v4-fadein .2s both; }
.v4-dialog { background: var(--v4-card); border-radius: var(--v4-r-xl); box-shadow: var(--v4-sh-3); width: 100%; max-width: 380px; padding: 24px; animation: v4-pop .25s var(--v4-ease) both; }
@keyframes v4-pop { from { opacity: 0; transform: scale(.92) translateY(10px); } to { opacity: 1; transform: none; } }
.v4-dialog h3 { font-size: var(--v4-fs-lg); margin-bottom: 8px; }
.v4-dialog p { font-size: var(--v4-fs-sm); color: var(--v4-ink-2); margin-bottom: 20px; }
.v4-dialog-btns { display: flex; gap: 10px; }
.v4-dialog-btns .v4-btn { flex: 1; }

/* ---------- 11. 骨架屏 ---------- */
.v4-skel { position: relative; overflow: hidden; background: var(--v4-fill-2); border-radius: var(--v4-r-sm); }
.v4-skel::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); animation: v4-shimmer 1.4s infinite; }
@keyframes v4-shimmer { to { transform: translateX(100%); } }
.v4-skel.line { height: 14px; margin: 8px 0; }
.v4-skel.line.w60 { width: 60%; } .v4-skel.line.w80 { width: 80%; } .v4-skel.line.w40 { width: 40%; }
.v4-skel.block { height: 90px; border-radius: var(--v4-r-md); }

/* ---------- 12. 空状态 ---------- */
.v4-empty { text-align: center; padding: 48px 20px; color: var(--v4-ink-3); }
.v4-empty .e-ic { font-size: 40px; margin-bottom: 10px; opacity: .5; }
.v4-empty p { font-size: var(--v4-fs-sm); margin-bottom: 16px; }

/* ---------- 13. 表格（移动端卡片化） ---------- */
.v4-table { width: 100%; border-collapse: collapse; font-size: var(--v4-fs-sm); }
.v4-table th { text-align: left; padding: 11px 12px; color: var(--v4-ink-3); font-weight: 600; font-size: var(--v4-fs-xs); border-bottom: 1px solid var(--v4-line); white-space: nowrap; }
.v4-table td { padding: 12px; border-bottom: 1px solid var(--v4-line-2); }
.v4-table tr:last-child td { border-bottom: none; }
.v4-table tbody tr { transition: background .15s; }
.v4-table tbody tr:hover { background: var(--v4-fill); }
@media (max-width: 767px) {
  .v4-table-responsive thead { display: none; }
  .v4-table-responsive tr { display: block; background: var(--v4-card); border-radius: var(--v4-r-md); box-shadow: var(--v4-sh-1); margin-bottom: 10px; padding: 6px 0; }
  .v4-table-responsive td { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: none; padding: 7px 14px; }
  .v4-table-responsive td::before { content: attr(data-label); color: var(--v4-ink-3); font-size: var(--v4-fs-xs); flex: none; }
}

/* ---------- 14. 底部抽屉（移动端弹层） ---------- */
.v4-drawer-mask { position: fixed; inset: 0; z-index: 1400; background: rgba(15,23,42,.45); animation: v4-fadein .2s both; }
.v4-drawer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 1410;
  background: var(--v4-card); border-radius: var(--v4-r-xl) var(--v4-r-xl) 0 0;
  max-height: 86vh; overflow-y: auto; padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
  animation: v4-drawer-up .3s var(--v4-ease) both;
}
.v4-drawer-grip { width: 40px; height: 4px; border-radius: 99px; background: var(--v4-line); margin: 6px auto 14px; }
@keyframes v4-drawer-up { from { transform: translateY(100%); } to { transform: none; } }
@media (min-width: 768px) {
  .v4-drawer { left: 50%; right: auto; transform: translateX(-50%); width: 640px; max-width: 94vw; bottom: auto; top: 50%; border-radius: var(--v4-r-xl); animation-name: v4-pop; }
  @keyframes v4-drawer-up { from { transform: translate(-50%, calc(-50% + 24px)); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
  .v4-drawer { animation-name: v4-drawer-up; }
}

/* ---------- 15. 统计卡（仪表条） ---------- */
.v4-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.v4-stat { background: var(--v4-card); border-radius: var(--v4-r-md); padding: 14px 16px; box-shadow: var(--v4-sh-1); }
.v4-stat .s-k { font-size: var(--v4-fs-xs); color: var(--v4-ink-3); margin-bottom: 4px; }
.v4-stat .s-v { font-size: var(--v4-fs-xl); font-weight: 700; }
.v4-stat .s-d { font-size: var(--v4-fs-xs); font-weight: 600; margin-left: 6px; }

/* ---------- 16. 列表项 ---------- */
.v4-list-item { display: flex; align-items: center; gap: 13px; padding: 14px 4px; border-bottom: 1px solid var(--v4-line-2); text-decoration: none; color: inherit; transition: background .15s; border-radius: var(--v4-r-sm); }
.v4-list-item:last-child { border-bottom: none; }
.v4-list-item:hover { background: var(--v4-fill); }
.v4-list-item .li-body { flex: 1; min-width: 0; }
.v4-list-item .li-title { font-weight: 600; font-size: var(--v4-fs-md); }
.v4-list-item .li-desc { font-size: var(--v4-fs-xs); color: var(--v4-ink-3); margin-top: 2px; }
.v4-list-item .li-arrow { color: var(--v4-ink-3); font-size: 15px; }

/* ---------- 17. 说明文本块（替代灰色底框） ----------
   设计原则：不用灰底"色块"包文字；改为白底+发丝边+品牌左轴线，
   信息层级靠留白与轴线表达，视觉更轻盈。 */
.v4-note {
  background: var(--v4-surface); border: 1px solid var(--v4-line-2); border-left: 3px solid var(--v4-brand-line);
  border-radius: var(--v4-r-sm); padding: 12px 16px;
  font-size: var(--v4-fs-sm); line-height: 1.8; color: var(--v4-ink-2);
}
.v4-note h4 { color: var(--v4-ink); font-size: var(--v4-fs-md); margin: 12px 0 6px; font-weight: 700; }
.v4-note h4:first-child { margin-top: 0; }
.v4-note p { margin: 6px 0; }
.v4-note.warn { border-left-color: #fcd34d; }
.v4-note.scroll { max-height: 300px; overflow-y: auto; }

/* TabBar SVG 图标尺寸（替换原字符图标） */
.v4-tabbar a .tb-ic { display: flex; align-items: center; justify-content: center; height: 22px; margin-bottom: 1px; }
.v4-tabbar a .tb-ic svg { width: 22px; height: 22px; }

/* ---------- 18. 主题切换按钮 ---------- */
.v4-theme-btn { flex: none; }
.v4-theme-btn svg { width: 18px; height: 18px; }
.v4-theme-btn .ic-moon { display: none; }
html[data-theme="dark"] .v4-theme-btn .ic-sun { display: none; }
html[data-theme="dark"] .v4-theme-btn .ic-moon { display: block; }

/* ---------- 19. 暗色兜底（首页历史内联样式） ----------
   首页仍有部分区块用行内 style 写死了浅色底/边框，这里用 !important 覆盖；
   已改用令牌的组件无需在此重复。 */
html[data-theme="dark"] body { --bg-start: #0B0D10; --bg-end: #101317; }
html[data-theme="dark"] #marketIndexSection,
html[data-theme="dark"] #commentarySection,
html[data-theme="dark"] #simTradeCard {
  background: var(--v4-surface) !important;
  border-color: var(--v4-line-2) !important;
}
/* 三块主题强调条：暗色下降低饱和，避免在深底上过亮 */
html[data-theme="dark"] #marketIndexSection { --acc: linear-gradient(90deg,#d97706,#f59e0b); }
html[data-theme="dark"] #commentarySection { --acc: linear-gradient(90deg,#B01B24,#FF8F85); }
html[data-theme="dark"] #simTradeCard { --acc: linear-gradient(90deg,#8B5CF6,#C4B5FD); }
html[data-theme="dark"] .idx-dots i,
html[data-theme="dark"] .cm-dots i { background: #33435c; }
html[data-theme="dark"] .idx-dots i.on,
html[data-theme="dark"] .cm-dots i.on { background: var(--v4-brand); }
html[data-theme="dark"] .cm-dw-close { background: var(--v4-fill-2); color: var(--v4-text-2); }
html[data-theme="dark"] .v4-drawer-grip { background: var(--v4-line); }
