/* ── CSS Variables (QuantDinger Ant-Design Dark Tech) ──
   Token 来源: QuantDinger-Vue + Ant Design Vue + UI 验收报告 + 架构 SVG + email/pdf 服务 */
:root {
  /* 背景层级: 深黑 → 表面 → 卡片 */
  --color-bg: #080808;
  --color-surface: #111111;
  --color-card: #0d0d0d;

  /* 文字 */
  --color-text: rgba(255, 255, 255, 0.88);
  --color-text-muted: rgba(255, 255, 255, 0.45);

  /* 品牌渐变: #155eef → #0ea5e9；主色取中间值 */
  --color-primary: #1677ff;
  --color-primary-hover: #4096ff;

  /* 边框 */
  --color-border: rgba(253, 253, 253, 0.12);

  /* 语义色 */
  --color-success: #49aa19;
  --color-danger: #dc4446;
  --color-warning: #d89614;
  --color-gold: #d89614;

  /* A股惯例: 红涨绿跌 (QuantDinger 看涨/看跌色系) */
  --color-up: #dc4446;
  --color-down: #49aa19;

  /* 阴影 — 来源 quantdinger SVG: y5 blur8 #102a56@10% */
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 5px 8px rgba(16, 42, 86, 0.10);
  --shadow-lg: 0 8px 16px rgba(16, 42, 86, 0.12);

  /* 圆角 — Ant Design 默认 */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;

  /* 图表 */
  --chart-line: #1677ff;
  --chart-fill: rgba(22, 119, 255, 0.12);
  --chart-grid: rgba(253, 253, 253, 0.08);
}

[data-theme="dark"] {
  --color-bg: #080808;
  --color-surface: #111111;
  --color-card: #0d0d0d;
  --color-text: rgba(255, 255, 255, 0.88);
  --color-text-muted: rgba(255, 255, 255, 0.45);
  --color-primary: #1677ff;
  --color-primary-hover: #4096ff;
  --color-border: rgba(253, 253, 253, 0.12);
  --color-success: #49aa19;
  --color-danger: #dc4446;
  --color-warning: #d89614;
  --color-gold: #d89614;
  --color-up: #dc4446;
  --color-down: #49aa19;
}

[data-theme="light"] {
  --color-bg: #f5f5f5;
  --color-surface: #ffffff;
  --color-card: #ffffff;
  --color-text: rgba(0, 0, 0, 0.88);
  --color-text-muted: rgba(0, 0, 0, 0.45);
  --color-primary: #1677ff;
  --color-primary-hover: #4096ff;
  --color-border: rgba(0, 0, 0, 0.08);
  --color-success: #49aa19;
  --color-danger: #dc4446;
  --color-warning: #d89614;
  --color-gold: #d89614;
  --color-up: #dc4446;
  --color-down: #49aa19;
}

[data-theme="warm"] {
  --color-bg: #1a1410;
  --color-surface: #221d18;
  --color-card: #2a2420;
  --color-text: rgba(255, 255, 255, 0.86);
  --color-text-muted: rgba(255, 255, 255, 0.42);
  --color-primary: #d48806;
  --color-primary-hover: #e8a820;
  --color-border: rgba(253, 253, 253, 0.10);
  --color-success: #5b9e3a;
  --color-danger: #d8734a;
  --color-warning: #d89614;
  --color-gold: #d48806;
  --color-up: #d8734a;
  --color-down: #5b9e3a;
}

/* ── Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── 工具类 ── */
.hidden { display: none !important; }

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Header ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; }
.header-left h1 { font-size: 1.1rem; font-weight: 700; color: var(--color-primary); }
.header-left a { text-decoration: none; color: var(--color-primary); display: flex; align-items: center; gap: 8px; }
.nav-links {
  display: flex;
  gap: 6px;
  align-items: center;
  flex: 1;
  justify-content: center;
}
.nav-links a {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: all 0.15s;
}
.nav-links a:hover, .nav-links a.active { background: var(--color-primary); color: #fff; }
.header-nav { display: flex; align-items: center; flex: 1; }
.nav-right { display: flex; align-items: center; gap: 10px; }
.user-info { font-size: 0.8rem; color: var(--color-text-muted); }
.theme-select {
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid var(--color-border);
  background: var(--color-card);
  color: var(--color-text);
  font-size: 0.8rem;
}

/* ── Risk Banner ── */
.risk-banner {
  background: var(--color-warning);
  color: #1a1a1a;
  text-align: center;
  padding: 6px 16px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* ── Main Content ── */
.main-content {
  max-width: 100%;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 56px - 32px - 80px);
}

/* ── Footer ── */
.app-footer {
  text-align: center;
  padding: 12px 24px;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  border-top: 1px solid var(--color-border);
  background: var(--color-card);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary); }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Cards ── */
.card {
  background: var(--color-card);
  border-radius: 10px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 600;
  font-size: 0.95rem;
}
.card-body { padding: 20px; }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; margin-bottom: 4px; font-size: 0.85rem; font-weight: 500; color: var(--color-text-muted); }
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color 0.15s;
}
.form-input:focus { outline: none; border-color: var(--color-primary); }
.form-error { font-size: 0.8rem; color: var(--color-danger); margin-top: 4px; }

/* ── Stat Cards ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 20px;
}
.stat-label { font-size: 0.8rem; color: var(--color-text-muted); margin-bottom: 6px; }
.stat-value { font-size: 1.6rem; font-weight: 700; }
.stat-value.up { color: var(--color-danger); }
.stat-value.down { color: var(--color-success); }

/* ── Tables ── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left;
  padding: 10px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-muted);
  border-bottom: 2px solid var(--color-border);
}
.data-table td {
  padding: 10px 14px;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--color-border);
}
.data-table tr:hover { background: var(--color-bg); }

/* ── Score Ring ── */
.score-ring {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  font-size: 1.5rem;
  font-weight: 700;
  border: 4px solid var(--color-primary);
}

/* ── Page Title ── */
.page-title { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; }
.page-desc { font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 20px; }

/* ── Loading / Error / Empty ── */
.state-loading, .state-error, .state-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}
.state-error { color: var(--color-danger); }

/* ── Tabs ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--color-border); margin-bottom: 20px; }
.tab {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 0.9rem;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.15s;
}
.tab:hover { color: var(--color-text); }
.tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ── Charts ── */
.chart-container { width: 100%; height: 360px; }

/* ── VIP Badge ── */
.vip-badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; border-radius: 4px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.3px;
  vertical-align: middle;
}
.vip-badge.monthly { background: linear-gradient(135deg, #f59e0b, #fbbf24); color: #78350f; }
.vip-badge.annual { background: linear-gradient(135deg, #7c3aed, #a78bfa); color: #fff; }
.vip-badge.admin { background: linear-gradient(135deg, #dc2626, #ef4444); color: #fff; }

/* ── 导航用户区 ── */
.nav-user-area { position: relative; display: flex; align-items: center; gap: 6px; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.nav-user-area:hover { background: var(--color-bg); }
.user-name { font-size: 0.82rem; color: var(--color-text); }
.nav-dropdown-arrow { font-size: 0.6rem; color: var(--color-text-muted); margin-left: -2px; }
.nav-dropdown {
  position: absolute; top: 100%; right: 0; min-width: 160px;
  background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  display: none; z-index: 200; padding: 4px 0; margin-top: 4px;
}
.nav-dropdown.show { display: block; }
.nav-dropdown a, .nav-dropdown button {
  display: block; width: 100%; padding: 10px 16px; text-align: left;
  border: none; background: none; color: var(--color-text);
  font-size: 0.85rem; cursor: pointer; text-decoration: none;
}
.nav-dropdown a:hover, .nav-dropdown button:hover { background: var(--color-bg); }

/* ── 会员卡 ── */
.membership-card {
  border-radius: 12px; padding: 24px; color: #fff; margin-bottom: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.membership-card.free { background: linear-gradient(135deg, #64748b, #94a3b8); }
.membership-card.monthly { background: linear-gradient(135deg, #d97706, #f59e0b); }
.membership-card.annual { background: linear-gradient(135deg, #5b21b6, #7c3aed); }
.membership-card.admin { background: linear-gradient(135deg, #b91c1c, #dc2626); }
.membership-card .mc-title { font-size: 0.8rem; opacity: 0.85; }
.membership-card .mc-grade { font-size: 1.4rem; font-weight: 700; }
.membership-card .mc-remain { font-size: 0.9rem; }
.membership-card .mc-expire { font-size: 0.78rem; opacity: 0.8; }

/* ── 升级提示 ── */
.upgrade-banner {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff; text-align: center; padding: 10px 16px;
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  border-radius: 8px; margin-bottom: 16px;
}

/* ── 门禁区 ── */
.gate-lock {
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 20px; color: var(--color-text-muted); gap: 12px;
  text-align: center;
}
.gate-lock .lock-icon { font-size: 2.5rem; }

/* ── 二维码展示 ── */
.qr-box {
  background: #fff; padding: 20px; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.qr-box .token-code {
  font-size: 2.2rem; font-weight: 700; letter-spacing: 10px;
  color: #1e293b; font-family: "Courier New", monospace;
}

/* ── Toast 提示 ── */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: 8px; color: #fff;
  font-size: 0.9rem; z-index: 1000; opacity: 0;
  transition: opacity 0.3s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }

/* ── Profile Layout ── */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }

/* ── Dashboard: KPI Row ── */
.kpi-row { display:grid; grid-template-columns:repeat(4, 1fr); gap:12px; }
.kpi-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 18px 20px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card .kpi-label { font-size:0.75rem; color:var(--color-text-muted); margin-bottom:8px; }
.kpi-card .kpi-value { font-size:1.6rem; font-weight:700; color:var(--color-text); margin-bottom:4px; }
.kpi-card .kpi-value.up { color:var(--color-up); }
.kpi-card .kpi-value.down { color:var(--color-down); }
.kpi-card .kpi-sub { font-size:0.72rem; color:var(--color-text-muted); }

/* ── Dashboard: Mid Row (Mood + Sector Mini) ── */
.mid-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; }

/* Sector Heat Mini */
.sector-heat-mini {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 20px;
}
.shm-link { font-size:0.72rem; color:var(--color-primary); text-decoration:none; }
.shm-link:hover { text-decoration:underline; }
.shm-grid { display:flex; flex-direction:column; gap:6px; margin-top:8px; }
.shm-cell {
  display:flex; align-items:center; gap:8px; position:relative;
  padding:8px 10px; border-radius:6px; text-decoration:none;
  background:var(--color-bg); overflow:hidden;
}
.shm-cell:hover { filter:brightness(1.1); }
.shm-cell { cursor:pointer; }
.shm-cell .shm-name { font-size:0.78rem; color:var(--color-text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; width:70px; flex-shrink:0; }
.shm-cell .shm-pct { font-size:0.78rem; font-weight:600; width:68px; text-align:right; flex-shrink:0; }
.shm-cell.up .shm-pct { color:var(--color-up); }
.shm-cell.down .shm-pct { color:var(--color-down); }
.shm-cell .shm-bar {
  position:absolute; left:0; top:0; bottom:0;
  border-radius:6px; opacity:0.12; transition:width 0.4s;
}
.shm-cell.up .shm-bar { background:var(--color-up); }
.shm-cell.down .shm-bar { background:var(--color-down); }

/* ── Dashboard: Index Bar ── */
.dashboard { display:flex; flex-direction:column; gap:20px; }
.index-bar { display:grid; grid-template-columns:repeat(4, 1fr); gap:12px; }
.index-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px 18px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.2s;
  cursor: pointer;
}
.index-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.index-card.active { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary); }
.index-card .ic-name { font-size:0.78rem; color:var(--color-text-muted); margin-bottom:6px; }
.index-card .ic-price { font-size:1.4rem; font-weight:700; color:var(--color-text); margin-bottom:4px; }
.index-card .ic-change { font-size:1rem; font-weight:700; }
.index-card .ic-change.up { color:var(--color-danger); }
.index-card .ic-change.down { color:var(--color-success); }
.index-card .ic-change.flat { color:var(--color-text-muted); }

/* ── Dashboard: Index Kline Chart ── */
.index-kline-wrap {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px;
}
.index-kline-wrap .kline-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.index-kline-wrap .kline-title { font-weight: 600; font-size: 0.9rem; }
.index-kline-wrap .kline-meta { font-size: 0.7rem; color: var(--color-text-muted); }
.index-kline-wrap .kline-chart { width: 100%; height: 420px; }

/* ── Dashboard: Marquee Scroll ── */
.marquee-section {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 0;
  overflow: hidden;
}
.marquee-section .marquee-header {
  display: flex; align-items: center; gap: 8px;
  padding: 0 16px 10px;
}
.marquee-section .marquee-header .mh-dot {
  width: 8px; height: 8px; border-radius: 50%;
  animation: mhPulse 1.5s infinite;
}
.marquee-section .marquee-header .mh-dot.green { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.marquee-section .marquee-header .mh-dot.red { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
@keyframes mhPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
.marquee-section .marquee-header .mh-label {
  font-size: 0.78rem; font-weight: 600; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: 1px;
}
.marquee-wrap {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #1a1a2e;
  border-top: 1px solid rgba(0,212,170,0.15);
  border-bottom: 1px solid rgba(0,212,170,0.15);
}
.marquee-track {
  display: flex;
  gap: 0;
  width: max-content;
  animation: marqueeScroll 60s linear infinite;
  animation-play-state: paused;
}
.marquee-track.marquee-running {
  animation-play-state: running;
}
.marquee-wrap:hover .marquee-track { animation-play-state: paused; }
.marquee-wrap:hover .marquee-track.marquee-running { animation-play-state: paused; }
@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
.marquee-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  white-space: nowrap;
  border-right: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
  min-width: 220px;
}
.marquee-item .mi-tag {
  font-size: 0.6rem; font-weight: 700; padding: 2px 6px; border-radius: 3px;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.marquee-item .mi-tag.hot { background: rgba(239,68,68,0.2); color: #ef4444; }
.marquee-item .mi-tag.short { background: rgba(0,212,170,0.2); color: #00d4aa; }
.marquee-item .mi-name { font-size: 0.85rem; font-weight: 600; color: #e0e0e0; }
.marquee-item .mi-code { font-size: 0.7rem; color: #888; }
.marquee-item .mi-price { font-size: 0.9rem; font-weight: 700; color: #fff; }
.marquee-item .mi-pct { font-size: 0.82rem; font-weight: 700; }
.marquee-item .mi-pct.up { color: #ef4444; }
.marquee-item .mi-pct.down { color: #22c55e; }
.marquee-item .mi-pct.flat { color: #888; }

/* ── Short Pool Grid ── */
.short-pool-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.short-pool-col {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 120px;
}
.spc-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}
.spc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.78rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s;
}
.spc-item:hover { background: var(--color-surface); }
.spc-item .spc-name { flex: 1; font-weight: 500; color: #e0e0e0; }
.spc-item .spc-pct { font-weight: 700; margin-left: 8px; cursor: pointer; }
.spc-item .spc-pct.up { color: #ef4444; }
.spc-item .spc-pct.down { color: #22c55e; }
.spc-item .spc-pct.flat { color: #888; }

/* +自选按钮 */
.spc-fav-btn {
  width: 22px; height: 22px; padding: 0; margin: 0 6px;
  border: 1px solid var(--color-border); border-radius: 50%;
  background: transparent; color: var(--color-text-muted);
  font-size: 0.8rem; font-weight: 700; line-height: 20px;
  cursor: pointer; flex-shrink: 0; text-align: center;
  transition: all 0.15s;
}
.spc-fav-btn:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-bg); }
.spc-fav-btn.added { border-color: var(--color-success); color: var(--color-success); background: rgba(73,170,25,0.1); cursor: default; }
.spc-fav-btn:disabled { opacity: 1; }

/* ── Dashboard: Mood Panel ── */
.mood-panel {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 20px;
}
.mood-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.mood-title { font-weight:600; font-size:0.95rem; }
.mood-date { font-size:0.72rem; color:var(--color-text-muted); }
.mood-body { display:flex; gap:24px; }
.mood-left { flex:1; display:flex; flex-direction:column; gap:10px; }
.mood-row { display:flex; align-items:center; gap:10px; }
.mood-label { width:40px; font-size:0.78rem; color:var(--color-text-muted); text-align:right; }

/* ── 自选速览 T日配置行 ── */
.fav-config-row {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--color-border-light);
  font-size: 0.82rem;
}
.fav-config-row input[type="date"] {
  background: var(--color-bg); color: var(--color-text);
  border: 1px solid var(--color-border); border-radius: 4px;
  padding: 2px 6px; font-size: 0.78rem;
}
.fav-config-row input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.8);
  cursor: pointer;
}
.mood-bar-wrap { flex:1; height:10px; border-radius:5px; background:var(--color-bg); overflow:hidden; }
.mood-bar { height:100%; border-radius:5px; transition:width 0.4s; }
.mood-bar.up { background:var(--color-danger); }
.mood-bar.down { background:var(--color-success); }
.mood-bar.flat { background:#424242; }
.mood-count { width:52px; font-size:0.78rem; color:var(--color-text); text-align:left; }
.mood-right { display:flex; flex-direction:column; gap:12px; padding-left:24px; border-left:1px solid var(--color-border); min-width:90px; }
.mood-limit-item { text-align:center; }
.mood-limit-item .ml-num { font-size:1.4rem; font-weight:700; }
.mood-limit-item .ml-num.up { color:var(--color-danger); }
.mood-limit-item .ml-num.down { color:var(--color-success); }
.mood-limit-item .ml-label { font-size:0.72rem; color:var(--color-text-muted); }

/* ── Dashboard: Hot Stocks ── */
.hot-stock-list { display:grid; grid-template-columns:repeat(auto-fit, minmax(280px, 1fr)); gap:12px; }
.hot-stock-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  display:flex; align-items:center; gap:14px;
}
.hot-stock-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.hot-stock-card .hs-info { flex:1; min-width:0; }
.hot-stock-card .hs-name { font-weight:600; font-size:0.9rem; color:var(--color-text); }
.hot-stock-card .hs-code { font-size:0.72rem; color:var(--color-text-muted); }
.hot-stock-card .hs-price { font-size:1.1rem; font-weight:700; color:var(--color-text); margin-top:4px; }
.hot-stock-card .hs-pct { font-size:0.85rem; font-weight:600; }
.hot-stock-card .hs-chart { width:80px; height:36px; flex-shrink:0; }
.hot-placeholder { display:flex; align-items:center; justify-content:center; border:1px dashed var(--color-border); border-radius:6px; width:80px; height:36px; color:var(--color-text-muted); font-size:0.6rem; }

/* ── Dashboard: Bottom Status Bar ── */
.status-bar {
  display:flex;
  align-items:center;
  gap:16px;
  padding:10px 0;
  font-size:0.78rem;
  color:var(--color-text-muted);
  flex-wrap:wrap;
}
.status-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:4px; vertical-align:middle; }
.status-dot.ok { background:#22c55e; box-shadow:0 0 5px rgba(34,197,94,0.5); }
.status-dot.err { background:#ef4444; box-shadow:0 0 5px rgba(239,68,68,0.5); }
.status-bar .sep { color:var(--color-border); }
.status-bar .refresh-hint { margin-left:auto; font-size:0.7rem; opacity:0.6; }

/* ── Sector Leaders Modal (shared by index & sector-rotation) ── */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.65); z-index: 500; align-items: center; justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: 12px; padding: 24px; max-width: 520px; width: 90vw;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6); max-height: 80vh; overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-header h3 { font-size: 1.1rem; font-weight: 700; }
.modal-close-btn {
  background: none; border: none; color: var(--color-text-muted);
  font-size: 1.4rem; cursor: pointer; padding: 4px 8px; border-radius: 4px;
}
.modal-close-btn:hover { color: var(--color-text); background: var(--color-bg); }
.modal-pct { font-size: 1.3rem; font-weight: 700; margin-bottom: 16px; }
.modal-pct.up { color: var(--color-up); }
.modal-pct.down { color: var(--color-down); }

.modal-ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 30px 0; }
.modal-ring-wrap .loading-ring { width: 60px; height: 60px; }
.modal-ring-wrap .loading-ring .pct-text { font-size: 0.8rem; }
.modal-ring-wrap .loading-text { font-size: 0.78rem; }

.leader-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.leader-table th { text-align: left; padding: 10px 12px; font-size: 0.85rem; font-weight: 600; color: var(--color-text-muted); border-bottom: 2px solid var(--color-border); }
.leader-table td { padding: 12px 12px; font-size: 0.92rem; border-bottom: 1px solid var(--color-border); }
.leader-table tr:hover { background: var(--color-bg); }
.leader-table .stock-link { color: var(--color-primary); text-decoration: none; cursor: pointer; }
.leader-table .stock-link:hover { text-decoration: underline; }
.leader-table .pct.up { color: var(--color-up); }
.leader-table .pct.down { color: var(--color-down); }
.leader-table .pct.flat { color: var(--color-text-muted); }
.modal-fade-in { animation: mfadeIn 0.25s ease; }
@keyframes mfadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
  .modal-box { width: 95vw; padding: 16px; max-height: 85vh; }
  .modal-header h3 { font-size: 1rem; }
  .modal-pct { font-size: 1.1rem; }
  .leader-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .leader-table thead, .leader-table tbody { white-space: nowrap; }
  .leader-table th, .leader-table td { padding: 8px 8px; font-size: 0.78rem; }
}

/* ── Hamburger Menu Button ── */
.hamburger-btn {
  display: none;
  background: none;
  border: none;
  color: var(--color-text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  line-height: 44px;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* ── Mobile Nav Overlay ── */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 150;
}
.mobile-nav-overlay.show { display: block; }

/* ── Responsive ── */
@media (max-width: 768px) {
  .app-header {
    padding: 0 12px;
    height: 48px;
  }
  .header-left h1, .header-left a span { display: none; }
  .header-left a svg { width: 20px; height: 20px; }

  .hamburger-btn { display: inline-flex; }

  .header-nav {
    position: fixed;
    top: 48px;
    right: -260px;
    width: 240px;
    height: calc(100vh - 48px);
    background: var(--color-card);
    border-left: 1px solid var(--color-border);
    flex-direction: column;
    padding: 12px;
    transition: right 0.25s ease;
    z-index: 200;
    overflow-y: auto;
  }
  .header-nav.open { right: 0; }

  .header-nav .nav-links {
    flex-direction: column;
    gap: 2px;
    width: 100%;
  }
  .header-nav .nav-links a {
    padding: 14px 16px;
    font-size: 0.95rem;
    border-radius: 6px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .header-nav .nav-right {
    flex-direction: column;
    width: 100%;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
  }
  .header-nav .nav-right .nav-user-area { width: 100%; justify-content: flex-start; }

  .main-content { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 1.2rem; }
  .stat-label { font-size: 0.72rem; }
  .profile-grid { grid-template-columns: 1fr; }
  .page-title { font-size: 1.15rem; }
  .page-desc { font-size: 0.8rem; }

  /* Table horizontal scroll */
  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table thead, .data-table tbody { white-space: nowrap; }

  /* Touch-friendly buttons & inputs */
  .btn { min-height: 44px; min-width: 44px; padding: 10px 16px; }
  .btn-sm { min-height: 36px; min-width: 36px; padding: 6px 10px; font-size: 0.78rem; }
  .form-input { min-height: 44px; padding: 10px 12px; font-size: 1rem; }
  .theme-select { min-height: 44px; }
  .tab { padding: 12px 14px; min-height: 44px; font-size: 0.82rem; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }

  /* Cards */
  .card-header { padding: 12px 14px; font-size: 0.9rem; }
  .card-body { padding: 14px; }

  /* Charts — reduce height */
  .chart-container { height: 260px; }

  /* Sector rotation treemap */
  #treemapChart { height: 280px !important; }
  .sector-meta { flex-direction: column; align-items: flex-start; }
  .modal-box { width: 95vw; padding: 16px; max-height: 85vh; }
  .modal-header h3 { font-size: 1rem; }
  .modal-pct { font-size: 1.1rem; }
  .leader-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .leader-table thead, .leader-table tbody { white-space: nowrap; }
  .leader-table th, .leader-table td { padding: 8px 8px; font-size: 0.78rem; }

  /* Dashboard mobile */
  .kpi-row { grid-template-columns: 1fr 1fr; gap:8px; }
  .kpi-card { padding:14px 16px; }
  .kpi-card .kpi-value { font-size:1.25rem; }
  .mid-row { grid-template-columns: 1fr; gap:12px; }
  .index-bar { grid-template-columns: 1fr 1fr; gap:8px; }
  .index-card { padding:12px 14px; }
  .index-card .ic-price { font-size:1.15rem; }
  .index-card .ic-change { font-size:0.9rem; }
  .index-kline-wrap .kline-chart { height: 300px; }
  .marquee-item { padding: 8px 14px; min-width: 180px; }
  .marquee-item .mi-name { font-size: 0.8rem; }
  .marquee-item .mi-price { font-size: 0.82rem; }
  .mood-body { flex-direction:column; gap:14px; }
  .mood-right { flex-direction:row; padding-left:0; border-left:none; border-top:1px solid var(--color-border); padding-top:14px; gap:20px; }
  .hot-stock-list { grid-template-columns: 1fr; }
  .status-bar { font-size:0.7rem; gap:8px; }

  /* Short pool grid — 2 columns on mobile */
  .short-pool-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .short-pool-col { padding: 8px 10px; min-height: auto; }
  .spc-label { font-size: 0.74rem; }
  .spc-item { font-size: 0.74rem; }
  .spc-item .spc-name { font-size: 0.72rem; }
  .spc-item .spc-pct { font-size: 0.72rem; }

  /* Marquee — ensure visible on mobile portrait */
  .marquee-section { padding: 10px 0; }
  .marquee-section .marquee-header { padding: 0 10px 8px; }
  .marquee-section .marquee-header .mh-label { font-size: 0.7rem; }
  .marquee-wrap { border-top: 1px solid rgba(0,212,170,0.1); border-bottom: 1px solid rgba(0,212,170,0.1); }
  .marquee-item { padding: 7px 12px; min-width: 160px; }

  /* Footer */
  .app-footer { padding: 10px 12px; font-size: 0.68rem; }
}

/* ── 移动端小屏 (<481px) ── */
@media (max-width: 480px) {
  .main-content { padding: 12px; }
  .kpi-row { gap: 8px; }
  .kpi-card { padding: 10px 12px; }
  .kpi-card .kpi-label { font-size: 0.68rem; }
  .kpi-card .kpi-value { font-size: 1.1rem; }
  .index-bar { gap: 8px; }
  .index-card { padding: 10px 12px; }
  .index-card .ic-price { font-size: 1rem; }
  .index-card .ic-change { font-size: 0.78rem; }
  .chart-container { height: 200px; }
  .index-kline-wrap .kline-chart { height: 240px; }
  .score-ring { width: 60px; height: 60px; font-size: 1.2rem; }
  .hot-stock-card .hs-chart { width: 64px; height: 30px; }
  .hot-placeholder { width: 64px; height: 30px; }
  .marquee-item { padding: 6px 10px; min-width: 140px; }
  .mood-label { width: 32px; font-size: 0.72rem; }
  .mood-count { width: 42px; font-size: 0.72rem; }
  .mood-right { min-width: auto; }
  .shm-cell .shm-name { width: 50px; font-size: 0.72rem; }
  .shm-cell .shm-pct { width: 48px; font-size: 0.72rem; }
  .spc-item { font-size: 0.7rem; }
  .stat-grid { grid-template-columns: 1fr; }
  .data-table th, .data-table td { padding: 6px 8px; font-size: 0.75rem; }
  .form-input { font-size: 1rem; }
  .short-pool-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .hot-stock-list { grid-template-columns: 1fr; }
}

/* Spinner for AI loading */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── 自选速览使用说明 ── */
.tutorial-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  border: 1.5px solid var(--color-text-muted);
  color: var(--color-text-muted); font-size: 0.68rem; font-weight: 700;
  cursor: pointer; line-height: 1;
  transition: all 0.2s;
  vertical-align: middle; margin-left: 4px; position: relative; top: -1px;
}
.tutorial-trigger:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(22,119,255,0.08);
}

.tutorial-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s;
}
.tutorial-overlay.show { opacity: 1; pointer-events: auto; }

.tutorial-dialog {
  width: 420px; max-width: 92vw;
  background: var(--color-surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  overflow: hidden;
}
.tutorial-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.tutorial-title { font-weight: 600; font-size: 0.95rem; flex: 1; }
.tutorial-step { font-size: 0.72rem; color: var(--color-text-muted); }
.tutorial-close {
  background: none; border: none; color: var(--color-text-muted);
  font-size: 1.4rem; cursor: pointer; padding: 0; line-height: 1;
}
.tutorial-close:hover { color: var(--color-text); }

.tutorial-body {
  position: relative; min-height: 220px;
}
.tut-slide {
  display: none; padding: 16px 24px 4px; text-align: center;
}
.tut-slide.active { display: block; }

.tut-viz {
  width: 100%; min-height: 130px; margin-bottom: 4px;
  display: flex; align-items: center; justify-content: center;
}
.tut-desc {
  font-size: 0.85rem; color: var(--color-text-muted); line-height: 1.7;
  max-width: 340px; margin: 0 auto;
}
.tut-hl {
  color: var(--color-primary); font-weight: 600;
}

/* 教学插画（HTML模拟UI） */
.tut-mock {
  position: relative; display: inline-block;
  background: var(--color-bg); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px; padding: 10px 12px;
  width: 280px; text-align: left;
}

/* 模拟面板 */
.tmm-panel { }
.tmm-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.tmm-title { font-weight: 600; font-size: 0.8rem; color: var(--color-text); }
.tmm-count { font-size: 0.62rem; color: var(--color-text-muted); }
.tmm-chart {
  position: relative; height: 70px; background: rgba(255,255,255,0.02);
  border-radius: 4px; overflow: hidden;
}
.tmm-line {
  position: absolute; border-bottom: 1.5px solid #1677ff;
}
.tmm-grid-line {
  position: absolute; left: 0; right: 0; height: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

/* 模拟标签页 */
.tmm-tab-bar { display: flex; gap: 0; }
.tmm-tab {
  padding: 5px 12px; font-size: 0.7rem; color: var(--color-text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tmm-tab-on {
  color: var(--color-primary); border-bottom-color: var(--color-primary);
}
.tmm-chart-legend { display: flex; gap: 8px; flex-wrap: wrap; }
.tmm-legend { font-size: 0.62rem; color: var(--color-text-muted); display: flex; align-items: center; gap: 3px; }
.tmm-ldot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }

/* 模拟T日 */
.tmm-tdate-row { display: flex; align-items: center; gap: 8px; }
.tmm-tdate-label { font-size: 0.68rem; color: var(--color-text-muted); }
.tmm-tdate-val {
  font-size: 0.72rem; color: var(--color-text);
  padding: 2px 8px; border: 1px solid rgba(255,255,255,0.12); border-radius: 4px;
}
.tmm-tdate-hint { font-size: 0.62rem; color: var(--color-text-muted); }

/* 模拟涨跌观测 */
.tmm-obs-card {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; background: var(--color-surface); border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.06);
}
.tmm-obs-name { font-size: 0.72rem; color: var(--color-text); }
.tmm-obs-code { font-size: 0.6rem; color: var(--color-text-muted); margin-left: auto; }
.tmm-obs-btn {
  font-size: 0.58rem; color: #d89614; border: 1px solid #d89614;
  padding: 2px 6px; border-radius: 3px; margin-left: 4px; white-space: nowrap;
}
.tmm-obs-btn-on {
  font-size: 0.58rem; color: #111; background: #d89614;
  padding: 2px 6px; border-radius: 3px; margin-left: 4px; white-space: nowrap;
}

/* 箭头标注 */
.tut-arrow {
  position: absolute; pointer-events: none; z-index: 2;
  width: 0; height: 0;
}
.tut-arrow-down {
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid #ef232a;
}
.tut-arrow-up {
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 8px solid #ef232a;
}
.tut-arrow-right {
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid #ef232a;
}
.tut-arrow-left {
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 8px solid #ef232a;
}
@keyframes tutBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}
.tut-arrow-bounce {
  animation: tutBounce 1.2s ease-in-out infinite;
}
.tut-label {
  position: absolute; font-size: 0.62rem; color: #ef232a; font-weight: 600;
  white-space: nowrap; pointer-events: none; z-index: 3;
}

/* Footer */
.tutorial-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.tut-dots { display: flex; gap: 6px; }
.tut-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  transition: background 0.2s;
}
.tut-dot.active { background: var(--color-primary); }

.tut-btns { display: flex; gap: 8px; }
.tut-btn {
  padding: 7px 16px; border-radius: 6px; border: none;
  font-size: 0.8rem; cursor: pointer; transition: all 0.15s;
}
.tut-btn-prev {
  background: rgba(255,255,255,0.06); color: var(--color-text-muted);
}
.tut-btn-prev:hover { background: rgba(255,255,255,0.1); color: var(--color-text); }
.tut-btn-next, .tut-btn-done {
  background: var(--color-primary); color: #fff;
}
.tut-btn-next:hover, .tut-btn-done:hover { background: var(--color-primary-hover); }

/* ── 自选速览模糊锁定覆盖层 ── */
.fav-blur-wrapper { position: relative; overflow: hidden; }
.fav-blur-wrapper .fav-blur-content {
  filter: blur(8px); user-select: none; pointer-events: none;
  opacity: 0.6; transition: filter 0.3s;
}
.fav-blur-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background: rgba(8, 8, 8, 0.55); z-index: 10; border-radius: 10px;
  gap: 12px; text-align: center; padding: 20px;
}
.fav-blur-overlay .lock-icon { font-size: 2.2rem; opacity: 0.8; }
.fav-blur-overlay .lock-title { font-size: 1rem; font-weight: 600; color: var(--color-text); }
.fav-blur-overlay .lock-desc {
  font-size: 0.82rem; color: var(--color-text-muted); max-width: 260px; line-height: 1.6;
}
.fav-blur-overlay .lock-cta {
  display: inline-block; padding: 8px 20px; border-radius: 6px;
  background: linear-gradient(135deg, #f59e0b, #d97706); color: #fff;
  font-size: 0.85rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.fav-blur-overlay .lock-cta:hover { opacity: 0.9; }
#favQuickPanel .fav-blur-overlay { gap: 8px; padding: 14px; }
#favQuickPanel .fav-blur-overlay .lock-icon { font-size: 1.6rem; }
#favQuickPanel .fav-blur-overlay .lock-title { font-size: 0.88rem; }
#favQuickPanel .fav-blur-overlay .lock-desc { font-size: 0.74rem; max-width: 220px; }

/* ── 加载蒙版 ── */
#appLoadingMask {
  position: fixed; inset: 0; z-index: 10000;
  width: 100vw; height: 100vh;
  background: var(--color-bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: opacity 0.5s ease;
}
#appLoadingMask.fade-out { opacity: 0; pointer-events: none; }

.alm-logo {
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 2.2rem; font-weight: 700; letter-spacing: 3px;
  background: linear-gradient(90deg, #00d4aa, #00a8e8);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.alm-ring { position: relative; width: 60px; height: 60px; margin: 32px 0; }
.alm-ring span {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: var(--color-primary);
  animation: almSpin 1s linear infinite;
}
.alm-ring span:nth-child(2) {
  inset: 6px;
  border-top-color: #00d4aa;
  animation-duration: 1.5s;
  animation-direction: reverse;
}
.alm-ring span:nth-child(3) {
  inset: 12px;
  border-top-color: #0ea5e9;
  animation-duration: 2s;
}

.alm-status {
  color: var(--color-text-muted);
  font-size: 0.82rem;
  min-height: 1.4em;
  transition: opacity 0.3s;
}

@keyframes almSpin { to { transform: rotate(360deg); } }
