:root {
  --up: #e0312e;        /* 涨：红 */
  --down: #0a9c62;      /* 跌：绿 */
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e4e8f0;
  --text: #1d2433;
  --muted: #7b8494;
  --accent: #2c6be5;
  --warn: #e58a2c;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
  background: var(--bg); color: var(--text); min-height: 100vh;
}

/* 顶栏 */
.topbar {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between;
  background: var(--panel); border-bottom: 1px solid var(--line); padding: 14px 28px;
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; gap: 12px; align-items: center; }
.logo { font-size: 30px; }
.brand h1 { font-size: 19px; }
.sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.add-form { display: flex; gap: 8px; flex-wrap: wrap; }
.add-form input {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; font-size: 14px; width: 150px;
  outline: none; transition: border .15s;
}
.add-form input:focus { border-color: var(--accent); }
.btn {
  border: none; border-radius: 8px; padding: 9px 16px; font-size: 14px; cursor: pointer;
  background: #edf1f7; color: var(--text); transition: filter .15s;
}
.btn:hover { filter: brightness(.95); }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.mini { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn.danger { background: #fdeceb; color: var(--up); }

main { max-width: 1200px; margin: 20px auto; padding: 0 20px; display: flex; flex-direction: column; gap: 20px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px 22px; }
.panel.hidden { display: none; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.panel-head h2 { font-size: 17px; }
.muted { color: var(--muted); font-size: 12px; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
th:first-child, td:first-child { text-align: left; }
tbody tr { cursor: pointer; transition: background .12s; }
tbody tr:hover { background: #f7f9fd; }
tbody tr.active { background: #eef4ff; }
.stock-name { font-weight: 600; }
.stock-code { color: var(--muted); font-size: 12px; margin-left: 6px; }
.num-up { color: var(--up); font-weight: 600; }
.num-down { color: var(--down); font-weight: 600; }
.empty-hint { text-align: center; color: var(--muted); padding: 36px 0; font-size: 14px; }
.loading-cell { color: var(--muted); font-size: 12px; }

.score-pill {
  display: inline-block; min-width: 44px; text-align: center; padding: 3px 10px; border-radius: 999px;
  font-weight: 700; font-size: 13px;
}
.score-hi { background: #fdeceb; color: var(--up); }
.score-mid { background: #fff4e5; color: var(--warn); }
.score-lo { background: #e7f6ef; color: var(--down); }

.action-tag {
  display: inline-block; padding: 3px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; color: #fff;
}
.act-加仓 { background: var(--up); }
.act-继续持有 { background: #d8722c; }
.act-减仓 { background: #3b82a0; }
.act-清仓 { background: var(--down); }

/* 详情 */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }
.card { background: #fbfcfe; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.card h3 { font-size: 14px; margin-bottom: 12px; color: #3a4358; }

.score-card { display: flex; gap: 20px; align-items: center; }
.score-ring { width: 150px; height: 150px; }
.score-dims { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.dim-row { font-size: 13px; }
.dim-label { display: flex; justify-content: space-between; margin-bottom: 4px; color: #3a4358; }
.dim-bar { height: 8px; border-radius: 4px; background: #e9edf4; overflow: hidden; }
.dim-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #6ea8ff, var(--accent)); }

.advice-card { display: flex; flex-direction: column; gap: 12px; }
.advice-head { display: flex; align-items: center; gap: 12px; }
.action-badge { font-size: 20px; font-weight: 800; padding: 6px 20px; border-radius: 10px; color: #fff; }
.hold-verdict { font-size: 14px; font-weight: 600; }
.flag-row { display: flex; gap: 8px; flex-wrap: wrap; }
.flag {
  font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted);
}
.flag.bad { background: #fdeceb; border-color: #f5c6c4; color: var(--up); }
.flag.ok { background: #e7f6ef; border-color: #bfe6d4; color: var(--down); }
.advice-text { font-size: 14px; line-height: 1.7; color: #3a4358; }
.pnl-box { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.pnl-box b { font-size: 15px; }

.chart { width: 100%; }
.chart.kline { height: 460px; }
.chart.money { height: 260px; }

.reason-list { list-style: none; display: flex; flex-direction: column; gap: 8px; max-height: 260px; overflow-y: auto; }
.reason-list li { font-size: 13px; line-height: 1.6; padding-left: 22px; position: relative; }
.reason-list li::before { position: absolute; left: 0; }
.reason-list li.good::before { content: "✔"; color: var(--up); }
.reason-list li.bad::before { content: "✘"; color: var(--down); }
.reason-list li.neutral::before { content: "•"; color: var(--muted); }
.reason-dim { color: var(--muted); font-size: 11px; margin-right: 6px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; }

.news-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.news-list li { border-bottom: 1px dashed var(--line); padding-bottom: 10px; }
.news-title { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--text); }
.news-title:hover { color: var(--accent); }
.news-meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.senti { font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 8px; }
.senti-negative, .senti-strong_negative { background: #fdeceb; color: var(--up); }
.senti-positive { background: #e7f6ef; color: var(--down); }
.senti-neutral { background: #eef1f6; color: var(--muted); }
.news-snip { font-size: 12px; color: #5a6274; margin-top: 5px; line-height: 1.6; }

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

.btn.danger.confirming { background: var(--up); color: #fff; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: #2b3242; color: #fff; font-size: 13px; padding: 10px 20px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 99;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.spin { display: inline-block; animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
