/* ==========================================================================
   MoneyMach$ne — Terminal-Light Design System
   融合版：C 的密集结构 + B 的可视化 + 浅色优先。
   保留所有原有变量名与 id/class 选择器，确保 JS 渲染不受影响。
   核心变化：去玻璃拟态 → 实色面板 + 发丝网格；等宽数字；单一 cyan 强调色。
   ========================================================================== */

@font-face {
  font-family: 'Geist Sans';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.0/dist/fonts/geist-sans/Geist-Variable.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.0/dist/fonts/geist-mono/GeistMono-Variable.woff2') format('woff2');
}

:root {
  /* Surface — 浅色：纯净白底 + 极淡交替行 */
  --bg-100: #fafafa;
  --bg-200: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f7f8;
  --surface-3: #f0f0f2;
  --row-hover: #fffbeb;
  --row-alt: #fafafa;

  /* Text */
  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #71717a;
  --text-disabled: #a1a1aa;

  /* Border / grid — 发丝分隔 */
  --border: #e4e4e7;
  --border-subtle: #f0f0f2;
  --border-strong: #d4d4d8;
  --grid: #f0f0f0;

  /* Accent — 单一 cyan 强调 + 涨跌色 + 警示色 */
  --blue-600: #0891b2;
  --blue-700: #0891b2;
  --blue-900: #0e7490;
  --blue-1000: #ecfeff;
  --cyan: #0891b2;
  --cyan-tint: rgba(8, 145, 178, 0.08);
  --red-600: #dc2626;
  --red-800: #dc2626;
  --red-900: #dc2626;
  --red-tint: rgba(220, 38, 38, 0.07);
  --amber-700: #ca8a04;
  --amber-tint: rgba(202, 138, 4, 0.10);
  --green-600: #16a34a;
  --green-900: #15803d;
  --green-tint: rgba(22, 163, 74, 0.08);
  --green-border: rgba(22, 163, 74, 0.25);
  --purple: #7c3aed;
  --purple-tint: rgba(124, 58, 237, 0.08);

  /* 语义映射 */
  --text-on-accent: #ffffff;
  --nav-bg: var(--surface);
  --shadow-card: none;
  --shadow-hover: 0 1px 3px rgba(0,0,0,0.04);

  /* Radii — 锐利小圆角，终端工具感 */
  --r-sm: 4px;
  --r-md: 4px;
  --r-lg: 5px;

  /* Typography — 严格 5 级梯度，杜绝散乱 */
  --font-sans: 'Geist Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --fs-xs: 10.5px;   /* 表头 / 微标签 / 单位 */
  --fs-sm: 12px;     /* 次要正文 / badge / 副标 */
  --fs-base: 13px;   /* 正文 / 表格数据行（基准）*/
  --fs-md: 15px;     /* 账户名 / 小标题 */
  --fs-lg: 20px;     /* 数字 hero（账户总额）*/
  --fs-xl: 24px;     /* 大数字（strip hero 盈亏）*/

  /* Spacing — 4px 栅格，只允许这些值 */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;

  /* 缓动（保留变量名，玻璃期遗留，现在轻量） */
  --glass-blur: 0px;
  --glass-blur-heavy: 0px;
  --glass-ring: none;
  --bezel-pad: 0px;
  --bezel-radius: 5px;
  --bezel-inner-radius: 5px;
  --ease-fluid: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --glow-green: none;
  --glow-blue: none;
  --glow-purple: none;
  --tint-row: var(--row-hover);
  --shadow-hover-tint: 0 1px 3px rgba(0,0,0,0.04);
}

/* ==========================================================================
   Dark theme — 暖黑（非纯黑，长时间不累眼）
   ========================================================================== */

[data-theme="dark"] {
  --bg-100: #0a0a0b;
  --bg-200: #0e0e10;
  --surface: #121214;
  --surface-2: #18181b;
  --surface-3: #1f1f23;
  --row-hover: #1a1a12;
  --row-alt: #161618;

  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --text-disabled: #52525b;

  --border: #27272a;
  --border-subtle: #1f1f22;
  --border-strong: #3f3f46;
  --grid: #1e1e22;

  --blue-600: #06b6d4;
  --blue-700: #06b6d4;
  --blue-900: #22d3ee;
  --blue-1000: #ecfeff;
  --cyan: #06b6d4;
  --cyan-tint: rgba(6, 182, 212, 0.12);
  --red-600: #f87171;
  --red-800: #ef4444;
  --red-900: #f87171;
  --red-tint: rgba(248, 113, 113, 0.10);
  --amber-700: #facc15;
  --amber-tint: rgba(250, 204, 21, 0.10);
  --green-600: #4ade80;
  --green-900: #22c55e;
  --green-tint: rgba(74, 222, 128, 0.10);
  --green-border: rgba(74, 222, 128, 0.30);
  --purple: #a78bfa;
  --purple-tint: rgba(167, 139, 250, 0.10);

  --shadow-card: none;
  --shadow-hover: 0 1px 3px rgba(0,0,0,0.3);
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  background: var(--bg-100);
  transition: background 0.3s var(--ease-fluid);
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg-100);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
  font-variant-numeric: tabular-nums;
  transition: background 0.3s var(--ease-fluid), color 0.3s var(--ease-fluid);
}

/* 玻璃期的 mesh 光晕：删除，浅色纯净底 */

/* ==========================================================================
   Container & Layout
   ========================================================================== */

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 28px 64px;
}

@media (max-width: 768px) {
  .container { padding: 12px 16px 56px; }
}

/* ==========================================================================
   Navigation — 全宽顶栏（terminal 风），非浮动玻璃 pill
   保留 .nav / .nav-left / .nav a / #refresh-prices 等全部选择器
   ========================================================================== */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border-radius: 0;
  border: none;
  border-bottom: 1px solid var(--border);
  box-shadow: none;
  height: 48px;
  transition: background 0.3s var(--ease-fluid), border-color 0.3s var(--ease-fluid);
}

/* nav 内层：与 .container 同 max-width + margin:auto，让导航内容与正文严格对齐 */
.nav-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 28px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-right: 20px;
  padding-left: 0;
  padding-right: 20px;
  border-right: 1px solid var(--border);
  height: 100%;
}

.nav .brand {
  font-weight: 700;
  font-size: var(--fs-base);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  white-space: nowrap;
  color: var(--text-primary);
}

.nav .brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--cyan);
  box-shadow: none;
  display: inline-block;
}

.nav a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--fs-base);
  font-weight: 500;
  padding: 0 var(--sp-3);
  height: 100%;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  transition: color 0.2s var(--ease-fluid);
}

.nav a:hover {
  color: var(--text-primary);
  background: transparent;
}

.nav a.active {
  color: var(--cyan);
  background: transparent;
  box-shadow: inset 0 -2px 0 var(--cyan);
}

.nav .refresh-btn,
.nav .theme-toggle,
#autorefresh-toggle {
  flex-shrink: 0;
}

.nav .refresh-btn {
  background: var(--text-primary);
  color: var(--surface);
  border: 1px solid var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease-fluid);
  margin-left: auto;
}

.nav .refresh-btn:hover:not(:disabled) {
  background: var(--text-secondary);
  border-color: var(--text-secondary);
  box-shadow: none;
}

.nav .refresh-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.nav .refresh-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}

@media (max-width: 768px) {
  /* 移动端：nav 单行可横滚，绝不撑出视口（修复 390px docWidth=664px 溢出）。
     body 也加 overflow-x:hidden 兜底，防任何元素溢出导致页面级横向滚动。 */
  body { overflow-x: hidden; }
  .nav { gap: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-inner { padding: 0 12px; min-width: 0; width: 100%; }
  .nav-left { padding-right: 8px; margin-right: 6px; gap: 5px; flex-shrink: 0; }
  .nav .brand { font-size: 12px; }
  .nav .brand .dot { width: 7px; height: 7px; }
  .nav a { font-size: 12px; padding: 0 7px; flex-shrink: 0; }
  .nav .refresh-btn { font-size: 11px; padding: 5px 10px; flex-shrink: 0; }
  .nav .theme-toggle { padding: 4px; flex-shrink: 0; }
  #autorefresh-toggle { flex-shrink: 0; padding: 4px 6px; }
  #autorefresh-toggle .ar-label { display: none; }
  #autorefresh-toggle .ar-count { font-size: 10px; }
  /* 市场状态胶囊：移动端隐藏北京/ET 时间细节，只留状态点 + 标签 */
  .mkt-nav-time { display: none; }
  .mkt-nav-sep { display: none; }
  .container { padding: 10px 12px 56px; }
}

/* 自动刷新开关 — 实色小药丸 */
.autorefresh-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  transition: all 0.2s var(--ease-fluid);
  user-select: none;
  margin-left: var(--sp-2);
}

.autorefresh-toggle:hover {
  background: var(--surface-2);
  color: var(--text-secondary);
  border-color: var(--border-strong);
}

.autorefresh-toggle .ar-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-disabled);
  transition: all 0.2s var(--ease-fluid);
}

.autorefresh-toggle .ar-count {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  min-width: 28px;
}

.autorefresh-toggle.on {
  color: var(--green-600);
  background: var(--green-tint);
  border-color: var(--green-border);
}

.autorefresh-toggle.on .ar-dot {
  background: var(--green-600);
  animation: ar-blink 2.4s var(--ease-fluid) infinite;
}

@keyframes ar-blink {
  0%, 100% { box-shadow: 0 0 0 0 var(--green-border); }
  50% { box-shadow: 0 0 0 5px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .autorefresh-toggle.on .ar-dot { animation: none; }
}

/* 主题切换按钮 */
.theme-toggle {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s var(--ease-fluid);
  margin-left: var(--sp-2);
}

.theme-toggle:hover {
  background: var(--surface-2);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.theme-toggle:active { transform: scale(0.94); }

.theme-toggle svg { width: 16px; height: 16px; }

[data-theme="light"] .icon-dark { display: none; }
[data-theme="dark"] .icon-light { display: none; }

/* ==========================================================================
   Cards — 实色面板（去玻璃、去双层 bezel）
   保留 .card / .card-inner / .card-header 结构
   ========================================================================== */

.card {
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0;
  box-shadow: none;
  transition: border-color 0.2s var(--ease-fluid);
}

.card > .card-inner,
.card > h2:first-child,
.card > .card-header:first-child,
.card > table:first-child,
.card > div:first-child {
  display: block;
}

.card > h2,
.card > .card-header,
.card > .card-inner {
  padding: var(--sp-3) var(--sp-4) 0;
}

.card > h2:first-child,
.card > .card-header:first-child {
  border-radius: var(--r-lg) var(--r-lg) 0 0;
}

.card h2 {
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-2);
  flex-wrap: wrap;
}

.card-header h2 { margin-bottom: 0; }

.card > table,
.card > .card-inner,
.card > div:not(.card-header):not(.card-inner):not(h2) {
  padding-bottom: var(--sp-3);
}

.card > table { border-radius: 0; overflow: hidden; }

@media (max-width: 768px) {
  .card { border-radius: var(--r-md); }
  .card > h2, .card > .card-header, .card > .card-inner { padding: 10px 14px 0; }
}

/* ==========================================================================
   Metrics Grid — Dashboard KPI（P2 会改成 summary strip；P1 先保可读）
   ========================================================================== */

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 14px;
}

/* 数据状态横幅：缺价 / blocked 警告 */
.data-status-banner {
  border-radius: var(--r-md);
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: var(--fs-sm);
  font-weight: 500;
  border: 1px solid;
}
.data-status-banner.blocked {
  background: rgba(234, 88, 12, 0.08);
  border-color: rgba(234, 88, 12, 0.4);
  color: #ea580c;
}
[data-theme="dark"] .data-status-banner.blocked { color: #fb923c; }

.metric-card {
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: none;
  border-radius: 0;
  padding: var(--sp-3) var(--sp-4);
  box-shadow: none;
  position: relative;
  overflow: hidden;
  transition: background 0.2s var(--ease-fluid);
}

.metric-card:hover {
  transform: none;
  background: var(--surface-2);
  box-shadow: none;
}

/* 玻璃期 hero 卡光晕：删除 */
.metric-card:first-child::before {
  content: none;
}

.metric-card .label {
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-1);
  position: relative;
}

.metric-card .value {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-feature-settings: 'tnum';
  font-family: var(--font-mono);
  line-height: 1.15;
  position: relative;
}

.metric-card .sub {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: var(--sp-1);
  font-family: var(--font-mono);
  position: relative;
}

/* summary strip hero 格：盈亏大数字 */
.metric-card.strip-hero .value {
  font-size: var(--fs-xl);
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
  flex-wrap: wrap;
}
.metric-card.strip-hero .strip-pct {
  font-size: var(--fs-md);
  opacity: 0.85;
  font-weight: 600;
}
.metric-card.strip-hero.pos .value { color: var(--green-600); }
.metric-card.strip-hero.neg .value { color: var(--red-900); }
.metric-card.strip-hero.pos { background: var(--green-tint); }
.metric-card.strip-hero.neg { background: var(--red-tint); }

/* strip 图表格 */
.metric-card.strip-chart-cell {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.metric-card.strip-chart-cell canvas {
  flex: 1;
  max-height: 48px;
}

/* 当日涨跌药丸（持仓表/关注清单用） */
.chg {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--r-sm);
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  font-feature-settings: 'tnum';
}
.chg.up { background: var(--green-tint); color: var(--green-600); }
.chg.dn { background: var(--red-tint); color: var(--red-900); }

/* 持仓表 sparkline 列 */
td.spark { padding: 6px 10px; }
.spark-svg { display: block; }

/* 768px：strip 图表格隐藏（窄屏放不下） */
@media (max-width: 768px) {
  .metric-card { padding: 16px 18px; }
  .metric-card .value { font-size: 22px; }
  .metric-card.strip-hero .value { font-size: 20px; }
  .metric-card.strip-chart-cell { display: none; }
}

/* ==========================================================================
   Tables — 扁平发丝网格，等宽数字
   ========================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}

thead th {
  text-align: left;
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  background: var(--row-alt);
  white-space: nowrap;
}

thead th.num { text-align: right; }

tbody td {
  padding: 6px var(--sp-3);
  border-bottom: 1px solid var(--grid);
  color: var(--text-primary);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background 0.15s var(--ease-fluid);
}

tbody tr:hover { background: var(--row-hover); }

td.num, th.num {
  font-family: var(--font-mono);
  text-align: right;
  font-feature-settings: 'tnum';
}

.ticker {
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* 🔥 标记对齐技巧：tk-wrap > tk-code + hot-slot > hot-fire */
.tk-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tk-code {
  display: inline-block;
  min-width: 5.2ch;
}

.hot-slot {
  display: inline-block;
  width: 1.3em;
  vertical-align: middle;
}

.hot-fire {
  filter: none;
}

tr.cash-row td { color: var(--text-muted); font-style: italic; }

/* ==========================================================================
   P&L colors
   ========================================================================== */

.pos { color: var(--green-600); }
.neg { color: var(--red-900); }

/* ==========================================================================
   Account blocks — 扁平 header bar + 发丝网格表（去玻璃卡）
   保留全部 .account-* 选择器
   ========================================================================== */

.account-block {
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0;
  box-shadow: none;
  margin-bottom: var(--sp-3);
  transition: border-color 0.2s var(--ease-fluid);
  overflow: hidden;
}

.account-block:hover {
  box-shadow: none;
  border-color: var(--border-strong);
}

.account-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-4);
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: var(--row-alt);
}

.account-head-main { display: flex; flex-direction: column; gap: 2px; }

.account-name {
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text-primary);
}

.account-total {
  font-size: var(--fs-lg);
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  color: var(--text-secondary);
}

.account-head-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--sp-2);
}

.account-pnl {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-md);
  font-weight: 600;
  font-family: var(--font-mono);
}

.account-pnl .ap-arrow { font-size: var(--fs-sm); }
.account-pnl .ap-pct { font-size: var(--fs-base); opacity: 0.85; }

.account-breakdown {
  display: flex;
  gap: var(--sp-4);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.as-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
}

.as-label { color: var(--text-muted); }
.as-val { font-family: var(--font-mono); font-feature-settings: 'tnum'; color: var(--text-secondary); }

.account-block table { margin: 0; }
.account-block thead th { background: var(--surface); }

/* 持仓汇总行：可展开时鼠标变手型 + hover 反馈 */
tr.pos-summary-row { transition: background 0.12s; }
tr.pos-summary-row.pos-expandable { cursor: pointer; }
tr.pos-summary-row.pos-expandable:hover { background: var(--surface); }
/* chevron 图标 + 单 lot 时的占位（保持对齐） */
.pos-chevron, .pos-chevron-ph {
  display: inline-block; width: 14px; text-align: center;
  color: var(--text-muted); font-size: 11px; margin-right: 2px;
  transition: transform 0.12s;
}
/* 展开明细行：默认隐藏，展开时由 JS 设 display:table-row。
   批次行用主表列结构，自动对齐列宽；淡背景区分层次。 */
tr.pos-detail-row { display: none; background: var(--surface-2); }
tr.pos-detail-row > td { font-size: var(--fs-sm); }
tr.pos-detail-row td.pos-lot-label {
  color: var(--text-muted); font-size: var(--fs-xs); padding-left: 28px; white-space: nowrap;
}
/* lot 行内的买入日期：小字 muted，跟在股数后 */
.pos-lot-date {
  display: inline-block;
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-disabled);
}

@media (max-width: 768px) {
  .account-block-head { padding: 9px 14px; flex-direction: column; align-items: flex-start; }
  .account-head-side { align-items: flex-start; }
  .account-breakdown { justify-content: flex-start; }
  .account-total { font-size: 18px; }
  thead th, tbody td { padding: 6px 9px; font-size: 12px; }
}

/* ==========================================================================
   Badges — 实色小标签（去玻璃）
   ========================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 2px var(--sp-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid var(--border);
  background: var(--surface-2);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.badge-green { color: var(--green-600); border-color: var(--green-border); background: var(--green-tint); }
.badge-red { color: var(--red-900); border-color: rgba(220,38,38,0.25); background: var(--red-tint); }
.badge-blue { color: var(--blue-700); border-color: rgba(8,145,178,0.25); background: var(--cyan-tint); }
.badge-purple { color: var(--purple); border-color: rgba(124,58,237,0.25); background: var(--purple-tint); }
.badge-yellow { color: var(--amber-700); border-color: rgba(202,138,4,0.25); background: var(--amber-tint); }

[data-theme="dark"] .badge-purple { color: var(--purple); }

/* ==========================================================================
   交易台账页（ledger）
   ========================================================================== */
.txn-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--sp-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 600;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.txn-buy      { color: var(--green-600); border-color: var(--green-border); background: var(--green-tint); }
.txn-sell     { color: var(--red-900);   border-color: rgba(220,38,38,0.25); background: var(--red-tint); }
.txn-deposit  { color: var(--blue-700);  border-color: rgba(8,145,178,0.25); background: var(--cyan-tint); }
.txn-withdraw { color: var(--amber-700); border-color: rgba(202,138,4,0.25); background: var(--amber-tint); }
.txn-adjust   { color: var(--purple);    border-color: rgba(124,58,237,0.25); background: var(--purple-tint); }
[data-theme="dark"] .txn-adjust { color: var(--purple); }

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-base);
}
.ledger-table th {
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--row-alt);
}
.ledger-table td {
  padding: 6px var(--sp-3);
  border-bottom: 1px solid var(--grid);
  vertical-align: middle;
}
.ledger-table tbody tr:hover { background: var(--row-hover); }
/* 时间列：等宽，便于对齐 */
.ledger-time { font-family: var(--font-mono); font-size: var(--fs-xs); white-space: nowrap; color: var(--text-secondary); }

/* ==========================================================================
   Buttons — 实色方角（去玻璃 pill）
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  border: 1px solid var(--text-primary);
  background: var(--text-primary);
  color: var(--surface);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: all 0.2s var(--ease-fluid);
}

.btn:hover {
  box-shadow: none;
  transform: none;
  background: var(--text-secondary);
  border-color: var(--text-secondary);
}

.btn:active { transform: scale(0.98); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.btn-danger {
  background: transparent;
  color: var(--red-900);
  border-color: rgba(220,38,38,0.35);
}

.btn-danger:hover {
  background: var(--red-tint);
  border-color: var(--red-900);
}

.btn-sm { padding: var(--sp-1) var(--sp-3); font-size: var(--fs-sm); }

/* ==========================================================================
   Forms — 实色输入（去玻璃）
   ========================================================================== */

.form-group { margin-bottom: var(--sp-4); }

.form-group label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--sp-1);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  transition: all 0.2s var(--ease-fluid);
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-disabled); }

.form-group textarea { resize: vertical; min-height: 64px; font-family: var(--font-mono); font-size: var(--fs-sm); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-tint);
  background: var(--surface);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
  /* 移动端：表格在卡片内可横滚，不撑破页面 */
  .card-inner { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .ledger-table { font-size: 12px; }
  .ledger-table th, .ledger-table td { padding: 6px 8px; }
}

/* ==========================================================================
   Task items — 扁平行 + 状态点（去玻璃卡 + 左色条保留但更细）
   ========================================================================== */

.task-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  margin-bottom: 6px;
  transition: all 0.2s var(--ease-fluid);
  border-left-width: 3px;
}

.task-item:hover { border-color: var(--border-strong); background: var(--surface-2); }

.task-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.task-info > span:first-child { font-weight: 600; font-size: var(--fs-base); }
.task-info > span:last-child { font-size: var(--fs-sm); color: var(--text-muted); }

.task-state { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 500; }
.ts-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.task-actions { display: flex; align-items: center; gap: var(--sp-2); flex-shrink: 0; }

.task-item.pending { border-left-color: var(--text-disabled); }
.task-item.running { border-left-color: var(--cyan); }
.task-item.done { border-left-color: var(--green-600); }
.task-item.failed { border-left-color: var(--red-900); }
.task-item.cancelled { border-left-color: var(--text-disabled); opacity: 0.6; }

.task-pending { color: var(--text-muted); }
.task-running { color: var(--cyan); }
.task-running .ts-dot {
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  animation: ts-pulse 1.6s var(--ease-fluid) infinite;
}
.task-failed { color: var(--red-900); }
.task-cancelled { color: var(--text-muted); }

@keyframes ts-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

@media (prefers-reduced-motion: reduce) {
  .task-running .ts-dot { animation: none; }
}

/* 任务行：可点击 + 行内展开结论 */
.task-item.clickable { cursor: pointer; }
.task-item.clickable:hover { border-color: var(--cyan); background: var(--cyan-tint); }

/* 结论全文：默认隐藏，.expanded 时展开 */
.task-full {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s var(--ease-fluid), opacity 0.2s var(--ease-fluid);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  padding-top: 0;
}
.task-item.expanded .task-full {
  max-height: 400px;
  opacity: 1;
  padding-top: 6px;
}
/* 展开时隐藏预览摘要 */
.task-item.expanded .task-summary {
  color: var(--cyan);
}
.task-summary { cursor: pointer; }

/* ==========================================================================
   Report items — 保留选择器（analysis.js 当前用 task-item，此为兼容）
   ========================================================================== */

.report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  margin-bottom: 6px;
  transition: all 0.2s var(--ease-fluid);
}

.report-item:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  transform: none;
}

.report-main { min-width: 0; flex: 1; }

.report-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 600;
  font-size: var(--fs-base);
  margin-bottom: var(--sp-1);
  flex-wrap: wrap;
}

.report-meta {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .task-item, .report-item { flex-direction: column; align-items: stretch; padding: var(--sp-3) var(--sp-3); }
}

/* ==========================================================================
   Template items
   ========================================================================== */

.template-item {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  margin-bottom: 6px;
  transition: all 0.2s var(--ease-fluid);
  position: relative;
}

.template-item:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.tpl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  margin-bottom: var(--sp-1);
  flex-wrap: wrap;
}

.tpl-name { font-weight: 600; font-size: var(--fs-base); }
.tpl-desc { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.5; }
.tpl-badges { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.tpl-delete {
  opacity: 0;
  background: transparent;
  border: none;
  color: var(--red-900);
  cursor: pointer;
  font-size: var(--fs-sm);
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  transition: all 0.2s var(--ease-fluid);
}

.template-item:hover .tpl-delete { opacity: 1; }
.tpl-delete:hover { background: var(--red-tint); }

@media (hover: none) { .tpl-delete { opacity: 1; } }

.tpl-collapse-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

/* ==========================================================================
   Chips & Skill pills — 实色方角（去玻璃）
   ========================================================================== */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  font-size: var(--fs-sm);
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all 0.2s var(--ease-fluid);
}

.chip:hover { border-color: var(--border-strong); background: var(--surface-2); }

.chip.selected {
  background: var(--cyan);
  color: #fff;
  border-color: var(--cyan);
  box-shadow: none;
}

.chip-close {
  margin-left: 2px;
  opacity: 0.6;
  cursor: pointer;
  transition: opacity 0.2s var(--ease-fluid);
}

.chip-close:hover { opacity: 1; }

.skill-pills { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.skill-pill {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease-fluid);
}

.skill-pill:hover { border-color: var(--border-strong); background: var(--surface-2); }
.skill-pill:focus-within { box-shadow: 0 0 0 3px var(--cyan-tint); }

.skill-pill input { position: absolute; opacity: 0; pointer-events: none; }

.skill-pill.active {
  background: var(--cyan);
  color: #fff;
  border-color: var(--cyan);
  box-shadow: none;
}

/* ==========================================================================
   Section title & utilities
   ========================================================================== */

.section-title {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.muted { color: var(--text-muted); }

.empty-state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

.filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* ==========================================================================
   Toast — 实色（去玻璃），位置保留右下
   ========================================================================== */

.toast {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  font-size: var(--fs-base);
  font-weight: 500;
  z-index: 1000;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s var(--ease-fluid), transform 0.25s var(--ease-fluid);
  border-left-width: 3px;
  pointer-events: none;
  max-width: 360px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast.success { border-left-color: var(--green-600); }
.toast.error { border-left-color: var(--red-900); }

[data-theme="dark"] .toast { box-shadow: 0 4px 12px rgba(0,0,0,0.4); }

/* ==========================================================================
   Market nav pill + popover — 实色小药丸（去玻璃）
   保留全部 .mkt-nav* 选择器与 popover 结构
   ========================================================================== */

.mkt-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--sp-1) var(--sp-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  cursor: pointer;
  font-size: var(--fs-xs);
  transition: all 0.2s var(--ease-fluid);
}

.mkt-nav:hover, .mkt-nav-active { border-color: var(--border-strong); background: var(--surface-3); }

.mkt-nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.mkt-nav-label { font-weight: 500; color: var(--text-secondary); white-space: nowrap; }

.mkt-nav-sep { opacity: 0.3; }

.mkt-nav-time {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  opacity: 0.75;
  color: var(--text-muted);
  white-space: nowrap;
}

.mkt-nav-open .mkt-nav-dot { background: var(--green-600); }
.mkt-nav-open .mkt-nav-label { color: var(--green-600); }
.mkt-nav-open .mkt-nav-dot { animation: mkt-nav-blink 2.4s var(--ease-fluid) infinite; }

.mkt-nav-edge .mkt-nav-dot { background: var(--amber-700); }
.mkt-nav-edge .mkt-nav-label { color: var(--amber-700); }
.mkt-nav-edge .mkt-nav-dot { animation: mkt-nav-blink 2.4s var(--ease-fluid) infinite; }
[data-theme="light"] .mkt-nav-edge .mkt-nav-label { color: var(--amber-700); }

.mkt-nav-closed .mkt-nav-dot { background: var(--text-disabled); }
.mkt-nav-closed .mkt-nav-label { color: var(--text-muted); }

@keyframes mkt-nav-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
  .mkt-nav-open .mkt-nav-dot, .mkt-nav-edge .mkt-nav-dot { animation: none; }
}

@media (max-width: 768px) {
  .mkt-nav-time, .mkt-nav-sep { display: none; }
}

.mkt-popover {
  position: fixed;
  z-index: 200;
  min-width: 280px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  transition: opacity 0.2s var(--ease-fluid), transform 0.2s var(--ease-fluid);
}

[data-theme="dark"] .mkt-popover { box-shadow: 0 4px 16px rgba(0,0,0,0.5); }

.mkt-pop-visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.mkt-pop-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}

.mkt-pop-now {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
}
.mkt-pop-now b { color: var(--text-primary); font-weight: 600; }

.mkt-pop-rows { display: flex; flex-direction: column; gap: 2px; }

.mkt-pop-row {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  gap: var(--sp-2);
  align-items: center;
  padding: var(--sp-2) var(--sp-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
}

.mkt-pop-active { background: var(--cyan-tint); }
.mkt-pop-active .mkt-pop-dot { box-shadow: 0 0 6px currentColor; }

.mkt-pop-dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
/* 每段时段的圆点颜色，与导航胶囊同色 token：常规绿 / 盘前·盘后琥珀 */
.mkt-pop-dot-pre { background: var(--amber-700); color: var(--amber-700); }
.mkt-pop-dot-regular { background: var(--green-600); color: var(--green-600); }
.mkt-pop-dot-post { background: var(--amber-700); color: var(--amber-700); }
.mkt-pop-label { color: var(--text-secondary); font-weight: 500; }
.mkt-pop-et, .mkt-pop-bj { font-family: var(--font-mono); font-size: var(--fs-xs); color: var(--text-muted); }

/* ==========================================================================
   Refresh panel — 实色（去玻璃），保留 fixed 定位
   ========================================================================== */

.refresh-panel {
  position: fixed;
  top: 60px;
  right: var(--sp-5);
  width: 420px;
  max-width: calc(100vw - 48px);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  z-index: 600;
  border-left-width: 3px;
  transition: opacity 0.2s var(--ease-fluid);
}

[data-theme="dark"] .refresh-panel { box-shadow: 0 4px 16px rgba(0,0,0,0.5); }

.refresh-panel.hide { display: none; }
.refresh-panel.hide-anim { opacity: 0; }

.refresh-panel[data-state="success"] { border-left-color: var(--green-600); }
.refresh-panel[data-state="error"] { border-left-color: var(--red-900); }

.rp-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}

.rp-status { font-size: var(--fs-base); font-weight: 600; flex: 1; }

.rp-close {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.rp-close:hover { background: var(--surface-2); color: var(--text-primary); }

.rp-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: rp-spin 0.8s linear infinite;
}

@keyframes rp-spin { to { transform: rotate(360deg); } }

.rp-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.rp-icon.ok { background: var(--green-tint); color: var(--green-600); }
.rp-icon.err { background: var(--red-tint); color: var(--red-900); }

.rp-detail { font-size: var(--fs-sm); color: var(--text-secondary); margin-bottom: var(--sp-2); }

.rp-log {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  padding: var(--sp-2) var(--sp-3);
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
}

@media (max-width: 768px) {
  .refresh-panel { width: calc(100vw - 32px); right: 16px; top: 56px; }
}

/* ==========================================================================
   Modal — 实色（去玻璃）
   ========================================================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 20px;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.2s var(--ease-fluid);
}

.modal-overlay:not([style*="display: none"]) { opacity: 1; }

.modal-card {
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5) var(--sp-5);
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

[data-theme="dark"] .modal-card { box-shadow: 0 8px 32px rgba(0,0,0,0.5); }

.modal-title {
  font-size: var(--fs-md);
  font-weight: 600;
  margin-bottom: var(--sp-4);
}

.modal-section { margin-bottom: var(--sp-4); }

.modal-row {
  display: flex;
  align-items: baseline;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--grid);
}

.modal-label {
  font-size: var(--fs-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  min-width: 56px;
  flex-shrink: 0;
}

.modal-val { font-size: var(--fs-base); color: var(--text-primary); }

.modal-skills { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-4); }

.modal-skill-block {
  padding: var(--sp-3);
  background: var(--surface-2);
  border-radius: var(--r-sm);
  border: 1px solid var(--border-subtle);
}

.modal-skill-name { font-weight: 600; font-size: var(--fs-base); margin-bottom: var(--sp-1); }
.modal-skill-summary { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-2); line-height: 1.5; }
.modal-skill-row { display: flex; gap: var(--sp-2); padding: var(--sp-1) 0; font-size: var(--fs-sm); align-items: baseline; }
.modal-steps { display: flex; flex-wrap: wrap; gap: var(--sp-1); }
.modal-step {
  display: inline-block;
  padding: 2px 8px;
  background: var(--cyan-tint);
  color: var(--blue-700);
  border-radius: var(--r-sm);
  font-size: 11px;
}

.modal-hint { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-4); line-height: 1.5; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
}

/* ==========================================================================
   Watchlist — 实色面板 + 区间条保留（已有的好设计）
   保留全部 .wl-* 选择器
   ========================================================================== */

.wl-headcard { margin-bottom: var(--sp-4); }

.wl-headrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
}

.wl-filter {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: all 0.2s var(--ease-fluid);
}
.wl-filter:hover { border-color: var(--border-strong); background: var(--surface-2); }
.wl-filter.active {
  background: var(--text-primary);
  color: var(--surface);
  border-color: var(--text-primary);
}

/* 搜索框 */
.wl-search-input {
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  width: 180px;
  transition: all 0.2s var(--ease-fluid);
}
.wl-search-input::placeholder { color: var(--text-disabled); }
.wl-search-input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-tint);
}

@media (max-width: 768px) {
  .wl-search-input { width: 100%; }
}

#wl-body {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--sp-4);
}

@media (max-width: 880px) {
  #wl-body { grid-template-columns: 1fr; }
}

.wl-sector {
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.wl-sector-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
  border-bottom: 1px solid var(--border);
}

.wl-sector-title {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* 板块标题前的色条，给标题视觉锚点 */
.wl-sector-bar {
  width: 3px;
  height: 14px;
  background: var(--cyan);
  border-radius: 2px;
  flex-shrink: 0;
}

.wl-sector-head h2 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* 数量用圆角小 chip，而不是裸文字 */
.wl-sector-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
}

.wl-sector-meta { display: flex; gap: var(--sp-2); align-items: center; }

.wl-sector-head h2 { margin-bottom: 0; }
.wl-sector-meta { display: flex; gap: 8px; align-items: center; }

.wl-sector table, .wl-sector td, .wl-sector th { font-size: var(--fs-base); }

.wl-row-held { background: var(--cyan-tint); }
[data-theme="dark"] .wl-row-held { background: var(--cyan-tint); }

.wl-tk {
  display: inline-block;
  min-width: 5ch;
  font-family: var(--font-mono);
  font-weight: 600;
}

.wl-held {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 1px var(--sp-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--blue-700);
  background: var(--cyan-tint);
  border: 1px solid rgba(8,145,178,0.2);
  cursor: pointer;
  margin-left: 6px;
}
[data-theme="dark"] .wl-held { color: var(--blue-900); }

.wl-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--cyan);
  animation: wl-pulse 2s var(--ease-fluid) infinite;
}

@keyframes wl-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

@media (prefers-reduced-motion: reduce) {
  .wl-dot { animation: none; }
}

.cost-tip {
  position: fixed;
  z-index: 300;
  min-width: 260px;
  padding: var(--sp-3) var(--sp-3);
  border-radius: var(--r-md);
  background: var(--surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  border: 1px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s var(--ease-fluid);
}
[data-theme="dark"] .cost-tip { box-shadow: 0 4px 16px rgba(0,0,0,0.5); }

.cost-tip:not(.hide-anim) { opacity: 1; }

.ct-title { font-size: var(--fs-sm); font-weight: 600; margin-bottom: var(--sp-2); color: var(--text-primary); }
.ct-row { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); padding: var(--sp-1) 0; }
.ct-acct { color: var(--text-muted); }
.ct-val { font-family: var(--font-mono); display: flex; gap: 6px; align-items: center; }
.ct-emoji { font-size: var(--fs-base); }
.ct-shares { color: var(--text-muted); }
.ct-cost { color: var(--text-primary); font-weight: 500; }

.wl-range-th { min-width: 160px; }

.wl-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wl-lo, .wl-hi {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--text-muted);
  min-width: 48px;
}
.wl-lo { text-align: right; }

.wl-bar {
  position: relative;
  flex: 1;
  min-width: 60px;
  height: 6px;
}

.wl-bar-track {
  position: absolute;
  inset: 0;
  background: var(--grid);
  border-radius: 3px;
}

.wl-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  border-radius: 3px;
  opacity: 0.35;
}

.wl-bar-knob {
  position: absolute;
  top: 50%;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px currentColor, 0 1px 3px rgba(0,0,0,0.15);
}

.wl-bar-empty { background: var(--grid); border-radius: 3px; }

@media (max-width: 640px) {
  .wl-range-th, .wl-range { display: none; }
}

.wl-addrow { padding: var(--sp-3) 0 0; }

.wl-add-group {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
}

.wl-add-input, .wl-add-select {
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  transition: all 0.2s var(--ease-fluid);
}
.wl-add-input { flex: 1; min-width: 160px; font-family: var(--font-mono); }
.wl-add-select { min-width: 130px; }
.wl-add-input:focus, .wl-add-select:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-tint);
}

.wl-add-btn { flex-shrink: 0; }

.wl-action-th { width: 36px; }
.wl-action { text-align: center; }

.wl-del {
  width: 24px;
  height: 24px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-disabled);
  cursor: pointer;
  font-size: var(--fs-md);
  line-height: 1;
  transition: all 0.2s var(--ease-fluid);
}

.wl-del:hover { background: var(--red-tint); color: var(--red-900); border-color: rgba(220,38,38,0.2); }

/* ==========================================================================
   Scroll reveal — 克制入场（去模糊）
   ========================================================================== */

[data-reveal] {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s var(--ease-fluid), transform 0.3s var(--ease-fluid);
}

[data-reveal][data-revealed] {
  opacity: 1;
  transform: translateY(0);
}

[data-reveal]:nth-child(2) { transition-delay: 0.05s; }
[data-reveal]:nth-child(3) { transition-delay: 0.1s; }
[data-reveal]:nth-child(4) { transition-delay: 0.15s; }
[data-reveal]:nth-child(5) { transition-delay: 0.2s; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ==========================================================================
   Custom scrollbar
   ========================================================================== */

@media (hover: hover) {
  *::-webkit-scrollbar { width: 8px; height: 8px; }
  *::-webkit-scrollbar-track { background: transparent; }
  *::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
  }
  *::-webkit-scrollbar-thumb:hover { background: var(--text-disabled); }
}

/* ==========================================================================
   全局 focus 可见性（键盘可达性）
   ========================================================================== */

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 1px;
}

/* ==========================================================================
   2026 Frontend Redesign — Capital Playground
   鲜活的编辑式投资工作台。以下覆盖层保留原有 DOM 契约，仅重塑视觉语言。
   ========================================================================== */

:root {
  --bg-100: #f4f0f6;
  --bg-200: #eee8f1;
  --surface: #fffdf9;
  --surface-2: #f7f2f8;
  --surface-3: #eee5f2;
  --row-hover: #f3ecff;
  --row-alt: rgba(111, 45, 189, 0.045);
  --text-primary: #211b27;
  --text-secondary: #665e6d;
  --text-muted: #81788a;
  --text-disabled: #aca3b3;
  --border: #ddd5e4;
  --border-subtle: #e9e2ed;
  --border-strong: #bfb3c8;
  --grid: rgba(54, 35, 63, 0.08);
  --blue-600: #5b4bf2;
  --blue-700: #4d3ed8;
  --blue-900: #4030c8;
  --blue-1000: #f1efff;
  --cyan: #6d28d9;
  --cyan-tint: rgba(109, 40, 217, 0.1);
  --red-600: #f04452;
  --red-800: #df3040;
  --red-900: #d72d3d;
  --red-tint: rgba(240, 68, 82, 0.1);
  --amber-700: #dc7900;
  --amber-tint: rgba(255, 157, 0, 0.12);
  --green-600: #198754;
  --green-900: #147244;
  --green-tint: rgba(25, 135, 84, 0.1);
  --green-border: rgba(25, 135, 84, 0.28);
  --purple: #8b3ffc;
  --purple-tint: rgba(139, 63, 252, 0.1);
  --gray-500: #918898;
  --gray-600: #746b7b;
  --nav-bg: rgba(255, 253, 249, 0.86);
  --shadow-card: 0 18px 55px rgba(60, 35, 72, 0.09), 0 2px 8px rgba(60, 35, 72, 0.05);
  --shadow-hover: 0 24px 65px rgba(60, 35, 72, 0.14), 0 4px 12px rgba(60, 35, 72, 0.06);
  --r-sm: 10px;
  --r-md: 15px;
  --r-lg: 22px;
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 13px;
  --fs-md: 16px;
  --fs-lg: 23px;
  --fs-xl: 34px;
  --page-accent: #6d28d9;
  --page-accent-rgb: 109, 40, 217;
  --page-accent-2: #ff6240;
  --page-ink: #17121d;
  --acid: #b9ff66;
  --ease-fluid: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --bg-100: #0d0b12;
  --bg-200: #121018;
  --surface: #19161f;
  --surface-2: #211d29;
  --surface-3: #2b2635;
  --row-hover: rgba(139, 92, 246, 0.12);
  --row-alt: rgba(255, 255, 255, 0.025);
  --text-primary: #f8f4ff;
  --text-secondary: #c0b9c9;
  --text-muted: #91899b;
  --text-disabled: #665f70;
  --border: #383140;
  --border-subtle: #2a2531;
  --border-strong: #554b60;
  --grid: rgba(255, 255, 255, 0.065);
  --blue-600: #8f83ff;
  --blue-700: #a39aff;
  --blue-900: #b6afff;
  --blue-1000: #f6f4ff;
  --cyan: #a277ff;
  --cyan-tint: rgba(162, 119, 255, 0.13);
  --red-600: #ff7180;
  --red-800: #ff5d6e;
  --red-900: #ff7180;
  --red-tint: rgba(255, 113, 128, 0.12);
  --amber-700: #ffb743;
  --amber-tint: rgba(255, 183, 67, 0.12);
  --green-600: #7fe6a8;
  --green-900: #70dc9b;
  --green-tint: rgba(127, 230, 168, 0.11);
  --green-border: rgba(127, 230, 168, 0.28);
  --purple: #be91ff;
  --purple-tint: rgba(190, 145, 255, 0.12);
  --gray-500: #8f8799;
  --gray-600: #aaa2b4;
  --nav-bg: rgba(18, 16, 24, 0.84);
  --shadow-card: 0 22px 60px rgba(0, 0, 0, 0.27), 0 2px 8px rgba(0, 0, 0, 0.22);
  --shadow-hover: 0 28px 70px rgba(0, 0, 0, 0.38), 0 5px 14px rgba(0, 0, 0, 0.24);
  --page-ink: #0b0910;
}

.page-dashboard { --page-accent: #6d28d9; --page-accent-rgb: 109, 40, 217; --page-accent-2: #ff6240; }
.page-watchlist { --page-accent: #e25124; --page-accent-rgb: 226, 81, 36; --page-accent-2: #7aa820; }
.page-analysis { --page-accent: #c32e84; --page-accent-rgb: 195, 46, 132; --page-accent-2: #6246ea; }
.page-ledger { --page-accent: #087f8c; --page-accent-rgb: 8, 127, 140; --page-accent-2: #ff7a3d; }

[data-theme="dark"] .page-dashboard { --page-accent: #a277ff; --page-accent-rgb: 162, 119, 255; --page-accent-2: #ff7658; }
[data-theme="dark"] .page-watchlist { --page-accent: #ff7955; --page-accent-rgb: 255, 121, 85; --page-accent-2: #b9ff66; }
[data-theme="dark"] .page-analysis { --page-accent: #ff71c1; --page-accent-rgb: 255, 113, 193; --page-accent-2: #9584ff; }
[data-theme="dark"] .page-ledger { --page-accent: #43d4dd; --page-accent-rgb: 67, 212, 221; --page-accent-2: #ff8a52; }

html { background: var(--bg-100); }

body.page {
  position: relative;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 14%, rgba(var(--page-accent-rgb), 0.12), transparent 27rem),
    radial-gradient(circle at 92% 36%, color-mix(in srgb, var(--page-accent-2) 11%, transparent), transparent 24rem),
    var(--bg-100);
}

body.page::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.32;
  background-image: radial-gradient(circle, var(--border-strong) 0.75px, transparent 0.75px);
  background-size: 20px 20px;
  mask-image: linear-gradient(to bottom, #000, transparent 70%);
}

.container {
  max-width: 1440px;
  padding: 34px 38px 90px;
}

/* Navigation */
.nav {
  height: 66px;
  background: var(--nav-bg);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  -webkit-backdrop-filter: blur(22px) saturate(150%);
  backdrop-filter: blur(22px) saturate(150%);
  box-shadow: 0 8px 30px rgba(39, 23, 49, 0.045);
}

.nav-inner {
  max-width: 1440px;
  padding: 0 38px;
  gap: 4px;
}

.nav-left {
  gap: 14px;
  margin-right: 22px;
  padding-right: 22px;
  border-right-color: var(--border);
}

.nav .brand {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.nav .brand .dot {
  width: 13px;
  height: 13px;
  border-radius: 50% 50% 2px 50%;
  background: linear-gradient(135deg, var(--page-accent-2), var(--page-accent));
  box-shadow: 0 0 0 5px rgba(var(--page-accent-rgb), 0.1);
  transform: rotate(-12deg);
}

.nav a {
  position: relative;
  height: 36px;
  padding: 0 13px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
}

.nav a:hover { background: var(--surface-2); }

.nav a.active {
  color: var(--text-primary);
  background: rgba(var(--page-accent-rgb), 0.11);
  box-shadow: none;
}

.nav a.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 3px;
  width: 16px;
  height: 3px;
  border-radius: 5px;
  background: var(--page-accent);
  transform: translateX(-50%);
}

.nav .refresh-btn {
  min-height: 34px;
  padding: 7px 14px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(125deg, color-mix(in srgb, var(--page-accent) 50%, #17121d), color-mix(in srgb, var(--page-accent-2) 30%, #17121d));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 7px 18px rgba(var(--page-accent-rgb), 0.2);
}

.nav .refresh-btn:hover:not(:disabled) {
  background: linear-gradient(125deg, color-mix(in srgb, var(--page-accent) 56%, #17121d), color-mix(in srgb, var(--page-accent-2) 34%, #17121d));
  border-color: transparent;
  box-shadow: 0 10px 25px rgba(var(--page-accent-rgb), 0.3);
  transform: translateY(-1px);
}

.theme-toggle,
.autorefresh-toggle,
.mkt-nav {
  min-height: 32px;
  border-color: var(--border);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
}

.autorefresh-toggle.on {
  color: var(--green-600);
  background: var(--green-tint);
  border-color: var(--green-border);
}

/* Editorial page hero */
.page-hero {
  --hero-a: var(--page-accent);
  --hero-b: var(--page-accent-2);
  position: relative;
  min-height: 306px;
  margin-bottom: 18px;
  padding: 46px 52px;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(300px, 0.7fr);
  align-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 30px;
  color: #fff;
  background:
    linear-gradient(112deg, rgba(8, 6, 12, 0.97) 5%, color-mix(in srgb, var(--hero-a) 72%, #111 28%) 60%, var(--hero-b) 145%);
  box-shadow: 0 30px 80px rgba(var(--page-accent-rgb), 0.19);
}

.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background:
    linear-gradient(90deg, transparent 49.6%, rgba(255,255,255,0.22) 50%, transparent 50.4%),
    linear-gradient(transparent 49.6%, rgba(255,255,255,0.18) 50%, transparent 50.4%);
  background-size: 70px 70px;
  mask-image: linear-gradient(90deg, transparent 35%, #000 100%);
}

.page-hero::after {
  content: '';
  position: absolute;
  width: 310px;
  height: 310px;
  right: -90px;
  top: -150px;
  border-radius: 50%;
  background: var(--acid);
  opacity: 0.14;
  filter: blur(2px);
}

.hero-copy { position: relative; z-index: 2; max-width: 780px; }

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 21px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.16em;
  color: var(--acid);
}

.hero-kicker::before {
  content: '';
  width: 27px;
  height: 2px;
  background: currentColor;
}

.page-hero h1 {
  max-width: 780px;
  font-size: clamp(42px, 5.1vw, 72px);
  font-weight: 790;
  line-height: 0.98;
  letter-spacing: -0.065em;
}

.page-hero h1 em {
  color: var(--hero-b);
  font-family: 'Songti SC', 'STSong', Georgia, serif;
  font-weight: 700;
  font-style: italic;
  letter-spacing: -0.055em;
}

.page-hero p {
  max-width: 620px;
  margin-top: 24px;
  color: rgba(255, 255, 255, 0.69);
  font-size: 14px;
  line-height: 1.8;
}

.page-hero .hero-primary-label {
  max-width: none;
  margin-bottom: 8px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.05em;
  text-transform: none;
}

.hero-primary-value {
  color: #fff;
  font-family: var(--font-mono);
  font-size: clamp(58px, 7.2vw, 104px);
  font-weight: 820;
  line-height: 0.9;
  letter-spacing: -0.085em;
  text-shadow: 0 10px 45px rgba(0, 0, 0, 0.24);
}

.hero-primary-value.hero-value-pos { color: var(--acid); }
.hero-primary-value.hero-value-neg { color: #ff947d; }

.hero-primary-meta {
  margin-top: 20px;
  color: rgba(255, 255, 255, 0.75);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: -0.01em;
}

.hero-insights {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-self: stretch;
  padding: 7px 0;
}

.hero-insight {
  min-width: 0;
  padding: 18px 19px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 17px;
  background: rgba(7, 5, 11, 0.2);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.hero-insight-focus {
  grid-row: span 2;
  justify-content: center;
  background: rgba(7, 5, 11, 0.34);
}

.hero-insight-label {
  margin-bottom: 8px;
  color: rgba(255,255,255,0.55);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hero-insight strong {
  overflow: hidden;
  color: #fff;
  font-family: var(--font-mono);
  font-size: clamp(24px, 2.8vw, 42px);
  font-weight: 790;
  line-height: 1;
  letter-spacing: -0.065em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-insight-focus strong { color: var(--acid); }

.hero-insight small {
  margin-top: 9px;
  overflow: hidden;
  color: rgba(255,255,255,0.56);
  font-size: 10px;
  line-height: 1.45;
  text-overflow: ellipsis;
}

.hero-signal {
  position: relative;
  z-index: 1;
  justify-self: center;
  width: 240px;
  height: 240px;
}

.signal-ring,
.signal-core,
.signal-tag { position: absolute; }

.signal-ring {
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
}

.ring-one { inset: 15px; animation: signal-spin 18s linear infinite; }
.ring-two { inset: 48px; border-style: dashed; animation: signal-spin 13s linear infinite reverse; }

.ring-one::before,
.ring-two::before {
  content: '';
  position: absolute;
  width: 10px;
  height: 10px;
  top: 10%;
  left: 16%;
  border-radius: 50%;
  background: var(--acid);
  box-shadow: 0 0 18px var(--acid);
}

.ring-two::before { top: auto; left: auto; right: 2%; bottom: 28%; background: var(--hero-b); box-shadow: 0 0 18px var(--hero-b); }

.signal-core {
  inset: 78px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.28);
  border-radius: 22px;
  background: rgba(255,255,255,0.09);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 850;
  letter-spacing: -0.06em;
  transform: rotate(-7deg);
  box-shadow: inset 0 0 30px rgba(255,255,255,0.08);
}

.signal-tag {
  padding: 5px 9px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 999px;
  background: rgba(8,6,12,0.54);
  color: rgba(255,255,255,0.78);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.13em;
}

.signal-tag-a { left: -2px; top: 66px; transform: rotate(-9deg); }
.signal-tag-b { right: -17px; bottom: 57px; transform: rotate(8deg); }

.analysis-hero { --hero-b: #ff71c1; }
.watchlist-hero { --hero-b: #b9ff66; }
.ledger-hero { --hero-b: #ff8a52; }

@keyframes signal-spin { to { transform: rotate(360deg); } }

/* Cards and section rhythm */
#content > .card,
.container > .card { margin-bottom: 16px; }

.card {
  border: 1px solid color-mix(in srgb, var(--border) 88%, transparent);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: transform 0.3s var(--ease-fluid), box-shadow 0.3s var(--ease-fluid), border-color 0.3s var(--ease-fluid);
}

.card:hover {
  border-color: color-mix(in srgb, var(--page-accent) 26%, var(--border));
  box-shadow: var(--shadow-hover);
}

.card > h2,
.card > .card-header,
.card > .card-inner { padding: 24px 26px 0; }

.card > table,
.card > .card-inner,
.card > div:not(.card-header):not(.card-inner):not(h2) { padding-bottom: 24px; }

.card h2 {
  margin-bottom: 18px;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.section-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 22px;
  border-radius: 7px;
  background: rgba(var(--page-accent-rgb), 0.11);
  color: var(--page-accent);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0;
}

.panel-accounts { border-top: 3px solid var(--page-accent); }
.panel-positions { border-top: 3px solid var(--page-accent-2); }
.panel-history { border-top: 3px solid var(--acid); }
.panel-submit { border-top: 3px solid var(--page-accent); }
.panel-records { border-top: 3px solid var(--page-accent-2); }
.panel-templates { border-top: 3px solid #ffba43; }
.panel-entry { border-top: 3px solid var(--page-accent); }
.panel-ledger-history { border-top: 3px solid var(--page-accent-2); }

/* Dashboard metrics */
.metrics-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.metric-card {
  min-height: 145px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.3s var(--ease-fluid), box-shadow 0.3s var(--ease-fluid);
}

.metric-card:hover {
  transform: translateY(-4px) rotate(-0.25deg);
  background: var(--surface);
  box-shadow: var(--shadow-hover);
}

.metric-card:nth-child(2) { border-top: 4px solid var(--page-accent); }
.metric-card:nth-child(3) { border-top: 4px solid var(--page-accent-2); }
.metric-card:nth-child(4) { border-top: 4px solid #ffba43; }

.metric-card .label {
  margin-bottom: 10px;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 0.11em;
}

.metric-card .value {
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 750;
  letter-spacing: -0.055em;
}

.metric-card .sub { margin-top: 9px; font-family: var(--font-sans); }

.metric-card.strip-hero,
.metric-card.strip-hero.pos,
.metric-card.strip-hero.neg {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(140deg, var(--page-ink), color-mix(in srgb, var(--page-accent) 70%, #16101c));
}

.metric-card.strip-hero.pos .value,
.metric-card.strip-hero.neg .value,
.metric-card.strip-hero .sub,
.metric-card.strip-hero .label { color: #fff; }
.metric-card.strip-hero .label { opacity: 0.64; }
.metric-card.strip-hero .sub { opacity: 0.62; }
.metric-card.strip-hero.pos .strip-pct { color: var(--acid); }
.metric-card.strip-hero.neg .strip-pct { color: #ff9a82; }

.metric-card.strip-chart-cell canvas { max-height: 68px; }

/* Tables and account blocks */
thead th {
  padding: 10px 13px;
  color: var(--text-muted);
  background: rgba(var(--page-accent-rgb), 0.045);
  border-bottom-color: var(--border);
  font-weight: 700;
  letter-spacing: 0.075em;
}

tbody td { padding: 10px 13px; }
tbody tr:hover { background: rgba(var(--page-accent-rgb), 0.065); }

.ticker { color: var(--text-primary); font-weight: 750; }

.account-block {
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 17px;
  box-shadow: 0 7px 22px rgba(44, 26, 55, 0.045);
}

.account-block:hover { border-color: color-mix(in srgb, var(--page-accent) 28%, var(--border)); }

.account-block:nth-child(odd) .account-block-head { border-left: 5px solid var(--page-accent); }
.account-block:nth-child(even) .account-block-head { border-left: 5px solid var(--page-accent-2); }

.account-block-head {
  padding: 17px 20px;
  background: linear-gradient(110deg, rgba(var(--page-accent-rgb), 0.075), transparent 55%);
}

.account-name { font-size: 17px; font-weight: 760; }
.account-total { font-size: 25px; color: var(--text-primary); }
.account-pnl { padding: 4px 9px; border-radius: 9px; background: var(--surface); }
.account-pnl.pos { background: var(--green-tint); }
.account-pnl.neg { background: var(--red-tint); }
tr.pos-detail-row { background: rgba(var(--page-accent-rgb), 0.045); }

.panel-history .card-inner { min-height: 330px; }
.panel-history canvas { max-height: 260px; }

/* Controls */
.btn {
  min-height: 38px;
  padding: 9px 17px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(125deg, color-mix(in srgb, var(--page-accent) 50%, #17121d), color-mix(in srgb, var(--page-accent-2) 30%, #17121d));
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 20px rgba(var(--page-accent-rgb), 0.19);
}

.btn:hover {
  border-color: transparent;
  background: linear-gradient(125deg, color-mix(in srgb, var(--page-accent) 56%, #17121d), color-mix(in srgb, var(--page-accent-2) 34%, #17121d));
  box-shadow: 0 12px 28px rgba(var(--page-accent-rgb), 0.28);
  transform: translateY(-1px);
}

.btn-secondary {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  box-shadow: none;
}

.btn-secondary:hover {
  border-color: var(--page-accent);
  background: rgba(var(--page-accent-rgb), 0.08);
  color: var(--page-accent);
  box-shadow: none;
}

.btn-danger,
.btn-danger:hover { background: var(--red-tint); color: var(--red-900); box-shadow: none; }
.btn-sm { min-height: 32px; padding: 6px 12px; }

.form-group { margin-bottom: 18px; }
.form-group label { margin-bottom: 7px; font-weight: 750; letter-spacing: 0.075em; }

.form-group input,
.form-group select,
.form-group textarea,
.wl-search-input,
.wl-add-input,
.wl-add-select {
  min-height: 42px;
  padding: 10px 13px;
  border-color: var(--border);
  border-radius: 11px;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.wl-search-input:focus,
.wl-add-input:focus,
.wl-add-select:focus {
  border-color: var(--page-accent);
  box-shadow: 0 0 0 4px rgba(var(--page-accent-rgb), 0.11);
}

.form-row { gap: 16px; }

/* Analysis */
.panel-submit .card-inner { padding: 28px 30px 30px; }

.chip,
.skill-pill,
.wl-filter {
  border-radius: 999px;
  background: var(--surface);
  font-weight: 650;
}

.chip:hover,
.skill-pill:hover,
.wl-filter:hover {
  border-color: var(--page-accent);
  background: rgba(var(--page-accent-rgb), 0.07);
}

.chip.selected,
.skill-pill.active,
.wl-filter.active {
  border-color: transparent;
  background: linear-gradient(125deg, color-mix(in srgb, var(--page-accent) 50%, #17121d), color-mix(in srgb, var(--page-accent-2) 30%, #17121d));
  color: #fff;
  box-shadow: 0 6px 16px rgba(var(--page-accent-rgb), 0.2);
}

.skill-pill { min-height: 39px; padding: 9px 14px; }

.filters { gap: 8px; }

.task-item,
.template-item,
.report-item {
  margin-bottom: 9px;
  padding: 12px 14px;
  border-radius: 13px;
  background: var(--surface);
}

.task-item:hover,
.template-item:hover,
.report-item:hover { background: rgba(var(--page-accent-rgb), 0.05); }

.task-item.clickable:hover { border-color: var(--page-accent); background: rgba(var(--page-accent-rgb), 0.08); }

.template-item { border-left: 3px solid var(--page-accent); }
.modal-overlay { background: rgba(8, 5, 12, 0.72); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.modal-card { border-radius: 22px; box-shadow: 0 28px 90px rgba(0,0,0,0.32); }
.modal-skill-block { border-radius: 13px; }
.modal-step { border-radius: 999px; background: rgba(var(--page-accent-rgb), 0.1); color: var(--page-accent); }

/* Watchlist */
.wl-headcard .card-inner { padding: 24px 26px; }
.wl-headrow { display: grid; grid-template-columns: minmax(240px, 1fr) auto 200px; }
.wl-headrow .filters { margin: 0; }
.wl-search-input { width: 100%; }
.wl-addrow { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--border); }

#wl-body { gap: 16px; }

.wl-sector {
  border-top: 3px solid var(--page-accent);
  box-shadow: var(--shadow-card);
}

.wl-sector:nth-child(3n + 2) { border-top-color: var(--page-accent-2); }
.wl-sector:nth-child(3n) { border-top-color: #ffba43; }
.wl-sector-head { padding: 17px 18px 13px; }
.wl-sector-bar { width: 9px; height: 9px; border-radius: 50%; background: var(--page-accent); box-shadow: 0 0 0 5px rgba(var(--page-accent-rgb), 0.11); }
.wl-sector-head h2 { font-size: 15px; }
.wl-sector-count { background: rgba(var(--page-accent-rgb), 0.1); color: var(--page-accent); }
.wl-row-held { background: rgba(var(--page-accent-rgb), 0.065); }
.wl-held { border-radius: 999px; border-color: rgba(var(--page-accent-rgb), 0.22); background: rgba(var(--page-accent-rgb), 0.09); color: var(--page-accent); }
.wl-dot { background: var(--page-accent); }
.wl-bar { height: 7px; }
.wl-bar-track { background: var(--surface-3); }
.wl-bar-knob { width: 13px; height: 13px; }
.cost-tip,
.mkt-popover,
.refresh-panel,
.toast { border-radius: 15px; background: color-mix(in srgb, var(--surface) 95%, transparent); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); box-shadow: var(--shadow-hover); }

/* Ledger */
.panel-entry .card-inner { padding: 28px 30px 30px; }
.panel-entry .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.txn-badge { min-width: 58px; justify-content: center; border-radius: 999px; }
.ledger-time { color: var(--text-muted); }

/* Motion */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px) scale(0.992);
  transition: opacity 0.65s var(--ease-fluid), transform 0.65s var(--ease-fluid);
}

[data-reveal][data-revealed] { opacity: 1; transform: translateY(0) scale(1); }
[data-reveal]:nth-child(2) { transition-delay: 0.07s; }
[data-reveal]:nth-child(3) { transition-delay: 0.13s; }
[data-reveal]:nth-child(4) { transition-delay: 0.19s; }
[data-reveal]:nth-child(5) { transition-delay: 0.25s; }

@media (max-width: 1100px) {
  body { overflow-x: hidden; }
  .nav { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-inner { width: max-content; min-width: 100%; }
  .page-hero { grid-template-columns: minmax(0, 1fr) minmax(340px, 0.8fr); padding: 40px; }
  .hero-primary-value { font-size: clamp(52px, 7vw, 78px); }
  .hero-insight { padding: 15px; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wl-headrow { grid-template-columns: 1fr auto; }
  .wl-search-input { grid-column: 1 / -1; }
}

@media (max-width: 768px) {
  .container { padding: 18px 12px 58px; }
  .nav { height: 58px; }
  .nav-inner { width: max-content; min-width: 100%; padding: 0 12px; gap: 1px; }
  .nav-left { margin-right: 5px; padding-right: 7px; }
  .nav .brand { font-size: 12px; }
  .nav a { height: 34px; padding: 0 8px; font-size: 11px; }
  .nav .refresh-btn { min-height: 32px; padding: 6px 10px; font-size: 10px; }
  .theme-toggle { width: 30px; height: 30px; }

  .page-hero {
    min-height: 0;
    margin-bottom: 12px;
    padding: 30px 24px;
    grid-template-columns: 1fr;
    border-radius: 23px;
  }
  .page-hero h1 { font-size: clamp(36px, 11vw, 52px); }
  .page-hero p { margin-top: 18px; font-size: 13px; }
  .hero-kicker { margin-bottom: 16px; }
  .hero-primary-value { font-size: clamp(48px, 15vw, 66px); }
  .hero-primary-meta { margin-top: 14px; }
  .hero-insights { margin-top: 25px; padding: 0; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hero-insight,
  .hero-insight-focus { grid-row: auto; min-height: 104px; padding: 13px; justify-content: flex-end; }
  .hero-insight strong { font-size: 22px; }
  .hero-insight small { white-space: normal; }
  .hero-signal { display: none; }
  .page-hero::before { mask-image: none; opacity: 0.09; }

  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 128px; padding: 17px; border-radius: 16px; }
  .metric-card .value { font-size: 19px; }
  .metric-card.strip-hero .value { font-size: 19px; }

  .card { border-radius: 17px; }
  .card > h2,
  .card > .card-header,
  .card > .card-inner { padding: 18px 16px 0; }
  .card > table,
  .card > .card-inner,
  .card > div:not(.card-header):not(.card-inner):not(h2) { padding-bottom: 18px; }
  .panel-submit .card-inner,
  .panel-entry .card-inner,
  .wl-headcard .card-inner { padding: 20px 17px; }
  .account-block { min-width: 700px; }
  #positions-by-account { overflow-x: auto; padding-bottom: 4px; }
  .account-block-head { padding: 14px 15px; }
  .panel-history .card-inner { min-height: 280px; }

  .wl-headrow { display: flex; align-items: stretch; }
  .wl-headrow .filters { width: 100%; }
  .wl-filter { flex: 1; }
  .wl-add-group { align-items: stretch; }
  .wl-add-input,
  .wl-add-select { width: 100%; }
  .panel-entry .form-row { grid-template-columns: 1fr; }
  .task-item,
  .report-item { padding: 13px; }
}

@media (max-width: 480px) {
  .page-hero { min-height: 0; padding: 26px 20px; }
  .page-hero h1 { font-size: 36px; }
  .hero-primary-value { font-size: 48px; }
  .hero-primary-meta { font-size: 11px; line-height: 1.5; }
  .hero-insights { grid-template-columns: 1fr 1fr; }
  .hero-insight-focus { grid-column: 1 / -1; min-height: 92px; }
  .hero-insight { min-height: 96px; }
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 118px; }
  .metric-card.strip-chart-cell { display: none; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

@media (min-width: 481px) and (max-width: 580px) {
  .hero-insights { grid-template-columns: 1fr 1fr; }
  .hero-insight-focus { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  .ring-one,
  .ring-two { animation: none; }
  .metric-card:hover,
  .nav .refresh-btn:hover:not(:disabled),
  .btn:hover { transform: none; }
}

/* ==========================================================================
   线上静态镜像模式（Vercel 部署）：html.static-mode 由 app.js 探测挂载。
   所有依赖本地 Python 后端的写操作 UI 打 .needs-backend，线上整块隐藏。
   ========================================================================== */
.static-mode .needs-backend {
  display: none !important;
}
