* { box-sizing: border-box; }
body { font-family: -apple-system, "Microsoft YaHei", "PingFang SC", sans-serif; margin: 0; background: #f5f6f8; color: #333; }
.container { max-width: 1000px; margin: 0 auto; padding: 20px; }
header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
h1 { font-size: 22px; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
input { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; width: 170px; font-size: 14px; }
button { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; background: #eef0f3; font-size: 14px; }
button:hover { opacity: 0.9; }
button.primary { background: #1677ff; color: #fff; }
button.big { padding: 10px 24px; font-size: 15px; margin-top: 16px; }
.stats { display: flex; gap: 16px; margin: 20px 0; flex-wrap: wrap; }
.stat { background: #fff; padding: 14px 22px; border-radius: 8px; min-width: 130px; text-align: center; }
.stat .num { font-size: 26px; font-weight: bold; display: block; }
.stat .num.small { font-size: 16px; padding-top: 6px; }
.stat .label { font-size: 12px; color: #888; }
.status { margin: 12px 0; padding: 12px 16px; border-radius: 6px; display: none; font-size: 14px; }
.status.ok { display: block; background: #e6f7e6; color: #0a7d2c; }
.status.err { display: block; background: #fdecec; color: #c0392b; }
.status.info { display: block; background: #e8f1ff; color: #1677ff; }
.macd-banner { margin: 12px 0; padding: 12px 16px; border-radius: 8px; background: #fff7e6; border: 1px solid #ffd591; font-size: 14px; line-height: 2; }
.macd-banner b { color: #d46b08; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; color: #fff; }
.tag.golden { background: #e03131; }
.tag.death { background: #0ca678; }
.sig.golden { color: #e03131; font-weight: 600; }
.sig.death { color: #0ca678; font-weight: 600; }
.sector { color: #666; font-size: 13px; white-space: nowrap; }
.month-link { color: #1677ff; cursor: pointer; text-decoration: underline; }
.review-signal { margin-top: 10px; padding: 6px 10px; background: #f0f6ff; border-radius: 6px; font-size: 13px; }
.review-signal.active { border: 2px solid #1677ff; background: #e8f1ff; }
#review-export-btn, #analysis-export-btn { background: #1677ff; color: #fff; white-space: nowrap; }
.review-trade { font-size: 13px; padding: 2px 12px; color: #555; }
#review-chart { height: 480px; }
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 14px; }
th { background: #fafafa; color: #666; font-weight: 600; white-space: nowrap; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: #1677ff; }
th .arr::after { content: ""; }
th.asc .arr::after { content: " ▲"; font-size: 10px; }
th.desc .arr::after { content: " ▼"; font-size: 10px; }
tr:last-child td { border-bottom: none; }
.stock-name { color: #1677ff; cursor: pointer; font-weight: 500; }
.stock-name:hover { text-decoration: underline; }
.up { color: #e03131; }
.down { color: #0ca678; }
.flat { color: #666; }
.del { color: #bbb; cursor: pointer; font-size: 18px; line-height: 1; }
.del:hover { color: #e03131; }
.loading { text-align: center; color: #999; }
.back { color: #1677ff; text-decoration: none; font-size: 14px; }
.stock-head { margin: 12px 0 20px; }
.quote-box { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 8px; }
.quote-box .q { font-size: 14px; }
.quote-box .q b { font-size: 20px; margin-left: 4px; }
.tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.tab { padding: 6px 20px; background: #fff; border: 1px solid #ddd; border-radius: 6px; cursor: pointer; }
.tab.active { background: #1677ff; color: #fff; border-color: #1677ff; }
.minute-back { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.minute-back span { font-size: 13px; color: #333; }
.chart { height: 640px; background: #fff; border-radius: 8px; padding: 8px; }
.day-detail { margin-top: 8px; background: #fff; border-radius: 6px; padding: 10px 16px; font-size: 13px; color: #666; min-height: 20px; }
.day-detail b { color: #333; }
.advice-box { margin-top: 16px; background: #fff; border-radius: 8px; padding: 16px 20px; display: none; }
.advice-box.show { display: block; }
.advice-box .row { margin: 8px 0; font-size: 14px; }
.advice-box .row b { color: #333; }
.advice-box .action { font-size: 20px; font-weight: bold; }

.actions { margin: 12px 0; }
.user-area { display: flex; align-items: center; gap: 10px; }
.user-name { font-size: 14px; color: #666; }
.logout { font-size: 14px; color: #999; text-decoration: none; }
.logout:hover { color: #e03131; }

.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #f0f4ff, #eef2f7); }
.login-box { background: #fff; padding: 40px 36px; border-radius: 12px; width: 320px; box-shadow: 0 8px 30px rgba(0,0,0,0.08); text-align: center; }
.login-box h1 { font-size: 20px; margin-bottom: 6px; }
.login-sub { color: #999; font-size: 13px; margin: 0 0 20px; }
.login-err { color: #c0392b; font-size: 13px; min-height: 18px; margin-bottom: 8px; }
.login-box input { display: block; width: 100%; margin: 10px 0; padding: 10px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.login-box button { display: block; width: 100%; margin-top: 14px; padding: 10px; font-size: 15px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-content { background: #fff; border-radius: 12px; padding: 24px 28px; width: 640px; max-width: 94vw; max-height: 86vh; overflow-y: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close { cursor: pointer; font-size: 26px; color: #999; line-height: 1; }
.modal-close:hover { color: #333; }
.modal-title { font-size: 15px; margin: 18px 0 6px; color: #333; }
.hint { font-size: 12px; color: #999; margin: 0 0 10px; }
.row-form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.row-form input { flex: 1; min-width: 120px; padding: 8px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 13px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid #f0f0f0; border-radius: 6px; margin-bottom: 6px; font-size: 13px; }
.li-name { font-weight: 500; white-space: nowrap; }
.li-url { color: #999; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-del { color: #e03131; cursor: pointer; white-space: nowrap; }
.li-edit { color: #1677ff; cursor: pointer; white-space: nowrap; margin-left: 8px; }
.builtin-tag { display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 3px; background: #eef2ff; color: #1677ff; font-size: 11px; }
.strategy-list-title { font-weight: 600; margin-bottom: 6px; }
.empty { color: #bbb; font-size: 13px; padding: 8px 0; }
.role { color: #bbb; font-size: 12px; }

.search-box { position: relative; flex: 1; max-width: 340px; min-width: 200px; }
.search-box input { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.search-dropdown { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: #fff; border: 1px solid #eee; border-radius: 6px; box-shadow: 0 6px 20px rgba(0,0,0,0.1); max-height: 480px; overflow-y: auto; z-index: 50; display: none; }
.sd-item { display: flex; justify-content: space-between; padding: 9px 12px; cursor: pointer; font-size: 14px; }
.sd-item:hover { background: #f0f6ff; }
.sd-name { font-weight: 500; }
.sd-code { color: #999; }
.type-tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; color: #fff; white-space: nowrap; }
.type-tag.bluechip { background: #1677ff; }
.type-tag.institution { background: #0ca678; }
.type-tag.hotmoney { background: #fa8c16; }
.type-tag.none { background: #ccc; }
.fund { font-weight: 600; font-size: 13px; }
.fund.good { color: #0ca678; }
.fund.mid { color: #999; }
.fund.bad { color: #e03131; }
.strat-tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; color: #fff; white-space: nowrap; }
.strat-tag.good { background: #0ca678; }
.strat-tag.mid { background: #faad14; }
.strat-tag.bad { background: #e03131; }
.strat-tag.sell { background: #e8590c; }
.mark-btn { margin-left: 6px; padding: 1px 8px; font-size: 12px; border: 1px solid #1677ff; background: #fff; color: #1677ff; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.mark-btn:hover { background: #1677ff; color: #fff; }
.strat-cell { display: inline-block; line-height: 1.5; }
.board-filter { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; cursor: pointer; white-space: nowrap; }
.board-filter input { cursor: pointer; }
.sort-btn { padding: 4px 12px; font-size: 13px; border: 1px solid #ddd; background: #fff; border-radius: 4px; cursor: pointer; white-space: nowrap; }
.sort-btn.active { border-color: #1677ff; color: #1677ff; font-weight: 600; }

.primary-outline { background: #fff; border: 1px solid #1677ff; color: #1677ff; }
.sd-add { color: #1677ff; font-size: 13px; }
.add-search { width: 100%; max-width: none; margin-top: 8px; }
.strategy-row { display: flex; align-items: center; gap: 10px; margin-top: 16px; background: #fff; border-radius: 8px; padding: 12px 16px; flex-wrap: wrap; }
.strategy-label { font-size: 14px; color: #666; white-space: nowrap; }
.strategy-row select { padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; flex: 1; max-width: 300px; }
.strategy-row input { padding: 7px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }
.strategy-row input[type=number] { width: 70px; }
#predict-amounts { flex: 1; min-width: 200px; }
#predict-max-invest { width: 100px; }
.report-summary { background: #f0f6ff; border-radius: 6px; padding: 10px 14px; margin: 10px 0; font-size: 14px; }
.report-summary.err { background: #fdecec; color: #c0392b; }
.buy-point { color: #e03131; font-weight: 600; }
.sell-point { color: #0ca678; font-weight: 600; }

.row-form.column { flex-direction: column; }
.row-form.column input { width: 100%; flex: none; }
.mini-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.mini-table th, .mini-table td { padding: 8px 10px; font-size: 13px; text-align: left; border-bottom: 1px solid #f0f0f0; }
.mini-table th { background: #fafafa; color: #666; }
.mini-table .loading { color: #999; }

#add-modal .modal-content { min-height: 460px; }
.add-search .search-dropdown { max-height: 400px; }

.opt-box { background: #f8f9fb; border: 1px solid #eef0f3; border-radius: 8px; padding: 12px 16px; margin-top: 8px; }
.opt-box .row { margin: 7px 0; font-size: 14px; line-height: 1.6; }

.chat-box { height: 320px; overflow-y: auto; background: #f8f9fb; border: 1px solid #eef0f3; border-radius: 8px; padding: 12px; margin: 10px 0; }
.chat-msg { max-width: 85%; margin: 6px 0; padding: 8px 12px; border-radius: 10px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; position: relative; }
#optimize-modal .modal-content, #optimize-modal .chat-box, #optimize-modal .chat-msg,
#optimize-modal .chat-msg * { user-select: text !important; -webkit-user-select: text !important; }
#optimize-modal .chat-msg { cursor: text; }
.chat-msg .copy-btn { position: absolute; top: 4px; right: 6px; font-size: 11px; color: #aaa; background: transparent; border: none; padding: 0 4px; cursor: pointer; border-radius: 3px; }
.chat-msg .copy-btn:hover { color: #1677ff; background: #eef5ff; }
.chat-msg.user { background: #1677ff; color: #fff; margin-left: auto; }
.chat-msg.assistant { background: #fff; border: 1px solid #eee; }
.chat-input-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: flex-end; }
.chat-input-row input { flex: 1; min-width: 180px; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; }
.chat-input-row textarea { flex: 1; min-width: 180px; padding: 8px 12px; border: 1px solid #ddd; border-radius: 6px; resize: none; font-family: inherit; font-size: 14px; line-height: 1.5; }

.modal-content.wide { width: 820px; }
.modal-content.fullscreen { width: 100vw; max-width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; padding: 16px 20px; }
.modal-content.fullscreen #review-chart { height: calc(100vh - 150px) !important; }
.conv-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.conv-bar select { flex: 1; padding: 7px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }

.market-kline-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.market-kline-title { font-size: 16px; font-weight: 600; }
.market-kline-head .tabs { margin: 0 0 0 auto; }
#market-kline-chart { height: 480px; }
.market-row { cursor: pointer; }
.market-row:hover td { background: #f7faff; }

.indicator-box { margin-top: 10px; }
.cross-tag { display: inline-block; margin: 0 3px 3px 0; padding: 1px 7px; border-radius: 4px; font-size: 12px; background: #f0f2f5; }
.cross-tag.up { color: #e03131; }
.cross-tag.down { color: #0ca678; }

.tag-strategy-label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: #555; }
.tag-strategy-label select { padding: 6px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }

.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 6px; margin: 0 4px 3px 0; border-radius: 4px; background: #e6f7f1; color: #0ca678; font-size: 12px; white-space: nowrap; }
.tag-chip.bad-chip { background: #fdecec; color: #e03131; }
.tag-x { cursor: pointer; color: #999; font-weight: bold; padding: 0 2px; }
.tag-x:hover { color: #e03131; }

.tag-legend { margin: 8px 0; font-size: 13px; color: #666; }
.tag-legend .strat-tag { margin: 0 2px; }

.strategy-detail { border: 1px solid #f0f0f0; border-radius: 8px; padding: 10px; margin-bottom: 10px; background: #fafbfc; }

.opp-time-row { display: inline-flex; align-items: center; gap: 6px; margin: 0 6px 6px 0; }
.opp-time-row input[type="time"] { padding: 5px 8px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }

.market-bar { background: #fff; padding: 14px 18px; border-radius: 8px; min-width: 230px; display: flex; flex-direction: column; gap: 8px; align-self: flex-start; }
.market-date { color: #333; font-weight: 700; font-size: 14px; white-space: nowrap; }
.market-indices { display: flex; flex-direction: column; gap: 5px; }
.market-idx { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.mi-name { font-size: 13px; color: #666; }
.mi-price { font-size: 20px; font-weight: 700; color: #222; }
.mi-chg { font-size: 15px; font-weight: 700; }
.mi-chg.up { color: #e03131; }
.mi-chg.down { color: #0ca678; }

.primary-outline.active { background: #1677ff; color: #fff; border-color: #1677ff; }

.sim-stock { display: inline-flex; align-items: center; gap: 4px; margin: 0 10px 6px 0; font-size: 13px; }
.sim-stock input { margin: 0; }

.sim-strat { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px dashed #f0f0f0; font-size: 13px; }
.sim-strat-name { font-weight: 600; min-width: 120px; }
.sim-grade-info { color: #999; font-size: 12px; }
.sim-strat input[type="number"] { width: 56px; padding: 4px 6px; border: 1px solid #ddd; border-radius: 4px; }
.sim-strat span { display: inline-flex; align-items: center; gap: 3px; }

.sim-stock-box { flex: 1; min-width: 0; }
.sim-stock-tools { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; position: relative; }
.sim-stock-tools input { flex: 1; padding: 7px 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px; }

.ai-reply { padding: 10px 12px; background: #f7f9fc; border: 1px solid #e8ecf2; border-radius: 8px; font-size: 13px; line-height: 1.7; white-space: normal; margin: 8px 0; }
#sim-ai-result { margin-top: 8px; }
