:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --border: #e6e8eb;
  --text: #1f2329;
  --muted: #8a919f;
  --primary: #2f6bff;
  --primary-dark: #1f55e0;
  --up: #e64545;    /* 涨：红 */
  --down: #0a9b6c;  /* 跌：绿 */
  --flat: #8a919f;
  --gold: #f5a623;
  --shadow: 0 1px 3px rgba(30, 40, 60, .08), 0 4px 16px rgba(30, 40, 60, .05);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

/* ---------- 顶栏 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: #fff; border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, #e64545, #f5a623);
  color: #fff; font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.brand h1 { margin: 0; font-size: 18px; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.clock { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.badge.live {
  background: #eaf7f0; color: var(--down); font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}

/* ---------- 布局与左侧导航 ---------- */
.layout { display: flex; align-items: flex-start; min-height: calc(100vh - 65px); }
.sidebar {
  width: 208px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--border);
  padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-title { font-size: 12px; color: var(--muted); padding: 0 10px 10px; }
.tab {
  display: block; width: 100%; text-align: left; border: none; background: transparent; cursor: pointer;
  padding: 11px 14px; border-radius: 8px; font-size: 15px; font-weight: 600;
  color: var(--muted); transition: all .15s; margin-bottom: 4px;
}
.tab:hover { background: #f0f3f7; color: var(--text); }
.tab.active { background: #eaf0ff; color: var(--primary); }

/* ---------- 面板 ---------- */
main { flex: 1; min-width: 0; padding: 20px 24px 60px; }
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; position: static; height: auto; display: flex; overflow-x: auto;
             border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar .tab { width: auto; white-space: nowrap; margin-bottom: 0; }
  .sidebar-title { display: none; }
}
.panel { display: none; }
.panel.active { display: block; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 20px; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card h3 { margin: 0 0 12px; font-size: 15px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.muted { color: var(--muted); font-size: 12px; }

/* ---------- 涨跌配色 ---------- */
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.pill { padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.pill.up { background: #fdeaea; color: var(--up); }
.pill.down { background: #e8f6f0; color: var(--down); }
.pill.flat { background: #f0f1f3; color: var(--flat); }

/* ---------- 市场概览 ---------- */
.index-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
.index-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.index-card .name { font-size: 13px; color: var(--muted); }
.index-card .price { font-size: 22px; font-weight: 700; margin: 4px 0 2px; }
.index-card .chg { font-size: 13px; }

.breadth-card .bar-row { display: flex; align-items: center; gap: 10px; margin: 6px 0; }
.breadth-card .bar-label { width: 72px; font-size: 12px; color: var(--muted); }
.breadth-card .bar { flex: 1; height: 12px; background: #eef0f3; border-radius: 6px; overflow: hidden; }
.breadth-card .bar > span { display: block; height: 100%; border-radius: 6px; }
.breadth-card .bar-val { width: 60px; text-align: right; font-weight: 600; font-size: 13px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 12px; background: #fafbfc; }
tbody tr:hover { background: #f8faff; }
td .name-link { color: var(--primary); cursor: pointer; font-weight: 600; }
td .code { color: var(--muted); font-size: 12px; margin-left: 6px; }
.tag { font-size: 11px; color: var(--gold); border: 1px solid var(--gold); border-radius: 5px; padding: 0 5px; margin-left: 6px; }

/* ---------- 会议 ---------- */
.meeting-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: start; }
.meeting-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.meeting-card.current { border: 2px solid var(--primary); }
.meeting-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.meeting-time { font-size: 20px; font-weight: 800; color: var(--primary); font-variant-numeric: tabular-nums; }
.meeting-name { font-size: 15px; font-weight: 700; }
.meeting-label { font-size: 12px; color: var(--muted); }
.meeting-focus { font-size: 12px; color: var(--muted); }
.meeting-badge { margin-left: auto; }
.pick-grid { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 14px; }
@media (max-width: 1180px) { .meeting-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .meeting-list { grid-template-columns: 1fr; } }
.pick-card { border: 1px solid var(--border); border-radius: 10px; padding: 14px; background: #fcfdff; }
.pick-top { display: flex; justify-content: space-between; align-items: flex-start; }
.pick-title { font-size: 15px; font-weight: 700; }
.pick-score { text-align: center; }
.pick-score .num { font-size: 26px; font-weight: 800; color: var(--primary); }
.pick-score .lbl { font-size: 11px; color: var(--muted); }
.pick-sub { font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.team-bars { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.team-bar { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.team-bar .tb-name { width: 84px; color: var(--muted); }
.team-bar .tb-track { flex: 1; height: 7px; background: #eef0f3; border-radius: 4px; overflow: hidden; }
.team-bar .tb-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #6c8cff, #2f6bff); }
.team-bar .tb-val { width: 34px; text-align: right; color: var(--muted); }
.reasons { margin: 8px 0; padding-left: 18px; font-size: 12px; color: #4b5261; }
.reasons li { margin: 3px 0; }
.plan { background: #f6f8fb; border-radius: 8px; padding: 8px 10px; font-size: 12px; margin: 8px 0; }
.plan .row { display: flex; justify-content: space-between; margin: 2px 0; }
.pick-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.advice-line { font-size: 12px; color: var(--muted); }

/* ---------- 按钮 ---------- */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.btn:hover { background: #f0f3f7; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--up); }
.btn.danger:hover { background: #fdeaea; }
.btn.ghost { border: none; background: transparent; color: var(--muted); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 持仓 ---------- */
.add-card input {
  padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
  width: 160px;
}
.add-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------- 自选管理 ---------- */
.wl-toolbar { display: flex; gap: 8px; align-items: center; }
.wl-toolbar input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; width: 200px;
}
table input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }
.holding-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.holding-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.holding-top { display: flex; justify-content: space-between; }
.holding-pnl { text-align: right; }
.holding-pnl .amt { font-size: 18px; font-weight: 700; }
.action-badge {
  display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 13px;
  margin: 8px 0;
}
.action-badge.hold { background: #eaf7f0; color: var(--down); }
.action-badge.add { background: #fdeaea; color: var(--up); }
.action-badge.cut { background: #fff4e0; color: #b97a00; }
.action-badge.stop { background: #ffeaea; color: #d21c1c; }
.levels { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 8px; }
.levels b { color: var(--text); }

/* ---------- 复盘 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; text-align: center; box-shadow: var(--shadow); }
.stat-card .v { font-size: 26px; font-weight: 800; }
.stat-card .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }
.win-row { display: flex; align-items: center; gap: 10px; margin: 8px 0; }
.win-row .wname { width: 130px; font-size: 13px; }
.win-row .wbar { flex: 1; height: 10px; background: #eef0f3; border-radius: 5px; overflow: hidden; }
.win-row .wbar > span { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.win-row .wval { width: 110px; text-align: right; font-size: 12px; color: var(--muted); }
.trend-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.trend-chip { border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: 12px; background: #fafbfc; }
.trend-chip b { margin-left: 6px; }
.trend-example { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; background: rgba(20,25,35,.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal.hidden { display: none; }
.modal-box { background: #fff; border-radius: 14px; width: min(820px, 100%); max-height: 90vh; overflow: auto; padding: 18px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; }
.modal-trend { margin: 10px 0; font-size: 13px; }
#modal-chart { width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; background: #fcfdff; }
#modal-body { margin-top: 10px; font-size: 13px; }

/* ---------- 关于 / 页脚 ---------- */
.about h2 { margin-top: 0; }
.about h3 { margin: 20px 0 6px; }
.about code { background: #f0f3f7; padding: 2px 6px; border-radius: 5px; font-size: 12px; }
.risk-box { background: #fff7e8; border: 1px solid #ffd591; border-radius: 10px; padding: 12px 14px; }
.footer { text-align: center; padding: 20px 24px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); background: #fff; }

.spinner {
  display: inline-block; width: 14px; height: 14px; border: 2px solid #cbd2dd;
  border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }
