/* A股趋势分析 — 行情终端风格 */
:root {
  --bg: #0c0f14;
  --panel: #12161f;
  --panel-2: #171c27;
  --ink: #e8ecf2;
  --muted: #8b94a3;
  --line: #1e2430;
  --up: #e15241;
  --down: #2ba471;
  --accent: #4c8dff;
  --warn: #c9a227;
  --radius: 6px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  font-size: 13px;
}

/* ---------- top ---------- */
.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 4px;
  background: var(--accent);
}
.brand-title { font-weight: 650; font-size: 15px; letter-spacing: 0.2px; }
.brand-sub { color: var(--muted); font-size: 11px; margin-top: 1px; }

.search-box { position: relative; flex: 1; max-width: 460px; display: flex; gap: 8px; }
.search-box input {
  flex: 1; height: 34px; border-radius: 4px; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink); padding: 0 10px; outline: none;
  font-size: 13px;
}
.search-box input:focus { border-color: var(--accent); }
.search-results {
  position: absolute; top: 40px; left: 0; right: 0; z-index: 20;
  background: var(--panel); border: 1px solid var(--line); border-radius: 4px;
  max-height: 280px; overflow: auto; display: none;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.search-results .item {
  padding: 8px 10px; cursor: pointer; display: flex; justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.search-results .item:hover { background: var(--panel-2); }

.top-actions { margin-left: auto; display: flex; gap: 8px; }
button {
  border: none; cursor: pointer; font-family: inherit; font-size: 12px;
  border-radius: 4px; transition: 0.12s ease;
}
.btn-primary {
  height: 34px; padding: 0 14px; background: var(--accent); color: #fff; font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  height: 34px; padding: 0 12px; background: transparent; color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-mini {
  background: var(--panel-2); color: var(--ink); padding: 4px 10px; font-size: 12px;
  border: 1px solid var(--line);
}
.btn-mini:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- layout ---------- */
.layout {
  height: calc(100vh - 52px);
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 340px;
  gap: 1px;
  background: var(--line);
}

.watchlist, .analysis, .chart-area {
  background: var(--panel);
  overflow: auto;
}
.panel-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; font-weight: 600; font-size: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.panel-foot { padding: 10px 12px; color: var(--muted); font-size: 11px; }
#watchlistList { list-style: none; padding: 6px; }
#watchlistList li {
  padding: 8px 10px; border-radius: 4px; cursor: pointer; margin-bottom: 2px;
  border: 1px solid transparent;
}
#watchlistList li:hover, #watchlistList li.active {
  background: var(--panel-2); border-color: var(--line);
}
.wl-name { font-size: 12px; font-weight: 600; }
.wl-code { color: var(--muted); font-size: 11px; font-family: var(--mono); }
.wl-pct { float: right; font-family: var(--mono); font-size: 12px; font-weight: 600; }
.wl-pct.up { color: var(--up); }
.wl-pct.down { color: var(--down); }

/* ---------- chart ---------- */
.chart-area {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.stock-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.stock-name { font-size: 20px; font-weight: 700; }
.stock-code { color: var(--muted); font-family: var(--mono); font-size: 12px; margin-top: 2px; }
.stock-price { font-size: 26px; font-family: var(--mono); font-weight: 700; text-align: right; }
.stock-pct { font-family: var(--mono); text-align: right; margin-top: 2px; font-weight: 600; }
.stock-pct.up, .stock-price.up { color: var(--up); }
.stock-pct.down, .stock-price.down { color: var(--down); }

.chart-main { flex: 1; min-height: 360px; height: calc(100vh - 280px); }
.chart-sub { height: 140px; min-height: 110px; margin-top: 4px; }
.sub-tabs { display: flex; gap: 6px; margin: 6px 0; }
.tab {
  background: transparent; color: var(--muted); border: 1px solid var(--line);
  padding: 4px 12px; border-radius: 3px; font-size: 12px;
}
.tab.active { color: var(--ink); border-color: var(--accent); background: rgba(76, 141, 255, 0.12); }

/* ---------- analysis panel ---------- */
.analysis .panel-head { background: var(--panel); }

.score-wrap { padding: 14px 14px 6px; }
.score-row {
  display: flex; align-items: baseline; gap: 8px;
}
.score-value {
  font-size: 40px; font-weight: 750; font-family: var(--mono);
  line-height: 1;
}
.score-label { color: var(--muted); font-size: 12px; }
.score-ring {
  width: 100%; height: 6px; margin-top: 10px; border-radius: 2px;
  background: var(--panel-2);
  overflow: hidden;
  position: relative;
}
.score-ring::after {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0;
  width: var(--score, 0%);
  background: var(--accent);
  border-radius: 2px;
}
.bias-row { margin-top: 12px; display: flex; gap: 10px; align-items: center; }
.bias-tag {
  padding: 3px 10px; border-radius: 3px; font-size: 12px; font-weight: 650;
  background: var(--panel-2); border: 1px solid var(--line);
}
.bias-tag.bull { color: var(--up); border-color: rgba(225, 82, 65, 0.5); background: rgba(225, 82, 65, 0.12); }
.bias-tag.bear { color: var(--down); border-color: rgba(43, 164, 113, 0.5); background: rgba(43, 164, 113, 0.12); }
.bias-tag.neutral { color: var(--muted); border-color: var(--line); }

.level-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 14px 4px; }
.level-card {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px;
}
.level-label { color: var(--muted); font-size: 11px; }
.level-val { font-family: var(--mono); font-size: 15px; margin-top: 2px; font-weight: 600; }

.section-block { padding: 12px 14px; border-top: 1px solid var(--line); }
.section-title {
  font-size: 11px; color: var(--muted); margin-bottom: 8px;
  letter-spacing: 0.6px; text-transform: uppercase; font-weight: 600;
}
.signal-list { font-size: 12px; line-height: 1.55; }
.signal-item {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 5px 8px; border-radius: 3px; margin-bottom: 4px; background: var(--panel-2);
}
.signal-item.bull { border-left: 2px solid var(--up); }
.signal-item.bear { border-left: 2px solid var(--down); }

.ai-box { font-size: 12px; line-height: 1.7; }
.ai-box h4 {
  font-size: 11px; margin: 10px 0 4px; color: var(--muted);
  letter-spacing: 0.5px; text-transform: uppercase;
}
.ai-box ul { padding-left: 16px; }
.ai-box .ai-summary { white-space: pre-wrap; }
.ai-tag {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-size: 11px; margin-right: 6px; background: var(--panel-2); border: 1px solid var(--line);
}
.ai-tag.up { color: var(--up); border-color: rgba(225,82,65,0.4); }
.ai-tag.down { color: var(--down); border-color: rgba(43,164,113,0.4); }

.market-box { font-size: 12px; line-height: 1.65; white-space: pre-wrap; }
.market-line { margin-bottom: 8px; }
.breadth-bar {
  display: flex; height: 8px; border-radius: 2px; overflow: hidden;
  background: var(--panel-2); margin: 6px 0;
}
.breadth-bar .b-up { background: var(--up); }
.breadth-bar .b-flat { background: var(--muted); opacity: 0.45; }
.breadth-bar .b-down { background: var(--down); }
.breadth-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.muted { color: var(--muted); }
.weekly-box { font-size: 12px; line-height: 1.6; }
.weekly-item {
  background: var(--panel-2); border-radius: 3px; padding: 8px 10px; margin-bottom: 6px;
  border-left: 2px solid var(--muted);
}
.weekly-item.bull { border-left-color: var(--up); }
.weekly-item.bear { border-left-color: var(--down); }
.weekly-title { font-weight: 600; margin-bottom: 2px; }

.scan-controls { display: flex; gap: 6px; margin-bottom: 8px; align-items: center; }
.scan-controls select {
  flex: 1; height: 28px; border-radius: 3px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--ink); font-size: 12px;
}
.scan-box { font-size: 12px; line-height: 1.5; }

/* 多空分布 */
.bias-summary {
  margin-bottom: 8px;
  padding: 8px 10px;
  background: var(--panel-2);
  border-radius: 4px;
  border: 1px solid var(--line);
}
.bias-pills { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.bias-pill {
  font-size: 11px; padding: 2px 8px; border-radius: 3px; font-family: var(--mono);
}
.bias-pill.bull { color: var(--up); background: rgba(225,82,65,0.12); border: 1px solid rgba(225,82,65,0.35); }
.bias-pill.bear { color: var(--down); background: rgba(43,164,113,0.12); border: 1px solid rgba(43,164,113,0.35); }
.bias-pill.flat { color: var(--muted); background: var(--panel); border: 1px solid var(--line); }

.dual-list-title {
  font-size: 11px; color: var(--muted); margin: 10px 0 6px; font-weight: 650;
}
.scan-item {
  padding: 7px 9px; border-radius: 3px; margin-bottom: 4px; cursor: pointer;
  background: var(--panel-2); border: 1px solid var(--line);
}
.scan-item:hover { border-color: var(--accent); }
.scan-item .name { font-weight: 600; font-size: 12px; }
.scan-item .meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.scan-item.bull { border-left: 2px solid var(--up); }
.scan-item.bear { border-left: 2px solid var(--down); }

.disclaimer {
  padding: 12px 14px 16px; color: var(--muted); font-size: 11px; line-height: 1.5;
  border-top: 1px solid var(--line);
}

.up { color: var(--up); }
.down { color: var(--down); }

@media (max-width: 1200px) {
  body { overflow: auto; }
  .layout {
    grid-template-columns: 1fr;
    height: auto;
    gap: 8px;
    background: var(--bg);
    padding: 8px;
  }
  .chart-main { height: 360px; }
}


/* ---------- 市场多空入口 ---------- */
.btn-bias {
  height: 34px; padding: 0 16px;
  background: #e15241; color: #fff; font-weight: 700; font-size: 13px;
  border: none; border-radius: 4px;
}
.btn-bias:hover { filter: brightness(1.08); }

.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-card {
  width: min(960px, 96vw);
  max-height: 88vh;
  background: #12161f;
  border: 1px solid #1e2430;
  border-radius: 8px;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.45);
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid #1e2430;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-sub { color: #8b94a3; font-size: 12px; margin-top: 4px; }
.modal-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.modal-actions select {
  height: 34px; border-radius: 4px; border: 1px solid #1e2430;
  background: #171c27; color: #e8ecf2; padding: 0 8px; font-size: 12px;
}
.modal-body { padding: 16px 18px 20px; overflow: auto; }
.bias-hero {
  padding: 14px 16px;
  background: #171c27;
  border: 1px solid #1e2430;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.6;
}
.bias-hero .hero-num {
  display: flex; gap: 18px; flex-wrap: wrap; margin-top: 8px;
}
.bias-hero .n-bull { color: #e15241; font-size: 28px; font-weight: 750; font-family: var(--mono); }
.bias-hero .n-flat { color: #8b94a3; font-size: 28px; font-weight: 750; font-family: var(--mono); }
.bias-hero .n-bear { color: #2ba471; font-size: 28px; font-weight: 750; font-family: var(--mono); }
.bias-hero .n-label { font-size: 12px; color: #8b94a3; display: block; }
.bias-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
@media (max-width: 800px) {
  .bias-cols { grid-template-columns: 1fr; }
}
