/* ============================================================
 * style.css —— 深色金融终端主题
 * ============================================================ */
:root {
  --bg: #0B0E11;
  --bg-panel: #151A21;
  --bg-card: #1E242C;
  --bg-elevated: #252C37;
  --border: #2A313C;
  --text: #E6E8EA;
  --text-dim: #A3AAB3;
  --text-mute: #6B7280;
  --up: #F6465D;
  --down: #2EBD85;
  --gold: #F0B90B;
  --blue: #4A9EFF;
  --purple: #C77DFF;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body {
  background:
    radial-gradient(1200px 500px at 15% -10%, rgba(74, 158, 255, 0.10), transparent 60%),
    radial-gradient(1000px 500px at 85% 0%, rgba(240, 185, 11, 0.06), transparent 55%),
    var(--bg);
  min-height: 100vh;
}

/* 涨跌配色 */
.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.flat { color: var(--text-dim) !important; }

/* ============ 顶部导航 ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 14px 24px;
  background: rgba(15, 19, 24, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-logo { font-size: 26px; }
.brand-text h1 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(90deg, #E6E8EA, #F0B90B);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand-sub { font-size: 11px; color: var(--text-mute); }

/* 搜索框 */
.search-box { position: relative; flex: 1; max-width: 460px; }
.search-box input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-box input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.15);
}
.search-box input::placeholder { color: var(--text-mute); }

.search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  max-height: 360px;
  overflow-y: auto;
  z-index: 200;
}
.search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid rgba(42, 49, 60, 0.5);
  transition: background 0.15s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--bg-elevated); }
.search-item .s-name { font-weight: 600; color: var(--text); }
.search-item .s-code { font-size: 12px; color: var(--text-mute); }
.search-item .s-add {
  margin-left: auto;
  font-size: 12px;
  color: var(--blue);
  font-weight: 600;
}
.search-empty { padding: 16px; text-align: center; color: var(--text-mute); }

/* 顶部右侧 */
.topbar-right { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.toggle-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.toggle-label { font-size: 13px; color: var(--text-dim); white-space: nowrap; }
.toggle { display: none; }
.toggle-slider {
  width: 40px;
  height: 22px;
  border-radius: 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.25s;
}
.toggle-slider::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-mute);
  transition: transform 0.25s, background 0.25s;
}
.toggle:checked + .toggle-slider { background: rgba(46, 189, 133, 0.25); border-color: var(--down); }
.toggle:checked + .toggle-slider::after { transform: translateX(18px); background: var(--down); }

.select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--text);
  font-size: 13px;
  outline: none;
  cursor: pointer;
}

.btn-refresh {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-panel);
  color: var(--gold);
  font-size: 18px;
  cursor: pointer;
  transition: transform 0.3s, background 0.2s;
}
.btn-refresh:hover { background: var(--bg-elevated); }
.btn-refresh:active { transform: rotate(180deg); }

.last-update { font-size: 12px; color: var(--text-mute); font-variant-numeric: tabular-nums; }

/* ============ 指数概览 ============ */
.index-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 20px 24px 0;
  max-width: 1280px;
  margin: 0 auto;
}
.index-card {
  background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s;
}
.index-card:hover { transform: translateY(-2px); border-color: var(--blue); }
.idx-name { font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
.idx-price { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.idx-change { font-size: 13px; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ============ 板块领涨榜 ============ */
.top-gainers {
  max-width: 1280px;
  margin: 16px auto 0;
  padding: 0 24px;
}
.gainers-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 12px;
}
.gainers-title {
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(90deg, #E6E8EA, #F0B90B);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.gainers-sub { font-size: 12px; color: var(--text-mute); }

.gainers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.gainer-card {
  position: relative;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.gainer-card:hover {
  transform: translateY(-3px);
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.gainer-board {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  margin-bottom: 6px;
}
.gainer-name { font-size: 15px; font-weight: 700; color: var(--text); }
.gainer-code { font-size: 11px; color: var(--text-mute); margin-bottom: 8px; }
.gainer-price { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gainer-chg { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gainer-empty { font-size: 13px; color: var(--text-mute); padding: 10px 0; }
.gainer-add {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--gold);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
}
.gainer-add:hover { background: rgba(240, 185, 11, 0.15); border-color: var(--gold); }

/* ============ 主内容 ============ */
.main { max-width: 1280px; margin: 20px auto 40px; padding: 0 24px; }

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 5px;
  width: fit-content;
}
.tab-btn {
  padding: 9px 20px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active {
  background: linear-gradient(135deg, var(--blue), #7C5CFF);
  color: #fff;
  box-shadow: 0 4px 14px rgba(74, 158, 255, 0.35);
}

.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ============ 行情表格 ============ */
.table-card { overflow: hidden; }
.quote-table { width: 100%; border-collapse: collapse; }
.quote-table thead th {
  text-align: right;
  font-size: 12px;
  color: var(--text-mute);
  font-weight: 600;
  padding: 12px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.quote-table thead th.c-name, .quote-table thead th.c-del { text-align: left; }
.quote-table tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(42, 49, 60, 0.4);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.quote-table tbody td.num { font-weight: 600; }
.quote-table tbody td.c-name, .quote-table tbody td.c-del { text-align: left; }
.quote-table tbody tr { cursor: pointer; transition: background 0.15s; }
.quote-table tbody tr:hover { background: var(--bg-elevated); }
.quote-table tbody tr.current { background: rgba(74, 158, 255, 0.08); }
.quote-table tbody tr:last-child td { border-bottom: none; }

/* 产业链·同行业关联企业：固定在卡片内滚动，避免 100 行把整页拉到 8000px */
#chain-related .table-card {
  max-height: 460px;
  overflow-y: auto;
  scrollbar-width: thin;
}
#chain-related .quote-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-panel);
}
#chain-related .quote-table th.c-name, #chain-related .quote-table td.c-name { width: 46%; }
#chain-related .quote-table th.num, #chain-related .quote-table td.num { width: 20%; }
#chain-related .quote-table tbody td { padding-top: 9px; padding-bottom: 9px; }

/* 板块成分股：同样限高滚动 + 吸附表头，避免长列表把 K 线页撑高 */
#board-stocks .table-card {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
}
#board-stocks .quote-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-panel);
}
#board-stocks .quote-table th.c-name, #board-stocks .quote-table td.c-name { width: 46%; }
#board-stocks .quote-table th.num, #board-stocks .quote-table td.num { width: 20%; }
#board-stocks .quote-table tbody td { padding-top: 9px; padding-bottom: 9px; }

.stock-name { font-weight: 600; color: var(--text); }
.stock-code { font-size: 12px; color: var(--text-mute); }
.mkt-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.del-btn {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.15s;
}
.del-btn:hover { background: rgba(246, 70, 93, 0.15); color: var(--up); }

.empty-tip { text-align: center; color: var(--text-mute); padding: 40px 0 !important; }

/* ============ 股票信息头 ============ */
.stock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}
.stock-head-left { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.stock-head h2 { font-size: 22px; font-weight: 700; }
.stock-code-badge {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
}
.board-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 6px;
  background: rgba(240, 185, 11, 0.15);
  border: 1px solid rgba(240, 185, 11, 0.4);
  color: var(--gold);
}
.stock-price { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stock-change { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

.period-btns, .indicator-btns {
  display: flex;
  gap: 6px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.period-btn, .indicator-btn {
  padding: 7px 16px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.period-btn:hover, .indicator-btn:hover { color: var(--text); }
.period-btn.active, .indicator-btn.active {
  background: var(--gold);
  color: #1a1a1a;
  box-shadow: 0 3px 10px rgba(240, 185, 11, 0.3);
}

/* ============ 图表 ============ */
.chart-card { position: relative; padding: 8px; }
.chart { width: 100%; height: 560px; }
#indicator-chart { height: 420px; }

.loading {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  align-items: center;
  justify-content: center;
  background: rgba(21, 26, 33, 0.7);
  color: var(--text-dim);
  font-size: 14px;
}

/* ============ 知识学堂 ============ */
.knowledge-container { display: flex; flex-direction: column; gap: 16px; }
.knowledge-section { padding: 20px 22px; }
.knowledge-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.knowledge-icon { font-size: 28px; }
.knowledge-head h3 { font-size: 18px; font-weight: 700; }
.knowledge-head p { font-size: 13px; color: var(--text-mute); }

.knowledge-item { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; overflow: hidden; background: var(--bg-panel); }
.knowledge-q {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s;
}
.knowledge-q:hover { background: var(--bg-elevated); }
.knowledge-q .q-text { flex: 1; }
.knowledge-q .q-arrow { color: var(--text-mute); transition: transform 0.25s; }
.knowledge-q.active .q-arrow { transform: rotate(180deg); color: var(--gold); }

.knowledge-a {
  max-height: 0;
  overflow: hidden;
  padding: 0 16px;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.8;
  transition: max-height 0.3s ease, padding 0.3s ease;
}
.knowledge-a.open { max-height: 300px; padding: 0 16px 14px; }

/* ============ 提示 / toast ============ */
.hint { margin-top: 12px; font-size: 12px; color: var(--text-mute); }

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 24px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ 表头术语提示 ============ */
.th-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: help;
  border-bottom: 1px dashed var(--text-mute);
}
.th-abbr { font-size: 11px; color: var(--text-mute); font-weight: 400; }

/* 通用 tooltip（悬浮气泡） */
.tooltip {
  position: absolute;
  z-index: 999;
  max-width: 300px;
  padding: 10px 14px;
  background: rgba(30, 36, 44, 0.98);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 12px;
  line-height: 1.7;
  pointer-events: none;
  animation: fadeIn 0.15s ease;
}

/* ============ 全市场页 ============ */
.market-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.market-boards { display: flex; gap: 6px; flex-wrap: wrap; }
.board-btn {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-panel);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.board-btn:hover { color: var(--text); border-color: var(--blue); }
.board-btn.active {
  background: linear-gradient(135deg, var(--gold), #d4a100);
  color: #1a1a1a;
  border-color: transparent;
  box-shadow: 0 3px 10px rgba(240, 185, 11, 0.3);
}

.market-controls { display: flex; align-items: center; gap: 8px; }
.ctrl-label { font-size: 13px; color: var(--text-dim); }
.btn-sort {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-sort:hover { background: var(--bg-elevated); }

.pagination { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.page-info { font-size: 12px; color: var(--text-mute); }
.page-btn {
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-panel);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}
.page-btn:hover:not(:disabled) { color: var(--text); border-color: var(--blue); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.market-table { position: relative; }
.add-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--gold);
  font-size: 15px;
  cursor: pointer;
  transition: all 0.15s;
}
.add-btn:hover { background: rgba(240, 185, 11, 0.15); border-color: var(--gold); }

/* 搜索下拉操作按钮 */
.s-actions { margin-left: auto; display: flex; gap: 6px; }
.s-view, .s-add {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.s-view { color: var(--blue); }
.s-view:hover { background: rgba(74, 158, 255, 0.15); border-color: var(--blue); }
.s-add { color: var(--gold); }
.s-add:hover { background: rgba(240, 185, 11, 0.15); border-color: var(--gold); }

/* ============ 指标按钮中文小字 ============ */
.indicator-btn { display: flex; flex-direction: column; align-items: center; line-height: 1.15; padding: 6px 14px; }
.indicator-btn small { font-size: 10px; font-weight: 400; opacity: 0.7; }

/* ============ 术语速查卡片 ============ */
.terms-container { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.terms-group { padding: 16px 20px; }
.terms-group-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--gold);
}
.terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.term-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: help;
  transition: all 0.2s;
}
.term-item:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  background: var(--bg-elevated);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}
.term-name { font-size: 13px; font-weight: 600; color: var(--text); }
.term-abbr {
  font-size: 11px;
  color: var(--blue);
  font-weight: 600;
}

/* ============ 行业分类 ============ */
/* 行业标签胶囊 */
.ind-tag {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  background: rgba(74, 158, 255, 0.12);
  color: var(--blue);
  border: 1px solid rgba(74, 158, 255, 0.3);
  vertical-align: middle;
  white-space: nowrap;
}

/* 行业筛选下拉 */
.market-industry {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 行业 Tab：按大类分组 + 板块卡片 */
.industry-grid {
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.industry-group-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}
.industry-group-count {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-mute);
}
.industry-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.industry-card {
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.industry-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.ind-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.ind-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.ind-chg {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.ind-avg {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ind-avg-label {
  font-size: 11px;
  color: var(--text-mute);
  margin: 2px 0 10px;
}
.ind-leader {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ind-leader-label {
  font-size: 10px;
  color: var(--gold);
  padding: 1px 6px;
  border: 1px solid rgba(240, 185, 11, 0.4);
  border-radius: 4px;
  flex-shrink: 0;
}
.industry-loading {
  padding: 60px 0;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
}

/* ============ 产业链 ============ */
.chain-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.chain-toolbar-hint {
  font-size: 12px;
  color: var(--text-mute);
  margin-left: auto;
}
.chain-section {
  margin-top: 18px;
  margin-bottom: 14px;
}
.chain-section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 12px;
}
.chain-section-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-mute);
}
.chain-leaders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}
.chain-leader-card {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.chain-leader-card:hover {
  transform: translateY(-3px);
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
}
.chain-leader-card.active {
  border-color: var(--gold);
  box-shadow: 0 8px 22px rgba(240, 185, 11, 0.22);
}
.chain-leader-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.chain-leader-role {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
  background: rgba(240, 185, 11, 0.12);
  border: 1px solid rgba(240, 185, 11, 0.35);
}
.chain-leader-code {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-mute);
}
.chain-leader-price {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.chain-leader-chg {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.chain-chart-card { position: relative; }
.chain-chart { height: 420px; }

.chain-materials {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.chain-material-card {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
.chain-material-card:hover { border-color: var(--blue); }
.chain-mat-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.chain-mat-unit {
  margin-left: 6px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-mute);
}
.chain-mat-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-dim);
}
.chain-mat-tag {
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-mute);
  flex-shrink: 0;
}
.chain-mat-price {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.chain-mat-chg {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chain-mat-chart {
  width: 100%;
  height: 110px;
  margin-top: 8px;
}
.chain-mat-empty {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-mute);
}
.chain-mat-retry {
  margin-top: 8px;
}

.chain-related-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.chain-empty {
  padding: 40px;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
}

/* ============ 个股成交分析 ============ */
.industry-notice {
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 12px;
  color: var(--text-mute);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.kline-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-mute);
  font-size: 14px;
  text-align: center;
  padding: 0 24px;
}
.chart-card { position: relative; }
.trade-panel {
  margin-top: 16px;
}
.trade-block {
  margin-bottom: 18px;
}
.trade-block-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 12px;
}
.trade-block-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-mute);
}
.trade-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.trade-stat-card {
  padding: 12px 14px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: 10px;
}
.trade-stat-label {
  font-size: 12px;
  color: var(--text-mute);
}
.trade-stat-value {
  margin-top: 4px;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* 主动买 / 卖分解条 */
.trade-split {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.trade-split-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.trade-split-tag {
  width: 74px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 0;
  text-align: center;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.trade-split-tag.buy { color: var(--up); background: rgba(246, 70, 93, 0.12); border-color: rgba(246, 70, 93, 0.35); }
.trade-split-tag.sell { color: var(--down); background: rgba(46, 189, 133, 0.12); border-color: rgba(46, 189, 133, 0.35); }
.trade-split-bar {
  flex: 1;
  height: 14px;
  border-radius: 7px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  overflow: hidden;
}
.trade-split-bar-inner {
  height: 100%;
  border-radius: 7px 0 0 7px;
  transition: width 0.4s ease;
}
.trade-split-bar-inner.buy { background: linear-gradient(90deg, rgba(246, 70, 93, 0.55), var(--up)); }
.trade-split-bar-inner.sell { background: linear-gradient(90deg, rgba(46, 189, 133, 0.55), var(--down)); }
.trade-split-val {
  width: 150px;
  flex-shrink: 0;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 五档盘口 */
.trade-depth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.trade-depth-col {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.trade-depth-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.trade-depth-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid rgba(42, 49, 60, 0.4);
}
.trade-depth-row:last-child { border-bottom: none; }
.trade-depth-row .lv {
  width: 26px;
  font-size: 11px;
  color: var(--text-mute);
  flex-shrink: 0;
}
.trade-depth-row .p { font-weight: 700; flex: 1; text-align: right; }
.trade-depth-row .v { width: 78px; text-align: right; color: var(--text-dim); }
.trade-depth-total {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 逐笔明细 */
.trade-ticks {
  max-height: 320px;
  overflow-y: auto;
}
.trade-ticks .quote-table thead th,
.trade-ticks .quote-table tbody td { padding: 7px 12px; font-size: 12px; }
.trade-dir-buy { color: var(--up) !important; font-weight: 700; }
.trade-dir-sell { color: var(--down) !important; font-weight: 700; }

/* 历史图 */
.trade-flow-chart {
  width: 100%;
  height: 260px;
}

.trade-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.trade-src-note {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-mute);
}

/* ============ 板块成分股 ============ */
.board-stocks {
  margin-top: 16px;
}
.board-stocks-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}
.board-stocks-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gold);
}
.board-stocks-sub {
  font-size: 12px;
  color: var(--text-mute);
}
.board-stocks-empty {
  padding: 20px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ============ 响应式 ============ */
@media (max-width: 860px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .search-box { order: 3; max-width: 100%; flex-basis: 100%; }
  .topbar-right { margin-left: 0; flex-wrap: wrap; }
  .index-overview { grid-template-columns: 1fr; padding: 16px 16px 0; }
  .top-gainers { padding: 0 16px; }
  .gainers-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .main { padding: 0 16px; }
  .chart, #indicator-chart { height: 360px; }
  .quote-table thead th, .quote-table tbody td { padding: 10px 8px; font-size: 12px; }
  .market-toolbar { flex-direction: column; align-items: stretch; }
  .pagination { margin-left: 0; justify-content: center; }
  .terms-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
  .industry-group-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .chain-leaders, .chain-materials { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .chain-chart { height: 320px; }
  .chain-toolbar-hint { margin-left: 0; }
  .trade-depth { grid-template-columns: 1fr; }
  .trade-stat-row { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
  .trade-flow-chart { height: 220px; }
  .trade-split-val { width: 118px; font-size: 12px; }
}

/* ============ 原材料每日价格 ============ */
.raw-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.raw-toolbar-left { display: flex; flex-direction: column; gap: 4px; }
.raw-toolbar-title {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(90deg, #E6E8EA, #F0B90B);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.raw-meta-line { font-size: 12px; color: var(--text-mute); }

.raw-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.raw-card {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, transform 0.2s;
}
.raw-card:hover { border-color: var(--gold); transform: translateY(-2px); }
.raw-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.raw-name { font-size: 14px; font-weight: 700; color: var(--text); }
.raw-unit { font-size: 11px; color: var(--text-mute); }
.raw-price {
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 6px 0 2px;
  letter-spacing: -0.5px;
}
.raw-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.raw-pct { font-weight: 600; font-variant-numeric: tabular-nums; }
.raw-date { color: var(--text-mute); }
.raw-source { font-size: 11px; color: var(--text-mute); margin-top: 4px; }
.raw-input-row { display: flex; gap: 6px; margin-top: 10px; }
.raw-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.raw-input:focus { border-color: var(--gold); }
.raw-save {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--gold);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}
.raw-save:hover { background: rgba(240, 185, 11, 0.15); border-color: var(--gold); }

.raw-section-title {
  padding: 14px 18px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-dim);
}
.raw-table-wrap { overflow-x: auto; }
.raw-history-table, .raw-leaders-table { min-width: 720px; }
.raw-date-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.raw-th-unit { display: block; font-size: 10px; color: var(--text-mute); font-weight: 400; }
.raw-today {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(240, 185, 11, 0.18);
  color: var(--gold);
  font-size: 10px;
}
.raw-empty { color: var(--text-mute); }
.raw-seg-row td {
  background: var(--bg-elevated);
  color: var(--gold);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.raw-pos { font-size: 12px; color: var(--text-dim); }

@media (max-width: 860px) {
  .raw-cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .raw-price { font-size: 21px; }
  .raw-toolbar { align-items: flex-start; }
}

/* 领涨榜失败态 */
.gainer-error { border-color: rgba(246, 70, 93, 0.4); }
.gainer-error .gainer-board { color: #F6465D; }
.gainer-retry {
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--blue);
  font-size: 11px;
  cursor: pointer;
}
.gainer-retry:hover { border-color: var(--blue); background: rgba(74, 158, 255, 0.12); }

/* ============ 全球实时新闻 ============ */
.news-flash {
  max-width: 1280px;
  margin: 16px auto 0;
  padding: 0 24px;
}
.news-flash-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.news-flash-title {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(90deg, #E6E8EA, #F0B90B);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.news-flash-time { font-size: 11px; color: var(--text-mute); }
.news-more {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  cursor: pointer;
}
.news-more:hover { text-decoration: underline; }

.news-flash-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.news-flash-empty {
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-mute);
  font-size: 13px;
}

.news-item {
  display: block;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, transform 0.2s;
}
.news-item:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
}
.news-item-compact { padding: 11px 13px; }
.news-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-item-compact .news-title { font-size: 12.5px; }
.news-summary {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-mute);
}
.news-source { color: var(--gold); }

.news-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.news-toolbar-left { display: flex; flex-direction: column; gap: 4px; }
.news-toolbar-title { font-size: 16px; font-weight: 700; color: var(--text); }
.news-meta-line { font-size: 12px; color: var(--text-mute); }
.news-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.news-search {
  position: relative;
  display: flex;
  align-items: center;
  height: 32px;
  min-width: 230px;
  padding: 0 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.25);
  transition: border-color 0.18s, box-shadow 0.18s;
}
.news-search:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.12);
}
.news-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  color: var(--text-mute);
  pointer-events: none;
}
.news-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  line-height: 30px;
}
.news-search input::placeholder { color: var(--text-mute); }
.news-search input::-webkit-search-cancel-button { display: none; }
.news-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}
.news-search-clear.show { display: flex; }
.news-search-clear:hover { background: rgba(255, 255, 255, 0.2); color: var(--text); }
.news-watch-toggle {
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
}
.news-watch-toggle:hover { border-color: var(--blue); color: var(--text); }
.news-watch-toggle.active {
  border-color: rgba(240, 185, 11, 0.55);
  background: rgba(240, 185, 11, 0.12);
  color: var(--gold);
}

.news-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 12px;
}
.news-empty {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-mute);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
}
.news-retry {
  margin-left: 8px;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--blue);
  font-size: 12px;
  cursor: pointer;
}

/* ---------- 实时状态 / 快讯增强 ---------- */
.news-live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--down);
  box-shadow: 0 0 0 0 rgba(46, 189, 133, 0.7);
  animation: newsPulse 1.8s infinite;
  vertical-align: 1px;
}
@keyframes newsPulse {
  0% { box-shadow: 0 0 0 0 rgba(46, 189, 133, 0.55); }
  70% { box-shadow: 0 0 0 6px rgba(46, 189, 133, 0); }
  100% { box-shadow: 0 0 0 0 rgba(46, 189, 133, 0); }
}
.news-error { color: var(--up); }
.news-flash-impact { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.news-flash-tag {
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 10.5px;
  line-height: 1.6;
}
.news-flash-tag.bull { color: var(--up); border-color: rgba(246, 70, 93, 0.35); background: rgba(246, 70, 93, 0.08); }
.news-flash-tag.bear { color: var(--down); border-color: rgba(46, 189, 133, 0.35); background: rgba(46, 189, 133, 0.08); }
.news-flash-tag.neutral { color: var(--gold); border-color: rgba(240, 185, 11, 0.3); background: rgba(240, 185, 11, 0.07); }

/* ---------- 影响雷达 ---------- */
.news-impact-board {
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.78fr;
  gap: 12px;
  margin-bottom: 14px;
}
.news-impact-card {
  padding: 14px 16px;
  background: linear-gradient(145deg, var(--bg-card), var(--bg-panel));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 0;
}
.news-impact-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.news-impact-title { font-size: 13.5px; font-weight: 700; color: var(--text); }
.news-impact-sub { font-size: 10.5px; color: var(--text-mute); }
.news-impact-empty { font-size: 12px; color: var(--text-mute); padding: 6px 0; }
.news-theme-row {
  display: grid;
  grid-template-columns: 84px 1fr 64px;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 4px;
  margin: 0 -4px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.news-theme-row:hover { background: rgba(255, 255, 255, 0.04); }
.news-theme-name {
  font-size: 11.5px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.news-theme-bar {
  display: block;
  height: 6px;
  border-radius: 4px;
  background: #262E38;
  overflow: hidden;
}
.news-theme-fill {
  display: block;
  height: 100%;
  border-radius: 4px;
  transition: width 0.45s ease;
}
.news-theme-fill.bull { background: linear-gradient(90deg, rgba(246, 70, 93, 0.55), var(--up)); }
.news-theme-fill.bear { background: linear-gradient(90deg, rgba(46, 189, 133, 0.55), var(--down)); }
.news-theme-fill.neutral { background: linear-gradient(90deg, rgba(240, 185, 11, 0.45), var(--gold)); }
.news-theme-heat { font-size: 10.5px; text-align: right; white-space: nowrap; color: var(--text-mute); }
.news-theme-heat.bull { color: var(--up); }
.news-theme-heat.bear { color: var(--down); }
.news-impact-stock-list { display: flex; flex-wrap: wrap; gap: 7px; }
.news-impact-note { margin: 0 0 6px; font-size: 11px; line-height: 1.65; color: var(--text-mute); }
.news-impact-note b { font-weight: 600; }
.news-impact-note b.bull { color: var(--up); }
.news-impact-note b.bear { color: var(--down); }
.news-impact-note code {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 10.5px;
}

/* ---------- 筛选条 ---------- */
.news-filters { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.news-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.news-filter-label { font-size: 11px; color: var(--text-mute); margin-right: 2px; }
.news-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.6;
  cursor: pointer;
  transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.news-filter-btn em {
  font-style: normal;
  font-size: 10px;
  color: var(--text-mute);
}
.news-filter-btn:hover { border-color: var(--blue); color: var(--text); }
.news-filter-btn.active {
  border-color: rgba(240, 185, 11, 0.6);
  background: rgba(240, 185, 11, 0.12);
  color: var(--gold);
}
.news-filter-btn.active em { color: var(--gold); }

/* ---------- AI 新闻研判 ---------- */
.news-ai-card {
  padding: 15px 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(240, 185, 11, 0.24);
  border-radius: var(--radius);
  background:
    radial-gradient(120% 160% at 0% 0%, rgba(240, 185, 11, 0.09), transparent 55%),
    linear-gradient(145deg, var(--bg-card), var(--bg-panel));
}
.news-ai-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.news-ai-title { font-size: 14.5px; font-weight: 700; color: var(--gold); }
.news-ai-badge {
  padding: 1px 7px;
  border: 1px solid rgba(240, 185, 11, 0.4);
  border-radius: 4px;
  font-size: 10px;
  color: var(--gold);
  background: rgba(240, 185, 11, 0.08);
}
.news-ai-sub { font-size: 11px; color: var(--text-mute); }
.news-ai-actions { margin-left: auto; display: flex; gap: 8px; }
.news-ai-btn {
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.18s;
}
.news-ai-btn:hover { border-color: var(--gold); color: var(--gold); }
.news-ai-btn.primary {
  border-color: rgba(240, 185, 11, 0.55);
  background: rgba(240, 185, 11, 0.14);
  color: var(--gold);
}
.news-ai-btn.primary:hover { background: rgba(240, 185, 11, 0.24); }
.news-ai-btn.danger { border-color: rgba(246, 70, 93, 0.55); color: var(--up); }
.news-ai-body {
  margin-top: 11px;
  max-height: 440px;
  overflow: auto;
  padding-right: 6px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-dim);
}
.news-ai-body.ds-md { font-size: 12.5px; }
.news-ai-body .ds-p { margin: 0 0 8px; }
.news-ai-empty {
  margin-top: 11px;
  padding: 14px 16px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-mute);
  background: rgba(255, 255, 255, 0.02);
}
.news-ai-error {
  margin-top: 11px;
  padding: 10px 13px;
  border: 1px solid rgba(246, 70, 93, 0.35);
  border-radius: 6px;
  background: rgba(246, 70, 93, 0.06);
  color: var(--up);
  font-size: 12px;
}
.news-ai-foot { margin-top: 10px; font-size: 10.5px; color: var(--text-mute); }
.news-ai-cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-left: 2px;
  background: var(--gold);
  vertical-align: -2px;
  animation: newsBlink 1s steps(2) infinite;
}
@keyframes newsBlink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
.news-ai-typing { color: var(--text-mute); font-size: 12px; }
.news-ai-typing span {
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--gold);
  animation: newsDot 1.2s infinite ease-in-out;
}
.news-ai-typing span:nth-child(2) { animation-delay: 0.16s; }
.news-ai-typing span:nth-child(3) { animation-delay: 0.32s; }
@keyframes newsDot {
  0%, 70%, 100% { transform: translateY(0); opacity: 0.35; }
  35% { transform: translateY(-4px); opacity: 1; }
}

/* ---------- 新闻条目增强 ---------- */
.news-item { position: relative; }
.news-item .news-title { text-decoration: none; color: var(--text); transition: color 0.18s; }
.news-item:hover .news-title { color: var(--gold); }
.news-head { display: flex; align-items: flex-start; gap: 8px; }
.news-tag-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.news-tag {
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 3px;
  font-size: 10px;
  line-height: 1.7;
  color: var(--text-mute);
}
.news-impact {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px dashed rgba(255, 255, 255, 0.07);
}
.news-impact-line { display: flex; align-items: flex-start; gap: 7px; margin-bottom: 5px; }
.news-impact-label {
  flex: 0 0 50px;
  padding-top: 1px;
  font-size: 10.5px;
  color: var(--text-mute);
}
.news-impact-chips { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.news-theme-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  font-size: 10.5px;
  line-height: 1.7;
  color: var(--text-dim);
  cursor: pointer;
}
.news-theme-chip b { font-weight: 700; }
.news-theme-chip.bull { color: var(--up); border-color: rgba(246, 70, 93, 0.32); background: rgba(246, 70, 93, 0.07); }
.news-theme-chip.bear { color: var(--down); border-color: rgba(46, 189, 133, 0.32); background: rgba(46, 189, 133, 0.07); }
.news-theme-chip.neutral { color: var(--gold); border-color: rgba(240, 185, 11, 0.3); background: rgba(240, 185, 11, 0.06); }
.news-theme-chip:hover { filter: brightness(1.25); }
.stock-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(74, 158, 255, 0.05);
  color: var(--blue);
  font-size: 10.5px;
  line-height: 1.7;
  cursor: pointer;
}
.stock-link em { font-style: normal; font-size: 9.5px; color: var(--text-mute); }
.stock-link.bull { color: var(--up); border-color: rgba(246, 70, 93, 0.3); background: rgba(246, 70, 93, 0.06); }
.stock-link.bear { color: var(--down); border-color: rgba(46, 189, 133, 0.3); background: rgba(46, 189, 133, 0.06); }
.stock-link:hover { border-color: var(--blue); background: rgba(74, 158, 255, 0.14); }
.news-ai-one {
  margin-left: auto;
  padding: 1px 8px;
  border: 1px solid rgba(240, 185, 11, 0.3);
  border-radius: 4px;
  background: rgba(240, 185, 11, 0.06);
  color: var(--gold);
  font-size: 10.5px;
  cursor: pointer;
}
.news-ai-one:hover { background: rgba(240, 185, 11, 0.16); }
.news-detail-btn {
  margin-left: auto;
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(74, 158, 255, 0.06);
  color: var(--blue);
  font-size: 10.5px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.news-detail-btn:hover { border-color: var(--blue); background: rgba(74, 158, 255, 0.16); }
.news-detail-btn + .news-ai-one { margin-left: 6px; }
.news-meta { flex-wrap: wrap; }

/* ---------- 新闻详情弹窗 ---------- */
body.news-modal-open { overflow: hidden; }
.news-detail-mask {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(4px);
}
.news-detail-mask.open { display: flex; }
.news-detail {
  width: min(760px, 100%);
  max-height: 86vh;
  overflow-y: auto;
  padding: 20px 24px 18px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  animation: newsDetailIn 0.2s ease-out;
}
@keyframes newsDetailIn {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.news-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: var(--text-mute);
}
.news-detail-head .news-source { color: var(--gold); }
.news-detail-close {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.news-detail-close:hover { border-color: var(--up); color: var(--up); }
.news-detail-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.news-detail-badge {
  padding: 0 7px;
  border: 1px solid rgba(240, 185, 11, 0.35);
  border-radius: 3px;
  background: rgba(240, 185, 11, 0.08);
  color: var(--gold);
  font-size: 10px;
  line-height: 1.8;
}
.news-detail-title {
  margin: 12px 0 0;
  font-size: 18px;
  line-height: 1.55;
  font-weight: 700;
  color: var(--text);
}
.news-detail-body {
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.85;
  color: var(--text-dim);
  white-space: pre-wrap;
  word-break: break-word;
}
.news-detail .news-impact {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
}
.news-detail-reason {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--text-mute);
}
.news-detail-reason strong { color: var(--text-dim); font-weight: 600; }
.news-detail-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.news-detail-link {
  font-size: 12px;
  color: var(--blue);
  text-decoration: none;
}
.news-detail-link:hover { text-decoration: underline; }
.news-detail-ai {
  padding: 6px 14px;
  border: 1px solid rgba(240, 185, 11, 0.35);
  border-radius: 6px;
  background: rgba(240, 185, 11, 0.08);
  color: var(--gold);
  font-size: 12px;
  cursor: pointer;
}
.news-detail-ai:hover { background: rgba(240, 185, 11, 0.18); }

@media (max-width: 1100px) {
  .news-impact-board { grid-template-columns: 1fr 1fr; }
  .news-impact-legend { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .tabs {
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab-btn { flex: 0 0 auto; white-space: nowrap; padding: 9px 14px; }
  .news-flash { padding: 0 16px; }
  .news-flash-list { grid-template-columns: 1fr; }
  .news-list { grid-template-columns: 1fr; }
  .news-impact-board { grid-template-columns: 1fr; }
  .news-impact-legend { grid-column: auto; }
  .news-theme-row { grid-template-columns: 76px 1fr 58px; }
  .news-ai-actions { margin-left: 0; width: 100%; }
  .news-ai-body { max-height: 360px; }
  .news-toolbar-right { width: 100%; }
  .news-search { flex: 1 1 auto; min-width: 0; }
  .news-detail-mask { padding: 12px; }
  .news-detail { max-height: 92vh; padding: 16px; }
  .news-detail-title { font-size: 16px; }
}
@media (max-width: 560px) {
  .news-toolbar { padding: 12px; }
  .news-toolbar-right { gap: 6px; }
  .news-watch-toggle { padding: 0 10px; }
  .news-detail-foot { flex-direction: column; align-items: stretch; }
  .news-detail-ai { width: 100%; }
}

/* ============ AI 分析 ============ */
.ai-toolbar { padding: 12px 16px; margin-bottom: 12px; }
.ai-toolbar-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-key-input {
  flex: 1;
  min-width: 200px;
  padding: 7px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.ai-key-input:focus { border-color: var(--gold); }
.ai-status { margin-top: 6px; font-size: 11px; color: var(--text-mute); }
.ai-status-error { color: #F6465D; }

.ai-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.ai-preset-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--bg-card);
  color: var(--text-dim);
  font-size: 12.5px;
  cursor: pointer;
  transition: all 0.2s;
}
.ai-preset-btn:hover { color: var(--gold); border-color: var(--gold); background: rgba(240, 185, 11, 0.08); }

.ai-chat {
  height: 480px;
  overflow-y: auto;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.ai-empty { margin: auto; text-align: center; max-width: 460px; }
.ai-empty-title { font-size: 16px; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.ai-empty-desc { font-size: 13px; line-height: 1.7; color: var(--text-mute); }

.ai-msg { display: flex; flex-direction: column; gap: 4px; max-width: 88%; }
.ai-msg-user { align-self: flex-end; align-items: flex-end; }
.ai-msg-bot { align-self: flex-start; align-items: flex-start; }
.ai-msg-role { font-size: 11px; color: var(--text-mute); }
.ai-msg-body {
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
  word-break: break-word;
}
.ai-msg-user .ai-msg-body {
  background: rgba(74, 158, 255, 0.16);
  border: 1px solid rgba(74, 158, 255, 0.3);
}
.ai-msg-bot .ai-msg-body {
  background: var(--bg-panel);
  border: 1px solid var(--border);
}
.ai-msg-body .ai-h2 { font-weight: 700; color: var(--gold); margin: 8px 0 4px; }
.ai-msg-body .ai-h3 { font-weight: 700; color: var(--text); margin: 6px 0 3px; }
.ai-msg-body .ai-li { padding-left: 4px; }

.ai-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 12px 14px;
}
.ai-input {
  flex: 1;
  min-height: 54px;
  max-height: 140px;
  padding: 8px 10px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  font-family: inherit;
}
.ai-input:focus { border-color: var(--gold); }
.ai-send {
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), #d4a100);
  color: #1a1a1a;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.ai-send:disabled { opacity: 0.55; cursor: not-allowed; }

@media (max-width: 860px) {
  .ai-chat { height: 400px; }
  .ai-msg { max-width: 96%; }
  .ai-key-input { min-width: 150px; }
}

/* ================= 价格预警 ================= */
.alert-toolbar-card { padding: 16px 18px; margin-bottom: 16px; }
.alert-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.alert-field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.alert-input {
  height: 36px;
  min-width: 150px;
  padding: 0 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.alert-input:focus { border-color: var(--blue); }
.alert-input::placeholder { color: var(--text-mute); }
.alert-input-num { width: 120px; min-width: 110px; padding-right: 34px; }
.alert-unit {
  position: absolute;
  right: 12px;
  bottom: 10px;
  font-size: 12px;
  color: var(--text-mute);
  pointer-events: none;
}
.alert-add-btn { height: 36px; padding: 0 20px; }
.alert-toolbar-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.alert-hint { font-size: 12px; color: var(--text-mute); }
.alert-mini-btn {
  height: 30px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}
.alert-mini-btn:hover { color: var(--text); border-color: var(--blue); }
.alert-mini-btn.danger { color: var(--up); border-color: rgba(246, 70, 93, 0.35); }
.alert-mini-btn.danger:hover { background: rgba(246, 70, 93, 0.12); }
.alert-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.alert-card-title { font-size: 14px; font-weight: 600; color: var(--text); }
.alert-table thead th { text-align: left; }
.alert-table tbody td { text-align: left; }
.alert-table tbody tr { cursor: default; }
.alert-table .stock-name { font-size: 13px; color: var(--text); }
.alert-table .stock-code { display: block; font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.alert-cond { font-size: 13px; color: var(--text-dim); }
.alert-unit-inline { font-size: 11px; color: var(--text-mute); margin-left: 2px; }
.alert-val { font-weight: 600; color: var(--text); }
.alert-price { font-weight: 600; }
.alert-chg { font-size: 11px; font-weight: 500; margin-left: 4px; }
.alert-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 11px;
  line-height: 1.6;
}
.alert-status.on { color: var(--down); background: rgba(46, 189, 133, 0.12); }
.alert-status.off { color: var(--text-mute); background: rgba(107, 114, 128, 0.15); }
.alert-status.hit { color: var(--gold); background: rgba(240, 185, 11, 0.15); }
.alert-mini-btn.danger:hover { color: var(--up); border-color: var(--up); }
.alert-table td.c-del .alert-mini-btn + .alert-mini-btn { margin-left: 8px; }
.alert-empty td { padding: 28px 0; text-align: center; color: var(--text-mute); font-size: 13px; }
.alert-history-card { margin-top: 16px; }
.alert-history { max-height: 320px; overflow-y: auto; padding: 4px 18px 14px; }
.alert-history-empty { padding: 28px 0; text-align: center; color: var(--text-mute); font-size: 13px; }
.alert-history-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.alert-history-item:last-child { border-bottom: none; }
.alert-history-time { flex: none; font-size: 12px; color: var(--text-mute); font-variant-numeric: tabular-nums; }
.alert-history-msg { flex: 1; color: var(--text); }
.alert-history-price { flex: none; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
  .alert-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .alert-field { flex: 1 1 auto; min-width: 0; }
  .alert-input, .alert-input-num { width: 100%; min-width: 0; }
  .alert-add-btn { width: 100%; }
  .alert-toolbar-sub { gap: 10px; }
  #panel-alerts .table-card { overflow-x: auto; }
  .alert-table { min-width: 0; }
  .alert-table thead th, .alert-table tbody td { padding: 10px 8px; }
  .alert-table thead th:nth-child(4), .alert-table tbody td:nth-child(4) { display: none; }
  .alert-table .stock-name { font-size: 12px; }
  .alert-table .alert-mini-btn { padding: 0 8px; font-size: 11px; }
  .alert-table .alert-status { padding: 2px 8px; }
  .alert-table td.c-del .alert-mini-btn + .alert-mini-btn { margin-left: 6px; }
  .alert-history { padding: 4px 14px 12px; }
  .alert-history-item { flex-wrap: wrap; gap: 4px 10px; }
  .alert-history-msg { flex: 1 1 100%; }
  .alert-history-price { margin-left: auto; }
}
