/* 天智股票分析系统 — 深色仪表盘 */
:root {
  --bg: #0a0e14;
  --panel: #131823;
  --panel2: #1a2030;
  --border: #232a3a;
  --text: #c9d4e3;
  --muted: #6b7889;
  --accent: #2f81f7;
  --cyan: #39d0d8;
  --gold: #e3b341;
  --up: #f85149;      /* 涨/净流入 红 */
  --down: #3fb950;    /* 跌/净流出 绿 */
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #16203a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  font-size: 13px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
.up { color: var(--up); } .down { color: var(--down); } .muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  background: rgba(19,24,35,.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar .logo { height: 54px; width: auto; flex: 0 0 auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .45)); }
.brand { display: flex; flex-direction: column; gap: 4px; font-size: 38px; font-weight: 800;
  line-height: 1.04; letter-spacing: 3px;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;   /* 标题：黑体 */
  background: linear-gradient(90deg, #ffffff, #5aa2ff 55%, #39d0d8); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent; }
.brand .slogan { font-size: 18px; font-weight: 500; letter-spacing: 4px; text-align: center;
  font-family: "STKaiti", "KaiTi", "楷体", "SimKai", serif;   /* 口号：楷体，与标题区分，居中对齐 */
  background: linear-gradient(90deg, #3fb950, #39d0d8); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent; }
.topbar .spacer { flex: 1; }
.topbar .chip { background: var(--panel2); border: 1px solid var(--border);
  border-radius: 14px; padding: 4px 12px; font-size: 12px; color: var(--muted); }
.topbar .chip b { color: var(--text); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--down); margin-right: 5px; box-shadow: 0 0 6px var(--down); }
.dot.sample { background: var(--gold); box-shadow: 0 0 6px var(--gold); }

.wrap { padding: 16px 22px 40px; max-width: 1560px; margin: 0 auto; }

/* 资金条 */
.funds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { background: linear-gradient(180deg, var(--panel) 0%, #11151f 100%);
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.kpi.k-pos::before { background: var(--up); } .kpi.k-neg::before { background: var(--down); }
.kpi .label { font-size: 12px; color: var(--muted); }
.kpi .val { font-size: 24px; font-weight: 700; margin-top: 6px; }
.kpi .sub { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* 网格 */
.grid { display: grid; grid-template-columns: 1.1fr 1.3fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; margin-top: 16px; }
.full { margin-top: 16px; }
@media (max-width: 1100px) { .funds { grid-template-columns: repeat(2,1fr); }
  .grid, .grid3 { grid-template-columns: 1fr; } }

/* 卡片 */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  display: flex; flex-direction: column; min-height: 0; }
.card > .head { display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--border); }
.card > .head .title { font-weight: 600; font-size: 14px; }
.card > .head .title i { color: var(--cyan); margin-right: 6px; }
.card > .head .spacer { flex: 1; }
.card > .body { padding: 6px 8px; overflow: auto; }
.card.fixed > .body { max-height: 360px; }

/* 标签页 */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { padding: 4px 12px; border-radius: 8px; font-size: 12px; cursor: pointer;
  color: var(--muted); border: 1px solid transparent; }
.tab:hover { color: var(--text); }
.tab.on { color: #fff; background: var(--panel2); border-color: var(--border); }
.tab .n { color: var(--muted); font-size: 11px; margin-left: 4px; }

/* 股票池小目录（子标签） */
.subtabs { display: flex; gap: 4px; padding: 8px 12px 4px; border-bottom: 1px solid var(--border); }
.subtab { padding: 5px 14px; border-radius: 8px 8px 0 0; font-size: 12.5px; cursor: pointer;
  color: var(--muted); border: 1px solid transparent; border-bottom: 2px solid transparent; }
.subtab:hover { color: var(--text); }
.subtab.on { color: #fff; background: var(--panel2); border-bottom-color: var(--cyan); }
.subtab .n { color: var(--muted); font-size: 11px; margin-left: 4px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th, td { padding: 7px 9px; text-align: right; white-space: nowrap; border-bottom: 1px solid #1c2230; }
th { color: var(--muted); font-weight: 500; position: sticky; top: 0; background: var(--panel);
  text-align: right; font-size: 11.5px; }
td.l, th.l { text-align: left; } td.c, th.c { text-align: center; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: #1b2233; }
tbody tr.sel td { background: #1d2742; }
.code { color: var(--cyan); font-weight: 600; }
.badge { display: inline-block; min-width: 18px; padding: 0 6px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.tag { display: inline-block; padding: 1px 7px; margin: 1px; border-radius: 6px;
  background: #1c2433; color: #8fb6ff; font-size: 11px; border: 1px solid #243049; }
.v-up { color: var(--up); font-weight: 700; } .v-down { color: var(--down); font-weight: 700; }

/* 个股详情 */
#kline { width: 100%; height: 300px; }
.ind-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 10px 14px; }
.ind { background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.ind .k { font-size: 11px; color: var(--muted); } .ind .v { font-size: 15px; font-weight: 600; margin-top: 2px; }
.detail-head { display: flex; align-items: baseline; gap: 12px; padding: 10px 16px 0; }
.detail-head .nm { font-size: 17px; font-weight: 700; }
.detail-head .px { font-size: 20px; font-weight: 700; }

/* 交易计算 */
.plan-bar { display: flex; gap: 10px; padding: 8px 14px; flex-wrap: wrap; align-items: center; }
.plan-bar input { background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 5px 10px; width: 120px; }
.btn { background: var(--accent); color: #fff; border: 0; border-radius: 7px; padding: 6px 14px;
  cursor: pointer; font-size: 12px; } .btn:hover { filter: brightness(1.1); }
.btn.ghost { background: var(--panel2); border: 1px solid var(--border); color: var(--text); }
.mini { font-size: 11px; color: var(--muted); }

/* 准确度 */
.acc-row { display: flex; gap: 16px; padding: 12px 16px; flex-wrap: wrap; }
.acc { flex: 1; min-width: 120px; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; text-align: center; }
.acc .big { font-size: 26px; font-weight: 700; } .acc .lab { font-size: 11px; color: var(--muted); }
.empty { padding: 24px 16px; color: var(--muted); text-align: center; font-size: 12.5px; }

/* 个股详情搜索 + 子区标题 + 交易表单 */
.search { background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 7px; padding: 5px 10px; width: 140px; font-size: 12px; }
.sub-title { font-size: 12px; color: var(--cyan); font-weight: 600; padding: 8px 10px 2px; }
.sub-title .n { color: var(--muted); font-weight: 400; margin-left: 5px; }
.trade-form, .trade-filter, .hold-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--border); }
.trade-filter { border-bottom: 0; }
.trade-form input, .trade-form select, .trade-filter input, .trade-filter select,
.hold-form input, .hold-form select {
  background: var(--panel2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 5px 7px; font-size: 12px; }
.trade-form input, .hold-form input { width: 66px; }
.trade-form input.code, .hold-form input.code { width: 84px; }
.trade-filter input { width: 80px; }
.btn.sm { padding: 4px 11px; font-size: 11.5px; }
.dir-buy { color: var(--up); font-weight: 600; } .dir-sell { color: var(--down); font-weight: 600; }

/* 总资金人工输入：输入框 + 保存按钮 */
.total-edit { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.kpi .kpi-input { background: var(--panel2); border: 1px solid var(--accent); color: var(--text);
  border-radius: 7px; padding: 3px 8px; width: 110px;
  font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .kpi-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(47, 129, 247, .35); }
.total-edit .btn.sm { flex: 0 0 auto; }

/* 策略选股：按策略维度分组 */
.strat-grp { padding: 8px 12px; border-bottom: 1px solid #1c2230; }
.strat-h { font-size: 12.5px; font-weight: 600; color: var(--cyan); }
.strat-h .n { display: inline-block; min-width: 16px; margin-left: 6px; padding: 0 6px;
  border-radius: 8px; background: var(--panel2); color: var(--muted); font-size: 11px; font-weight: 700; }
.strat-stocks { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 5px; }
.chip-s { cursor: pointer; padding: 2px 9px; border-radius: 6px; background: #1c2433;
  border: 1px solid #243049; font-size: 11.5px; }
.chip-s.up { color: #ff8a82; } .chip-s.down { color: #7fdca0; }
.chip-s:hover { border-color: var(--accent); }

/* 今日大盘分析（策略准确度下方）*/
.review { border-top: 1px solid #1c2230; margin-top: 4px; padding: 10px 16px 14px; }
.rv-title { font-size: 13px; font-weight: 700; color: var(--cyan); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px; }
.rv-trend { padding: 1px 8px; border-radius: 8px; background: var(--panel2);
  border: 1px solid #243049; color: var(--text); font-size: 11px; font-weight: 600; }
.rv-ai { padding: 1px 8px; border-radius: 8px; background: rgba(34,211,238,.12);
  border: 1px solid #1d4d57; color: var(--cyan); font-size: 11px; font-weight: 600; }
.rv-item { margin-bottom: 9px; }
.rv-t { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 2px; }
.rv-h { font-size: 12.5px; line-height: 1.75; color: var(--text); margin-bottom: 8px; }

.sm { font-size: 11px; }
.news-box { border-top: 1px solid #1c2230; margin-top: 4px; padding: 10px 16px 14px; }
.news-title { font-size: 13px; font-weight: 700; color: var(--cyan); margin-bottom: 8px; }
.news-item { display: flex; align-items: baseline; gap: 9px; padding: 5px 0;
  border-bottom: 1px solid #161b27; text-decoration: none; color: var(--text); }
.news-item:last-child { border-bottom: 0; }
.news-item:hover { color: var(--cyan); }
.news-date { flex: 0 0 auto; font-size: 11px; color: var(--muted); }
.news-head { flex: 1 1 auto; font-size: 12.5px; line-height: 1.5; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.news-src { flex: 0 0 auto; font-size: 11px; }

/* 个股因子（复用 news-box 容器） */
.fct-grp { margin-bottom: 10px; }
.fct-gh { font-size: 12px; font-weight: 600; color: var(--muted); margin: 6px 0 5px; }
.fct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 14px; }
.fct { display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  padding: 3px 0; border-bottom: 1px solid #161b27; }
.fct-k { font-size: 12px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fct-v { flex: 0 0 auto; font-size: 12.5px; font-weight: 600; }

.foot { text-align: center; color: var(--muted); font-size: 11px; margin-top: 26px; line-height: 1.8; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #283044; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* 量化因子榜：12 列宽表，窄屏横向滚动（纵向滚动 + 表头吸顶由 .card.fixed>.body 负责） */
.board-wrap { overflow-x: auto; }
.board-wrap table { min-width: 620px; }

/* 全自动纸面盘摘要条（复用 .kpi 外观，缩小适配横排）*/
.paper-summary { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 12px 4px; }
.paper-summary .kpi { flex: 1; min-width: 96px; padding: 8px 12px; }
.paper-summary .kpi .val { font-size: 17px; margin-top: 3px; }
.paper-alert { margin: 8px 12px 0; padding: 8px 14px; border-radius: 8px; font-size: 12.5px;
  background: rgba(248, 81, 73, .12); border: 1px solid rgba(248, 81, 73, .35); }
.row-stop { background: rgba(248, 81, 73, .10); }
.row-take { background: rgba(63, 185, 80, .10); }


/* 股票交易（调仓）面板 */
.deal-row{display:flex;gap:6px;margin-bottom:6px}
.deal-row .grow{flex:1}
.deal-results{margin-bottom:4px}
.dres{padding:5px 8px;cursor:pointer;font-size:13px;border-bottom:1px solid rgba(255,255,255,.06)}
.dres:hover{background:rgba(90,162,255,.16)}
.deal-hold{cursor:pointer}
.deal-hold:hover{background:rgba(90,162,255,.10)}

/* 建仓确认股数输入 */
.plan-shares{width:70px;padding:2px 5px;font-size:13px}

/* 纸面盘双账户对照（天智精选盘 vs 量化因子盘）*/
.paper-accts{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-bottom:10px;width:100%}
.paper-acct{background:#1a2130;border:1px solid #2a3344;color:#9aa7b8;border-radius:8px;padding:5px 12px;cursor:pointer;font-size:13px;transition:.15s}
.paper-acct:hover{border-color:#3a4760}
.paper-acct.on{border-color:#39d0d8;color:#e6edf5;background:#16323a}
.paper-acct b{margin-left:5px}
.paper-kpis{display:flex;gap:20px;flex-wrap:wrap;width:100%}

/* 准确度双账户对照（天智精选 vs 量化因子）*/
.acc-blk{margin-bottom:6px}
.acc-t{font-size:13px;color:var(--text);font-weight:600;padding:8px 16px 2px}

/* 策略选股主切换：天智精选 ↔ 量化因子 */
.sel-mode{margin-bottom:2px}
.sel-mode .subtab{font-weight:600}
.sel-mode .subtab.on{color:#39d0d8}
