* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --up: #d92b2b;      /* A股惯例：红涨 */
  --down: #0a9e6e;    /* 绿跌 */
  --flat: #7a8199;
  --ink: #23262f;
  --sub: #6b7280;
  --bg: #f2f3f7;
  --card: #ffffff;
  --line: #e8eaf0;
  --accent: #c53d43;
}
body {
  font-family: system-ui, -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.6;
}
.topbar {
  background: linear-gradient(135deg, #b03a3e, #8f2d52);
  color: #fff; padding: 14px 28px; display: flex; justify-content: space-between; align-items: center;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand .logo { font-size: 30px; }
.brand h1 { font-size: 19px; font-weight: 700; letter-spacing: 1px; }
.brand p { font-size: 12px; opacity: .85; }
.tag-mini { background: rgba(255,255,255,.18); border-radius: 4px; padding: 1px 6px; margin-left: 6px; }
.top-actions { display: flex; gap: 10px; }

.btn {
  border: none; border-radius: 8px; padding: 8px 16px; font-size: 14px; cursor: pointer;
  font-family: inherit; transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: rgba(255,255,255,.16); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn.light { background: #eef0f6; color: var(--ink); }
.btn.close { background: #eef0f6; color: var(--ink); padding: 4px 10px; }
.btn.danger { background: #fdecec; color: var(--up); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border-radius: 14px; box-shadow: 0 1px 4px rgba(30,35,60,.06); }

.input-bar { padding: 18px 20px; margin-bottom: 18px; }
.input-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.input-row label { font-weight: 600; }
.input-row input {
  flex: 1; min-width: 220px; border: 1.5px solid var(--line); border-radius: 8px;
  padding: 9px 12px; font-size: 15px; font-family: inherit; outline: none;
}
.input-row input:focus { border-color: var(--accent); }
.hint { color: var(--sub); font-size: 12px; margin-top: 8px; }
.status { font-size: 13px; color: var(--sub); }

.empty { padding: 70px 20px; text-align: center; color: var(--sub); }
.empty-icon { font-size: 46px; margin-bottom: 10px; }
.empty .sub { font-size: 12px; margin-top: 6px; }

/* ---------- 报告 ---------- */
.report { display: flex; flex-direction: column; gap: 16px; }
.rcard { padding: 20px 22px; }
.rcard h3 {
  font-size: 16px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.rcard h3 .sec-no {
  background: var(--accent); color: #fff; font-size: 12px; border-radius: 6px; padding: 1px 8px;
}
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }

/* 报告头 */
.rhead { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; }
.rhead .date-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rhead .date-line b { font-size: 22px; }
.rhead .meta { color: var(--sub); font-size: 12px; margin-top: 6px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.badge {
  border-radius: 6px; padding: 3px 10px; font-size: 12.5px; background: #f4f5f9; border: 1px solid var(--line);
}
.badge.hot { background: #fdeeee; color: var(--up); border-color: #f5cfd0; }
.badge.cool { background: #e8f6f0; color: var(--down); border-color: #c8e9dc; }
.score-box { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.donut { width: 108px; height: 108px; position: relative; }
.donut svg { transform: rotate(-90deg); }
.donut .val {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.donut .val b { font-size: 26px; }
.donut .val span { font-size: 11px; color: var(--sub); }
.rhead-actions { display: flex; gap: 8px; margin-top: 14px; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); }
th { color: var(--sub); font-weight: 500; font-size: 12.5px; }
th:first-child, td:first-child { text-align: left; }
tr:last-child td { border-bottom: none; }
td .idx-sub { color: var(--sub); font-size: 11.5px; }

/* 量能 */
.vol-main { display: flex; gap: 30px; align-items: center; flex-wrap: wrap; }
.vol-num b { font-size: 34px; }
.vol-num span { font-size: 14px; color: var(--sub); }
.vol-level-bar { display: flex; margin: 14px 0 4px; border-radius: 6px; overflow: hidden; height: 12px; }
.vol-level-bar i { flex: 1; }
.vol-legend { display: flex; font-size: 11.5px; color: var(--sub); margin-bottom: 12px; }
.vol-legend span { flex: 1; text-align: center; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.stat { background: #f8f9fc; border-radius: 10px; padding: 10px 12px; }
.stat .k { font-size: 12px; color: var(--sub); }
.stat .v { font-size: 18px; font-weight: 700; margin-top: 2px; }
.stat .s { font-size: 11.5px; color: var(--sub); }

/* 涨跌结构条 */
.breadth-bar { display: flex; height: 26px; border-radius: 8px; overflow: hidden; margin-bottom: 6px; }
.breadth-bar .b-up { background: var(--up); }
.breadth-bar .b-flat { background: #c3c8d4; }
.breadth-bar .b-down { background: var(--down); }
.breadth-legend { display: flex; gap: 16px; font-size: 12px; color: var(--sub); margin-bottom: 14px; }

/* 板块列表 */
.sector-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .sector-cols { grid-template-columns: 1fr; } }
.sector-cols h4 { font-size: 13px; color: var(--sub); margin-bottom: 8px; font-weight: 600; }
.srow { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.srow:last-child { border-bottom: none; }
.srow .nm { width: 108px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srow .bar-wrap { flex: 1; height: 8px; background: #f0f1f6; border-radius: 4px; overflow: hidden; }
.srow .bar { height: 100%; border-radius: 4px; }
.srow .pc { width: 56px; text-align: right; font-weight: 600; }
.srow .ld { width: 110px; font-size: 11.5px; color: var(--sub); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 情绪评分分项 */
.parts { display: flex; flex-direction: column; gap: 8px; }
.part { display: grid; grid-template-columns: 82px 1fr 120px; gap: 10px; align-items: center; font-size: 13px; }
.part .pbar { height: 10px; background: #f0f1f6; border-radius: 5px; overflow: hidden; }
.part .pfill { height: 100%; background: var(--accent); border-radius: 5px; }
.part .pdesc { color: var(--sub); font-size: 12px; text-align: right; }

/* 外围卡片 */
.global-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.gcard { background: #f8f9fc; border-radius: 10px; padding: 10px 12px; }
.gcard .k { font-size: 12px; color: var(--sub); }
.gcard .v { font-size: 17px; font-weight: 700; margin: 2px 0; }
.gcard .d { font-size: 12px; }

/* 复盘模板 */
.tpl { background: #2b2f3a; color: #e8eaf2; border-radius: 10px; padding: 16px 18px; font-family: Consolas, Menlo, monospace; font-size: 13px; line-height: 1.9; }
.tpl .k { color: #f0b429; }
.summary-text { margin-top: 12px; padding: 12px 14px; background: #fdf6ec; border-radius: 10px; font-size: 13.5px; }

/* 个股 */
.stock-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.stock-head .name { font-size: 20px; font-weight: 700; }
.stock-head .price { font-size: 26px; font-weight: 700; }
.stock-head .pct { font-size: 16px; font-weight: 600; }
.stock-tag { font-size: 12px; color: var(--sub); background: #f4f5f9; border-radius: 6px; padding: 2px 8px; }

/* 避坑 */
.pitfalls { padding: 14px 18px; border-top: 3px solid var(--accent); }
.pitfalls h4 { font-size: 14px; margin-bottom: 8px; color: var(--accent); }
.pitfalls li { margin-left: 18px; font-size: 12.5px; color: var(--sub); }
.foot-note { text-align: center; color: #9aa0ae; font-size: 11.5px; padding: 8px 0 20px; }
.missing-note { font-size: 12px; color: #b8860b; background: #fdf8e8; border-radius: 8px; padding: 8px 12px; margin-top: 10px; }

/* 抽屉 & 弹窗 */
.drawer-mask, .modal-mask {
  position: fixed; inset: 0; background: rgba(20,24,40,.45); z-index: 40;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 92vw; background: #fff;
  z-index: 50; box-shadow: -6px 0 24px rgba(0,0,0,.14); display: flex; flex-direction: column;
}
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 16px; }
.drawer-filter { padding: 12px 18px; }
.drawer-filter input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 8px 10px; font-family: inherit; outline: none;
}
.history-list { flex: 1; overflow-y: auto; padding: 0 18px 18px; }
.hitem {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px;
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.hitem .hi-main { flex: 1; min-width: 0; }
.hitem .hi-title { font-weight: 600; font-size: 13.5px; }
.hitem .hi-sub { font-size: 12px; color: var(--sub); }
.hitem .hi-ops { display: flex; gap: 6px; flex-shrink: 0; }
.hitem .hi-ops .btn { padding: 4px 10px; font-size: 12.5px; }
.modal-mask { display: flex; align-items: center; justify-content: center; }
.modal { width: 560px; max-width: 94vw; max-height: 88vh; overflow-y: auto; }
.modal-body { padding: 4px 20px 20px; }
.cron-info p { font-size: 13.5px; margin-bottom: 6px; }
.cron-info .sub { color: var(--sub); font-size: 12.5px; }
.field-label { font-size: 13px; font-weight: 600; margin: 14px 0 6px; display: block; }
#codes-input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 8px; padding: 9px 12px;
  font-family: Consolas, monospace; font-size: 14px; outline: none;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); background: #2b2f3a; color: #fff;
  border-radius: 8px; padding: 10px 18px; font-size: 13.5px; z-index: 99; box-shadow: 0 4px 16px rgba(0,0,0,.25);
}
