* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f4f6f9; color: #222; font-size: 14px;
}
.topbar {
  background: linear-gradient(135deg, #1f2a44, #2d3e63);
  color: #fff; padding: 14px 22px; display: flex; align-items: baseline; gap: 16px;
}
.brand { font-size: 18px; font-weight: 700; }
.sub { font-size: 12px; color: #c7d0e0; }

.layout { display: flex; align-items: flex-start; gap: 16px; padding: 16px; }
.panel {
  width: 300px; flex: 0 0 300px; background: #fff; border-radius: 10px;
  padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); position: sticky; top: 16px;
}
.panel h3 { font-size: 15px; margin-bottom: 12px; color: #1f2a44; }
.panel label { display: block; font-size: 12px; color: #666; margin: 10px 0 4px; }
.panel select, .panel input {
  width: 100%; padding: 7px 8px; border: 1px solid #d8dde6; border-radius: 6px; font-size: 13px;
  background: #fff;
}
.panel select:focus, .panel input:focus { outline: none; border-color: #3a6df0; }
.grid2 { display: flex; gap: 10px; }
.grid2 > div { flex: 1; }
.params { margin-top: 6px; }
.params .prow { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.params .prow label { margin: 0; flex: 1; }
.params .prow input { width: 90px; }

.btns { display: flex; gap: 8px; margin-top: 16px; }
button {
  flex: 1; padding: 9px 10px; border: none; border-radius: 6px; font-size: 13px;
  cursor: pointer; font-weight: 600;
}
button.primary { background: #3a6df0; color: #fff; }
button.primary:hover { background: #2f5bd0; }
button#btnQuote { background: #eef1f6; color: #333; }
button#btnQuote:hover { background: #e2e7ef; }

.status { margin-top: 12px; font-size: 12px; color: #3a6df0; min-height: 16px; }
.note { margin-top: 6px; font-size: 11px; color: #999; }
.hint {
  margin-top: 14px; font-size: 11px; color: #888; line-height: 1.6;
  border-top: 1px dashed #e3e7ee; padding-top: 10px;
}
.hint code { background: #eef1f6; padding: 0 4px; border-radius: 3px; }

.risk-box { margin-top: 14px; padding: 12px; background: #fbfcfe; border: 1px solid #e6ebf3; border-radius: 8px; }
.risk-title { font-size: 12.5px; font-weight: 700; color: #1f2a44; margin-bottom: 8px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #555; margin-top: 8px; cursor: pointer; }
.check input { width: auto; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.card { background: #fff; border-radius: 10px; padding: 14px 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.card-h { font-size: 14px; font-weight: 700; color: #1f2a44; margin-bottom: 10px; }
.muted { font-size: 12px; color: #999; font-weight: 400; }
.chart { width: 100%; height: 320px; display: block; }

.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.metric {
  background: #f8fafc; border: 1px solid #eef1f6; border-radius: 8px; padding: 10px 12px;
}
.metric .k { font-size: 11px; color: #888; }
.metric .v { font-size: 17px; font-weight: 700; margin-top: 3px; }
.v.good { color: #1aa260; }
.v.bad { color: #d8392b; }
.v.neutral { color: #1f2a44; }

.report {
  background: #f8fafc; border: 1px solid #eef1f6; border-radius: 8px; padding: 12px;
  font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; color: #333; max-height: 260px; overflow: auto;
}
.table-wrap { overflow: auto; max-height: 340px; border: 1px solid #eef1f6; border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 7px 10px; text-align: center; border-bottom: 1px solid #f0f2f6; white-space: nowrap; }
th { background: #f8fafc; color: #666; position: sticky; top: 0; }
td.pos { color: #d8392b; font-weight: 600; }
td.neg { color: #1aa260; font-weight: 600; }
.tag-long { color: #d8392b; }
.tag-short { color: #1aa260; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .panel { width: 100%; flex: none; position: static; }
}

/* ---------- 登录 / 用户 ---------- */
.user-box { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 13px; }
.user-box .uname { color: #c7d0e0; }
.user-box .role-tag { background: #3a6df0; color: #fff; padding: 1px 8px; border-radius: 10px; font-size: 11px; }
.user-box button { flex: none; padding: 6px 12px; background: #eef1f6; color: #333; }

.overlay {
  position: fixed; inset: 0; background: rgba(20,28,46,.55);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
.overlay.hidden { display: none; }
.login-card { background: #fff; border-radius: 12px; padding: 26px 28px; width: 330px; box-shadow: 0 8px 30px rgba(0,0,0,.2); }
.login-card h2 { font-size: 17px; color: #1f2a44; margin-bottom: 4px; }
.login-card .sub2 { font-size: 12px; color: #999; margin-bottom: 16px; line-height: 1.5; }
.login-card label { display: block; font-size: 12px; color: #666; margin: 12px 0 4px; }
.login-card input { width: 100%; padding: 9px 10px; border: 1px solid #d8dde6; border-radius: 6px; font-size: 14px; }
.login-card input:focus { outline: none; border-color: #3a6df0; }
.login-card button { margin-top: 18px; width: 100%; padding: 10px; background: #3a6df0; color: #fff; }
.login-card .err { color: #d8392b; font-size: 12px; margin-top: 10px; min-height: 14px; }

.admin-card { border-left: 3px solid #3a6df0; }
.admin-tools { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; align-items: flex-end; }
.admin-tools input, .admin-tools select { padding: 7px 8px; border: 1px solid #d8dde6; border-radius: 6px; font-size: 13px; }
.admin-tools .grow { flex: 1; min-width: 120px; }
.admin-tools button { flex: none; width: auto; padding: 8px 14px; background: #3a6df0; color: #fff; }
.mini-btn { padding: 4px 10px; border: none; border-radius: 5px; font-size: 12px; cursor: pointer; background: #eef1f6; color: #333; }
.mini-btn.danger { background: #fdecea; color: #d8392b; }
.tab-row { display: flex; gap: 8px; margin-bottom: 12px; }
.tab-row button { flex: none; width: auto; padding: 7px 14px; background: #eef1f6; color: #444; border-radius: 6px; }
.tab-row button.active { background: #3a6df0; color: #fff; }
.hidden { display: none !important; }

/* ---------- 盘中模拟交易 播放控制台 ---------- */
.live-btn { width: 100%; margin-top: 10px; background: linear-gradient(135deg, #ff7a18, #d8392b); }
.live-btn:hover { background: linear-gradient(135deg, #f06a10, #c3301f); }
.live-card { border-left: 3px solid #ff7a18; }
.live-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.live-controls label { font-size: 12px; color: #666; margin: 0; }
.live-controls select { width: auto; padding: 7px 8px; border: 1px solid #d8dde6; border-radius: 6px; font-size: 13px; background: #fff; }
.live-controls button { flex: none; width: auto; padding: 8px 14px; border-radius: 6px; font-weight: 600; }
.live-controls button#btnLivePlay { background: #3a6df0; color: #fff; }
.live-controls button#btnLivePause,
.live-controls button#btnLiveStep,
.live-controls button#btnLiveReset { background: #eef1f6; color: #333; }

.live-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 12px; }
.live-stats .ls { background: #fff8f3; border: 1px solid #ffe2cf; border-radius: 8px; padding: 8px 10px; }
.live-stats .ls .k { font-size: 11px; color: #a25a2a; }
.live-stats .ls .v { font-size: 16px; font-weight: 700; margin-top: 2px; color: #1f2a44; }
.live-stats .ls .v.pos { color: #d8392b; }   /* 国内习惯: 涨/盈利红 */
.live-stats .ls .v.neg { color: #1aa260; }

.live-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.live-charts .lc { border: 1px solid #eef1f6; border-radius: 8px; padding: 8px; }
.live-charts .lc-h { font-size: 12px; color: #666; margin-bottom: 4px; }
.live-logs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.live-logs .ll { border: 1px solid #eef1f6; border-radius: 8px; padding: 8px; }
.live-logs .ll-h { font-size: 12px; color: #666; margin-bottom: 6px; font-weight: 700; }
.log { height: 180px; overflow: auto; font-size: 12px; line-height: 1.6; }
.log-line { padding: 2px 4px; border-bottom: 1px dashed #f0f2f6; }
.log-line .li { color: #aaa; margin-right: 6px; font-variant-numeric: tabular-nums; }
.log-line.up { color: #d8392b; }
.log-line.down { color: #1aa260; }

@media (max-width: 1100px) {
  .live-charts, .live-logs { grid-template-columns: 1fr; }
}
