:root {
  --bg: #fafafa;
  --card: #ffffff;
  --border: #e5e5e5;
  --text: #171717;
  --muted: #737373;
  --accent: #171717;
  --accent-hover: #404040;
  --up: #e53935;
  --down: #26a69a;
  --flat: #86909c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 14px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 顶栏（与主站「K线聚合」统一：白底深字） ---------- */
.topbar {
  background: #ffffff;
  color: #171717;
  height: 44px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e5e5e5;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: inherit; flex-shrink: 0;
}
.logo {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: #171717;
  color: #ffffff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
  flex-shrink: 0;
}
.brand-name { font-size: 14px; font-weight: 600; color: #171717; white-space: nowrap; }
.topbar-spacer { flex: 1; min-width: 0; }
.brand-sub { font-size: 12px; color: #a3a3a3; white-space: nowrap; }
.topnav { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.nav-link {
  font-size: 12px; color: #737373; text-decoration: none;
  padding: 6px 10px; border-radius: 6px; white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: #171717; background: #f5f5f5; }
@media (max-width: 640px) { .brand-sub { display: none; } }

/* ---------- 搜索面板 ---------- */
.search-panel {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 32px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow);
}
.search-box { position: relative; flex: 1; min-width: 320px; max-width: 560px; }
#codeInput {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#codeInput:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(23, 23, 23, 0.08); }
.suggest {
  position: absolute; top: 46px; left: 0; right: 0;
  background: #fff; border: 1px solid var(--border);
  border-radius: 10px; box-shadow: var(--shadow);
  max-height: 320px; overflow: auto;
  display: none; z-index: 30;
}
.suggest.show { display: block; }
.suggest-item {
  padding: 9px 14px; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid #f2f3f5;
}
.suggest-item:hover { background: #f5f5f5; }
.suggest-item .s-name { font-weight: 500; }
.suggest-item .s-code { color: var(--muted); font-size: 12px; }

.field { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.field select {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; background: #fff; outline: none; cursor: pointer;
}
.chk { display: flex; align-items: center; gap: 6px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.chk input { width: 16px; height: 16px; cursor: pointer; }

.btn-primary {
  padding: 11px 26px;
  font-size: 15px; font-weight:600;
  color: #fff;
  background: #171717;
  border: none; border-radius: 10px; cursor: pointer;
  transition: background 0.15s, transform 0.12s;
  white-space: nowrap;
}
.btn-primary:hover { background: #404040; }
.btn-primary:active { transform: translateY(0); }

/* ---------- 加载 / 错误 ---------- */
.loading { display: flex; flex-direction: column; align-items: center; padding: 70px 0; color: var(--muted); }
.spinner {
  width: 40px; height: 40px;
  border: 4px solid #e5e5e5; border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.error {
  margin: 20px 32px; padding: 14px 18px;
  background: #fef0f0; color: #c62828;
  border: 1px solid #f6c6c6; border-radius: 10px;
}
.hidden { display: none !important; }

/* ---------- 主体 ---------- */
main { padding: 20px 32px 40px; max-width: 1280px; margin: 0 auto; }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.hint { color: var(--muted); font-size: 12px; }

.chart { width: 100%; }
.chart.tall { height: 420px; }
.chart.mid { height: 300px; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- 概览 ---------- */
.overview { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px; }
.ov-name { font-size: 20px; font-weight: 700; }
.ov-code { color: var(--muted); font-size: 13px; font-weight: 400; margin-left: 6px; }
.ov-price { font-size: 40px; font-weight: 800; line-height: 1.1; margin-top: 4px; }
.ov-chg { font-size: 14px; font-weight: 600; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.ov-meta { display: flex; gap: 30px; flex-wrap: wrap; }
.ov-item { display: flex; flex-direction: column; gap: 3px; }
.ov-item span { color: var(--muted); font-size: 12px; }
.ov-item b { font-size: 14px; font-weight: 600; }
.ov-warn {
  width: 100%;
  padding: 8px 14px;
  background: #fff7e6;
  border: 1px solid #ffe2b3;
  border-radius: 8px;
  color: #ad6800;
  font-size: 13px;
}

/* ---------- 指标卡片 ---------- */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 1000px) { .metrics { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .metrics { grid-template-columns: 1fr; } }
.metric {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.metric::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: #c9cdd4;
}
.metric.tone-up::before { background: var(--up); }
.metric.tone-down::before { background: var(--down); }
.metric.tone-flat::before { background: #ffb300; }
.m-label { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.m-value { font-size: 20px; font-weight: 700; line-height: 1.2; }
.m-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

/* ---------- 压力/支撑 ---------- */
.lv-group { margin-bottom: 14px; }
.lv-title { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.lv-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 8px;
  background: #f7f8fa; margin-bottom: 6px;
  flex-wrap: wrap;
}
.lv-tag {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px;
  color: #fff; white-space: nowrap;
}
.lv-tag.res { background: var(--up); }
.lv-tag.sup { background: var(--down); }
.lv-tag.gap { background: #78909c; }
.lv-tag.seg { background: var(--accent); }
.lv-price { font-weight: 600; font-variant-numeric: tabular-nums; }
.lv-pct { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lv-share { color: var(--muted); font-size: 12px; }
.lv-note { color: #e65100; font-size: 12px; }
.lv-empty { color: var(--muted); font-size: 13px; padding: 4px 2px; }

/* ---------- 爆量/信号 ---------- */
.vs-block { margin-bottom: 16px; }
.vs-label { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.vs-line { margin-bottom: 5px; }
.vs-line b { font-variant-numeric: tabular-nums; }
.vs-verdict {
  margin-top: 8px; padding: 9px 12px; border-radius: 8px; font-weight: 600;
}
.vs-verdict.up { background: #fef0f0; color: var(--up); }
.vs-verdict.down { background: #e8f5f3; color: var(--down); }
.vs-signals { display: flex; flex-wrap: wrap; gap: 8px; }
.sig-chip {
  padding: 6px 12px; border-radius: 20px; font-size: 13px;
  background: #fff7e6; color: #ad6800; border: 1px solid #ffe2b3;
}

/* ---------- 龙虎榜 ---------- */
.lhb-summary { margin: 8px 0 12px; font-size: 14px; }
.lhb-table { display: flex; flex-direction: column; gap: 6px; }
.lhb-row {
  display: grid; grid-template-columns: 100px 160px 1fr; gap: 12px;
  padding: 8px 10px; background: #f7f8fa; border-radius: 8px; align-items: center;
  font-size: 13px;
}
.lhb-reason { color: var(--muted); }

/* ---------- 日内 ---------- */
.intra-head { font-size: 14px; margin-bottom: 12px; }

.disclaimer { color: var(--muted); font-size: 12px; text-align: center; padding: 10px 0 0; }
