/* ═══════════════════════  设计语言 ═══════════════════════
   色彩：红涨绿跌（A股惯例）
   品牌：深海军蓝 + 金色 — 高级金融感
   字体：系统原生
   圆角：6px / 10px（更克制）
   阴影：极淡
═══════════════════════════════════════════════════════════ */

/* ── CSS 变量 ── */
:root {
  --sidebar-w: 210px;
  --nav-bg: #0b1120;
  --nav-hover: #162033;
  --nav-active: #1c2a44;
  --gold: #d4a734;
  --gold-dim: #b8912a;
  --gold-bg: rgba(212,167,52,.12);
  --red: #dc2626;
  --red-bg: #fef2f2;
  --red-light: #fee2e2;
  --green: #16a34a;
  --green-bg: #f0fdf4;
  --green-light: #dcfce7;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --indigo: #6366f1;
  --indigo-bg: #eef2ff;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --orange: #ea580c;
  --orange-bg: #fff7ed;
  --card-bg: #ffffff;
  --bg: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 1px 3px rgba(0,0,0,.04);
  --shadow-hover: 0 4px 12px rgba(0,0,0,.08);
  --radius: 6px;
  --radius-lg: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.6;
  margin: 0;
}
a { text-decoration: none; color: inherit; }

/* ── 涨跌色工具类 ── */
.text-up { color: var(--red) !important; }
.text-down { color: var(--green) !important; }
.bg-up { background: var(--red-bg); }
.bg-down { background: var(--green-bg); }

/* ── 左侧导航 ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--nav-bg);
  color: #9aa8b7;
  display: flex;
  flex-direction: column;
  z-index: 100;
  user-select: none;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar .logo {
  padding: 22px 18px 14px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.5px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.sidebar .logo small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #5f7a9a;
  margin-top: 2px;
  letter-spacing: 0;
}
.sidebar .nav-section {
  padding: 18px 18px 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #5f7a9a;
  font-weight: 600;
}
.sidebar .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: #9aa8b7;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .15s ease;
  border-left: 3px solid transparent;
  position: relative;
}
.sidebar .nav-item:hover {
  color: #e0e8f0;
  background: rgba(255,255,255,.04);
}
.sidebar .nav-item.active {
  color: #fff;
  background: var(--gold-bg);
  border-left-color: var(--gold);
}
.sidebar .nav-item .icon { width: 20px; text-align: center; font-size: 15px; }
.sidebar .nav-item .badge-nav {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 99px;
  font-weight: 700;
  background: var(--red);
  color: #fff;
  min-width: 18px;
  text-align: center;
  line-height: 1.2;
}
.sidebar .divider { flex: 1; }
/* 引导页入口 */
.sidebar .guide-link {
  padding: 10px 18px;
  font-size: 12px;
  color: #5f7a9a;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar .guide-link:hover { color: #9aa8b7; }

/* ── 进度条（交易链路）── */
.flow-bar {
  display: flex;
  align-items: center;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 10px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  overflow-x: auto;
  gap: 0;
}
.flow-bar .step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: .15s;
  flex-shrink: 0;
}
.flow-bar .step:hover { background: #f5f6f8; }
.flow-bar .step.active { color: var(--gold-dim); font-weight: 600; }
.flow-bar .step.done { color: var(--text-secondary); }
.flow-bar .step .dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #ddd;
  display: inline-block;
  flex-shrink: 0;
}
.flow-bar .step.active .dot { background: var(--gold-dim); box-shadow: 0 0 0 3px var(--gold-bg); }
.flow-bar .step.done .dot { background: var(--gold-dim); }
.flow-bar .step.done .check { color: var(--gold-dim); font-size: 12px; }
.flow-bar .connector {
  width: 24px;
  height: 1px;
  background: #ddd;
  flex-shrink: 0;
  margin: 0 2px;
}
.flow-bar .connector.done { background: var(--gold-dim); }

/* ── 主内容 ── */
.main {
  margin-left: var(--sidebar-w);
  padding: 24px 32px;
  max-width: 1440px;
}
.page { display: none; }
.page.active { display: block; animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── 卡片 ── */
.card-custom {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.card-custom .card-header-custom {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
}
.card-custom .card-body-custom {
  padding: 18px 20px;
}

/* ── 统计卡片网格 ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: box-shadow .15s;
}
.stat-card:hover { box-shadow: var(--shadow-hover); }
.stat-card .stat-label { font-size: 11.5px; color: var(--text-muted); margin-bottom: 2px; letter-spacing: 0.3px; }
.stat-card .stat-value { font-size: 22px; font-weight: 700; line-height: 1.2; }
.stat-card .stat-change { font-size: 11.5px; margin-top: 3px; }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; }
.table-mock {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table-mock th {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 2px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11.5px;
  white-space: nowrap;
  letter-spacing: 0.3px;
  background: #fafbfc;
}
.table-mock td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.table-mock tbody tr { transition: background .1s; }
.table-mock tbody tr:hover td { background: #f5f8ff; }
.table-mock .tag, .tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.tag-red { background: var(--red-bg); color: var(--red); }
.tag-green { background: var(--green-bg); color: var(--green); }
.tag-blue { background: var(--blue-bg); color: var(--blue); }
.tag-yellow { background: var(--amber-bg); color: var(--amber); }
.tag-gray { background: #f1f5f9; color: #64748b; }
.tag-gold { background: var(--gold-bg); color: var(--gold-dim); }
tr.row-new td { background: #fff8f8 !important; }

/* ── 筛选栏 ── */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  background: #fff;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.filter-bar label { font-size: 12px; color: var(--text-secondary); margin-right: 2px; }
.filter-bar select, .filter-bar input {
  font-size: 12.5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--gold-dim); }
.filter-bar .filter-stat { margin-left: auto; font-size: 12px; color: var(--text-muted); }

/* ── 买入信号卡片 ── */
.signal-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  transition: box-shadow .15s;
}
.signal-card:hover { box-shadow: var(--shadow-hover); }
.signal-card .sc-left { display: flex; align-items: center; gap: 12px; min-width: 160px; }
.signal-card .sc-ticker { font-weight: 700; font-size: 15px; }
.signal-card .sc-name { color: var(--text-secondary); font-size: 13px; margin-left: 6px; }
.signal-card .sc-price-group { display: flex; gap: 16px; flex-wrap: wrap; }
.signal-card .sc-item { text-align: center; }
.signal-card .sc-item .label { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.3px; }
.signal-card .sc-item .value { font-size: 15px; font-weight: 600; }
.signal-card .sc-actions { margin-left: auto; display: flex; gap: 6px; }

/* ── 系统状态网格 ── */
.sys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.sys-item {
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.sys-item .sys-name { font-size: 13px; font-weight: 600; }
.sys-item .sys-status { font-size: 12px; margin-top: 3px; }
.sys-item .sys-time { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
  flex-shrink: 0;
}
.status-dot.green { background: var(--green); }
.status-dot.yellow { background: var(--amber); }
.status-dot.red { background: var(--red); }

/* ── 新鲜度标签 ── */
.freshness-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 3px 12px;
  border-radius: 99px;
  background: #f1f5f9;
  color: var(--text-secondary);
  font-weight: 500;
}

/* ── 空状态 ── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 44px; margin-bottom: 10px; }
.empty-state .empty-text { font-size: 14px; }
.empty-state .empty-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── 按钮 ── */
.btn-sm-custom {
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: all .15s;
}
.btn-sm-custom:hover { background: #f5f6f8; }
.btn-sm-custom.primary { background: var(--gold-dim); color: #fff; border-color: var(--gold-dim); }
.btn-sm-custom.primary:hover { opacity: .85; background: var(--gold); border-color: var(--gold); }

/* ── 详情弹窗 Tab ── */
.dt-tab {
  padding: 10px 20px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s;
}
.dt-tab:hover { color: var(--text-secondary); }
.dt-tab.active { color: var(--gold-dim); border-bottom-color: var(--gold-dim); }

/* ── 评分项卡片 ── */
.score-item {
  background: #f8fafc;
  border-radius: 6px;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}
.score-item .si-label { font-size: 11px; color: var(--text-muted); min-width: 50px; }
.score-item .si-val { font-size: 13px; font-weight: 600; min-width: 40px; }
.score-item .si-pts { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.score-item .si-bar { width: 100%; height: 4px; background: #e2e8f0; border-radius: 99px; flex-basis: 100%; }

/* ── 分页 ── */
.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 8px 0;
}

/* ── Tab 内容切换 ── */
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── 弹窗 ── */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.45);
  z-index: 999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.show { display: flex; }
.modal-overlay .modal-box {
  background: #fff;
  border-radius: 14px;
  max-width: 92vw;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* ── 问号帮助提示（图标） ── */
.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e2e8f0;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  cursor: help;
  margin-left: 4px;
  flex-shrink: 0;
  transition: all .15s;
  vertical-align: middle;
}
.help-tip:hover {
  background: var(--gold-dim);
  color: #fff;
}
/* 隐藏内联提示，由JS全局提示替代 */
.help-text { display: none !important; }

/* ── 全局浮动提示（JS渲染，body层级 fixed 定位）── */
#help-tooltip {
  display: none;
  position: fixed;
  padding: 12px 16px;
  background: #0b1120;
  color: #e0e8f0;
  font-size: 12.5px;
  font-weight: 400;
  line-height: 1.6;
  border-radius: 10px;
  max-width: min(420px, 90vw);
  white-space: normal;
  z-index: 999999;
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
  text-align: left;
}
#help-tooltip.show {
  display: block;
  animation: tipIn .12s ease;
}
#help-tooltip .tip-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 7px solid transparent;
}
#help-tooltip.tip-below .tip-arrow {
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  border-bottom-color: #0b1120;
}
#help-tooltip.tip-above .tip-arrow {
  bottom: -14px;
  left: 50%;
  transform: translateX(-50%);
  border-top-color: #0b1120;
}
#help-tooltip.tip-left .tip-arrow {
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  border-left-color: #0b1120;
}
#help-tooltip.tip-right .tip-arrow {
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  border-right-color: #0b1120;
}
@keyframes tipIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.help-tip-inline {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: help;
  color: var(--text-muted);
  font-size: 12px;
  border-bottom: 1px dashed var(--border);
}
.help-tip-inline:hover {
  color: var(--gold-dim);
  border-bottom-color: var(--gold-dim);
}

/* ── 搜索框 ── */
.search-box {
  display: flex;
  gap: 8px;
  max-width: 400px;
}
.search-box input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.search-box input:focus { border-color: var(--gold-dim); }
.search-box button {
  padding: 8px 18px;
  background: var(--gold-dim);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
}
.search-box button:hover { opacity: .85; }

/* ── 新手指南（内嵌tab）── */
.guide-content { max-width:800px; line-height:1.8; }
.guide-content h2 { font-size:18px; font-weight:700; margin:28px 0 10px; padding-bottom:6px; border-bottom:1px solid var(--border); }
.guide-content h3 { font-size:15px; font-weight:700; margin:20px 0 8px; }
.guide-content p { margin:8px 0; color:var(--text-secondary); font-size:13.5px; }
.guide-content .callout { background:linear-gradient(135deg,#0b1120,#162033); color:#e0e8f0; padding:24px 28px; border-radius:14px; margin:16px 0; font-size:14px; }
.guide-content .callout h3 { color:var(--gold-dim); margin-top:0; }
.guide-content .callout .big-num { font-size:36px; font-weight:800; color:var(--gold-dim); }
.guide-content .flow-steps { display:flex; gap:0; background:#fff; border-radius:12px; padding:20px 16px; border:1px solid var(--border); margin:12px 0; }
.guide-content .flow-step { flex:1; text-align:center; padding:0 10px; }
.guide-content .flow-step .fs-icon { font-size:28px; margin-bottom:6px; }
.guide-content .flow-step .fs-title { font-weight:700; font-size:13px; }
.guide-content .flow-step .fs-desc { font-size:11px; color:var(--text-muted); margin-top:2px; }
.guide-content .flow-arrow { font-size:18px; color:var(--gold-dim); padding-top:8px; flex-shrink:0; }
.guide-content .tip-box { background:var(--amber-bg); border-left:4px solid var(--amber); padding:12px 16px; border-radius:6px; margin:10px 0; font-size:13px; color:#92400e; }
.guide-content table.guide-table { width:100%; border-collapse:collapse; font-size:13px; margin:10px 0; background:#fff; border-radius:8px; overflow:hidden; border:1px solid var(--border); }
.guide-content table.guide-table th { background:#f8fafc; padding:8px 12px; text-align:left; font-weight:600; border-bottom:2px solid var(--border); }
.guide-content table.guide-table td { padding:8px 12px; border-bottom:1px solid #f0f0f0; }
@media(max-width:700px){ .guide-content .flow-steps { flex-direction:column; } .guide-content .flow-arrow { transform:rotate(90deg); padding:2px 0; } }
@media (max-width: 900px) {
  .sidebar { width: 56px; }
  .sidebar .logo { padding: 14px 10px; font-size: 0; }
  .sidebar .logo small { display: none; }
  .sidebar .nav-section { display: none; }
  .sidebar .nav-item { padding: 12px 10px; justify-content: center; }
  .sidebar .nav-item span:not(.icon) { display: none; }
  .sidebar .nav-item .badge-nav { display: none; }
  .sidebar .nav-item .icon { width: auto; font-size: 18px; }
  .main { margin-left: 56px; padding: 16px; }
}
@media (max-width: 600px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .page-header h2 { font-size: 17px; }
  .filter-bar { padding: 10px 12px; }
  .signal-card { padding: 12px 14px; }
}

.modal-header {
  padding:16px 20px; border-bottom:1px solid var(--border);
  font-weight:600; font-size:16px; display:flex; justify-content:space-between; align-items:center;
}
.modal-body { padding:20px; overflow-y:auto; flex:1; line-height:1.7; font-size:14px; color:var(--text); white-space:pre-wrap; }
.modal-footer { padding:12px 20px; border-top:1px solid var(--border); display:flex; justify-content:flex-end; }

/* 可点击股票代码 */
.ticker-link {
  color: var(--blue);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.ticker-link:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

/* ── 名称链接（虚线提示可点击）── */
td a[onclick*="showStockDetail"]:hover { color: var(--blue) !important; border-bottom-color: var(--blue) !important; }

/* ── 买入信号：进度与优先级 ── */
.buy-progress,
.signal-priority {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.buy-progress span,
.signal-priority span {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}
.buy-progress strong,
.signal-priority strong {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.buy-progress.near span { background: #fff7ed; color: #c2410c; }
.buy-progress.watch span { background: #eff6ff; color: #2563eb; }
.buy-progress.far span { background: #f3f4f6; color: #6b7280; }
.buy-progress.triggered span { background: var(--green-light); color: var(--green); }
.buy-progress.triggered strong { color: var(--green); }
.signal-priority { gap: 5px; }
.signal-priority.high span { background: var(--red-light); color: var(--red); }
.signal-priority.medium span { background: var(--yellow-bg); color: var(--amber); }
.signal-priority.low span { background: #f3f4f6; color: #6b7280; }
.signal-priority.high strong { color: var(--red); }

/* 状态A列表中的可点击买点摘要 */
.statea-buy-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.statea-buy-summary span {
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.statea-buy-summary strong {
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}
.statea-buy-summary.near span { background: #fff7ed; color: #c2410c; }
.statea-buy-summary.watch span { background: #eff6ff; color: #2563eb; }
.statea-buy-summary.far span,
.statea-buy-summary.empty span { background: #f3f4f6; color: #6b7280; }
.statea-buy-summary.setup span { background: var(--yellow-bg); color: var(--amber); }
.statea-buy-summary.triggered span { background: var(--green-light); color: var(--green); }
.statea-buy-summary.triggered strong { color: var(--green); }
.statea-buy-summary:hover strong { color: var(--blue); text-decoration: underline; }
