:root {
  --bg: #f3f4f8;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text-dim: #64748b;
  --green: #059669;
  --green-bg: #ecfdf5;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --amber: #b45309;
  --amber-bg: #fffbeb;
  --indigo: #4f46e5;
  --indigo-bg: #eef2ff;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 14px rgba(15, 23, 42, 0.05);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5;
  background-image: radial-gradient(circle at 15% -10%, rgba(79,70,229,0.05), transparent 40%),
                    radial-gradient(circle at 85% -10%, rgba(37,99,235,0.05), transparent 40%);
}
.app { max-width: 1100px; margin: 0 auto; padding: 20px 16px 48px; display: flex; flex-direction: column; gap: 14px; }

/* 顶栏 */
.topbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.title { font-size: 22px; font-weight: 800; background: linear-gradient(135deg, var(--indigo), var(--blue)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.date-badge { background: var(--card); border: 1px solid var(--border); padding: 4px 12px; border-radius: 8px; font-size: 13px; color: var(--text-dim); }
.freshness-badge { padding: 4px 12px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.freshness-badge.synced { background: var(--green-bg); color: var(--green); border: 1px solid #d1fae5; }
.freshness-badge.stale { background: var(--red-bg); color: var(--red); border: 1px solid #fee2e2; }
.quote-status { font-size: 12px; color: var(--text-dim); }
.quote-status.live { color: var(--green); }
.gen-time { font-size: 11px; color: #94a3b8; }

/* 决策卡 */
.verdict-card { display: flex; align-items: center; gap: 18px; border-radius: 14px; padding: 20px 24px; box-shadow: var(--shadow); transition: transform 0.15s ease; }
.verdict-card:hover { transform: translateY(-1px); }
.verdict-card.enter { background: linear-gradient(135deg, #ffffff, #f0fdf4); border: 1px solid #bbf7d0; }
.verdict-card.cash { background: linear-gradient(135deg, #ffffff, #fef2f2); border: 1px solid #fecaca; }
.verdict-icon { font-size: 42px; line-height: 1; }
.verdict-body { flex: 1; }
.verdict-title { font-size: 21px; font-weight: 800; }
.verdict-card.enter .verdict-title { color: var(--green); }
.verdict-card.cash .verdict-title { color: var(--red); }
.verdict-detail { font-size: 13px; color: var(--text-dim); margin-top: 3px; }
.verdict-stats { display: flex; gap: 24px; }
.vs-item { text-align: center; }
.vs-num { font-size: 22px; font-weight: 800; color: var(--indigo); }
.vs-label { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

/* 面板 */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.panel-header h2 { font-size: 15px; font-weight: 700; color: var(--text); }
.panel-header h2::before { content: ""; display: inline-block; width: 4px; height: 14px; background: linear-gradient(180deg, var(--indigo), var(--blue)); border-radius: 2px; margin-right: 8px; vertical-align: -2px; }
.count-tag { font-size: 12px; color: var(--text-dim); background: var(--bg); padding: 3px 10px; border-radius: 20px; }

/* 图表 */
.chart-box { width: 100%; height: 300px; }

/* 决策依据 */
.summary-text { background: linear-gradient(135deg, var(--indigo-bg), #f5f3ff); border: 1px solid #e0e7ff; border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; font-size: 13px; line-height: 1.7; color: #3730a3; }
.summary-text strong { color: var(--indigo); }
.basis-content { font-size: 13px; }
.basis-content.collapsed { display: none; }
.basis-section { margin-bottom: 4px; }
.basis-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.basis-chip { display: inline-flex; flex-direction: column; background: var(--blue-bg); border: 1px solid #dbeafe; border-radius: 10px; padding: 8px 14px; min-width: 120px; transition: transform 0.12s ease; }
.basis-chip:hover { transform: translateY(-1px); }
.basis-chip .bc-label { font-size: 11px; color: var(--text-dim); }
.basis-chip .bc-value { font-size: 15px; font-weight: 700; color: var(--blue); margin-top: 1px; }
.basis-chip.neutral { background: var(--indigo-bg); border-color: #e0e7ff; }
.basis-chip.neutral .bc-value { color: var(--indigo); }
.basis-chip.amber { background: var(--amber-bg); border-color: #fef3c7; }
.basis-chip.amber .bc-value { color: var(--amber); }
.basis-chip.green { background: var(--green-bg); border-color: #d1fae5; }
.basis-chip.green .bc-value { color: var(--green); }
.basis-chip.red { background: var(--red-bg); border-color: #fee2e2; }
.basis-chip.red .bc-value { color: var(--red); }
.toggle-btn { background: #fff; border: 1px solid var(--border); color: var(--text-dim); padding: 4px 14px; border-radius: 8px; cursor: pointer; font-size: 12px; transition: all 0.12s; }
.toggle-btn:hover { color: var(--text); border-color: #cbd5e1; }
.basis-placeholder { color: var(--text-dim); font-size: 12px; font-style: italic; padding: 20px 0; text-align: center; }

/* 个股表 */
.sort-controls { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.sort-btn { background: #fff; border: 1px solid var(--border); color: var(--text-dim); padding: 4px 12px; border-radius: 8px; cursor: pointer; font-size: 12px; transition: all 0.12s; }
.sort-btn:hover { border-color: #cbd5e1; }
.sort-btn.active { background: var(--blue); color: #fff; border-color: var(--blue); box-shadow: 0 2px 6px rgba(37,99,235,0.25); }
.table-wrap { overflow-x: auto; margin-top: 4px; }
.stock-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stock-table th { text-align: left; padding: 10px 12px; color: var(--text-dim); font-size: 12px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.stock-table td { padding: 9px 12px; border-bottom: 1px solid #f1f5f9; }
.stock-table tbody tr { transition: background 0.1s; }
.stock-table tbody tr:hover { background: #f8fafc; }
.stock-row { cursor: pointer; }
.stock-row:hover .name-cell { color: var(--blue); }
.ind-tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; background: #f1f5f9; color: var(--text-dim); white-space: nowrap; }
.name-cell { font-weight: 600; color: var(--text); }
.pct-up { color: var(--red); font-weight: 600; }
.pct-down { color: var(--green); font-weight: 600; }
.sig-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.sig-tag { font-size: 11px; padding: 2px 8px; border-radius: 6px; background: var(--blue-bg); color: var(--blue); white-space: nowrap; }
.tag-popular { font-size: 11px; padding: 2px 10px; border-radius: 20px; background: linear-gradient(135deg, #fffbeb, #fef3c7); color: var(--amber); border: 1px solid #fde68a; font-weight: 600; white-space: nowrap; }
.tag-none { font-size: 11px; color: #d1d5db; }

/* 今日市场与行业 (照搬 industry_site 左右分栏) */
.market-panel { padding: 12px; }
.market-overview { font-size: 12px; color: var(--text-dim); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.market-overview .mkt-chip { display: inline-block; padding: 2px 8px; font-size: 12px; font-weight: 600; border-radius: 5px; background: #eef2ff; color: #3730a3; }
.market-overview .mkt-chip-dry { background: #ecfdf5; color: #166534; }
.market-overview .mkt-chip-reduce { background: #f3f4f6; color: #374151; }
.market-overview .mkt-chip-full { background: #dbeafe; color: #1d4ed8; }
.market-overview .mkt-chip-overflow { background: #ffedd5; color: #c2410c; }
.market-overview .mkt-chip-hot { background: #fee2e2; color: #dc2626; }
.market-overview .mkt-chip-neutral { background: #f3f4f6; color: #374151; }
.market-container { display: flex; flex-direction: row; gap: 12px; height: 600px; margin-top: 8px; }
.market-left { flex: 0 0 38%; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; min-height: 0; }
.market-right { flex: 1 1 62%; display: grid; grid-template-rows: 1fr 1fr auto; gap: 8px; min-width: 0; min-height: 0; }
.market-left .table-container { flex-grow: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.market-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.market-table thead { position: sticky; top: 0; z-index: 10; background: #f9fafb; }
.market-table th { padding: 8px 6px; color: #374151; font-size: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; cursor: pointer; text-align: left; }
.market-table th.text-center { text-align: center; }
.market-table th:hover { color: var(--blue); }
.market-table td { padding: 7px 6px; border-bottom: 1px solid #f1f5f9; }
.market-table td.text-center { text-align: center; }
.market-table tbody tr { cursor: pointer; transition: background 0.15s; }
.market-table tbody tr:hover { background: #f3f4f6; }
.market-table tbody tr.mkt-row-selected { background: #dbeafe; }
.market-table tbody tr.mkt-row-selected td:first-child { color: var(--blue); font-weight: 700; }
.rank-up { color: #ef4444; font-weight: 600; }
.rank-down { color: #22c55e; font-weight: 600; }
.mkt-tag { display: inline-block; padding: 1px 5px; font-size: 11px; font-weight: 600; border-radius: 4px; margin-left: 4px; vertical-align: middle; background: #ecfdf5; color: #047857; }
.chart-container { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px; min-height: 0; }
.slider-panel { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px 14px; display: flex; align-items: center; gap: 10px; }
.slider-label { font-size: 12px; font-weight: 500; color: var(--text-dim); white-space: nowrap; }
.date-slider-input { flex: 1; height: 4px; background: #e5e7eb; border-radius: 4px; appearance: none; cursor: pointer; }

/* 页脚 */
.footer { display: flex; justify-content: space-between; font-size: 11px; color: #94a3b8; padding: 8px 4px; flex-wrap: wrap; gap: 4px; }
.footer-right { color: #b6bdc7; }

@media (max-width: 768px) {
  .market-container { flex-direction: column; height: auto; }
  .market-left { flex: 1 1 auto; max-height: 360px; }
  .market-right { grid-template-rows: 260px 260px auto; }
}
@media (max-width: 640px) {
  .verdict-card { flex-direction: column; align-items: flex-start; gap: 10px; }
  .verdict-stats { width: 100%; justify-content: space-between; }
  .footer { flex-direction: column; gap: 2px; }
}
