:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #22262b;
  --muted: #7a828c;
  --border: #e5e8ec;
  --up: #d9262e;
  --down: #0b9a5c;
  --flat: #5f6672;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --tag: #eef2ff;
  --tag-text: #4f46e5;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 1px 2px rgba(20, 30, 50, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, #f7f9fc, #f1f4f9);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  box-shadow: var(--shadow);
  transition: transform .25s ease;
}
.topbar.hidden { transform: translateY(-110%); }
.brand h1 { margin: 0; font-size: 20px; }
.brand .sub { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; }
.btn {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background .15s;
}
.btn:hover { background: #f0f2f5; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
main { max-width: 1080px; margin: 0 auto; padding: 20px 16px 40px; }
section { margin-bottom: 28px; }
h2 {
  font-size: 16px;
  margin: 0 0 12px;
  padding-left: 10px;
  border-left: 4px solid var(--primary);
}
.hint { color: var(--muted); font-size: 12px; font-weight: normal; margin-left: 6px; }
.grid { display: grid; gap: 12px; }
.grid.indices { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); }
.grid.sectors { grid-template-columns: repeat(12, 1fr); }
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.index-card .name { font-size: 13px; color: var(--muted); }
.index-card .price { font-size: 26px; font-weight: 700; margin: 4px 0 2px; }
.index-card .chg { font-size: 15px; font-weight: 600; }
.index-card .amount { font-size: 12px; color: var(--muted); margin-top: 6px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.sector-card .sname { font-size: 14px; color: var(--muted); }
.sector-card .sprice { font-size: 20px; font-weight: 700; margin: 4px 0 2px; }
.sector-card .spct { font-size: 14px; font-weight: 600; }
.sector-editor { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.sector-editor input {
  flex: 1; min-width: 220px; max-width: 340px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.sector-editor input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.save-msg { color: var(--muted); font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; min-height: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--tag);
  color: var(--tag-text);
  padding: 5px 6px 5px 12px;
  border-radius: 999px;
  font-size: 13px;
}
.chip button {
  border: none; background: transparent; color: inherit;
  cursor: pointer; font-size: 15px; line-height: 1;
  padding: 0 4px;
}
.chip button:hover { opacity: .7; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.tab {
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
}
.tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.tab:hover:not(.active) { background: #f0f2f5; }
.news-list { display: flex; flex-direction: column; gap: 12px; }
.news-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: box-shadow .15s, transform .15s;
}
.news-card:hover { box-shadow: 0 4px 14px rgba(20, 30, 50, .12); transform: translateY(-1px); }
.news-card a { display: flex; gap: 14px; text-decoration: none; color: inherit; padding: 12px 14px; }
.news-card img.thumb {
  width: 128px; height: 84px; object-fit: cover;
  border-radius: 8px; flex-shrink: 0;
  background: #eef0f3;
}
.news-card .thumb-placeholder {
  width: 128px; height: 84px; flex-shrink: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #eef0f3, #f8f9fb);
  display: flex; align-items: center; justify-content: center;
  color: #b6bcc6; font-size: 26px;
}
.news-body { flex: 1; min-width: 0; }
.news-body h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; line-height: 1.4; }
.news-body h3:hover { color: var(--primary); }
.news-body .summary {
  margin: 0 0 8px; color: #4b5563; font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-body .meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.badge {
  background: #f0f2f5; color: #4b5563;
  padding: 2px 8px; border-radius: 6px; font-size: 12px;
}
.badge.rank {
  background: var(--up); color: #fff; font-weight: 700; min-width: 22px; text-align: center;
}
.tag {
  background: var(--tag); color: var(--tag-text);
  padding: 2px 8px; border-radius: 6px; font-size: 12px; cursor: pointer;
  border: none;
}
.tag:hover { background: #e0e7ff; }
.tag.active { background: var(--tag-text); color: #fff; }
.empty {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  color: var(--muted);
}
.empty .btn { margin-top: 12px; }
.unmatched {
  background: #fff7ed; color: #9a3412;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 12px;
}
footer { text-align: center; color: var(--muted); font-size: 12px; padding: 20px 16px 32px; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: rgba(30, 34, 40, .92); color: #fff;
  padding: 10px 18px; border-radius: 10px; font-size: 13px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  z-index: 100; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (max-width: 640px) {
  .news-card a { flex-direction: column; }
  .news-card img.thumb, .news-card .thumb-placeholder { width: 100%; height: 150px; }
}

/* ---------- 板块分析 & 精选股票 ---------- */
.analysis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.analysis-col h3 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.analysis-col .ana-card { margin-bottom: 10px; }
.ana-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ana-name { font-size: 15px; font-weight: 700; }
.badge.score { background: #fff3cd; color: #8a6d00; font-weight: 700; }
.badge.hot { background: #ffe3e3; color: #c92a2a; font-weight: 700; }
.ana-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; font-size: 13px; }
.reasons { margin: 4px 0 0; padding-left: 16px; }
.reasons li { font-size: 12.5px; color: #4b5563; line-height: 1.6; }
.grid.stocks { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stock-card .stock-head { display: flex; align-items: baseline; gap: 8px; }
.stock-name { font-size: 16px; font-weight: 700; }
.stock-code { font-size: 12px; color: var(--muted); }
.stock-sector { font-size: 12px; color: var(--primary); margin: 4px 0 2px; }
.stock-stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0; font-size: 13px; }
.spct { font-weight: 600; }
.sinflow { font-weight: 600; }
.smeta { display: flex; gap: 10px; font-size: 13px; }

/* ---------- 新闻工具栏 ---------- */
.news-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.news-toolbar input[type="text"] {
  flex: 1; min-width: 220px; max-width: 380px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.news-toolbar input[type="text"]:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.rec-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }
.rec-toggle input { accent-color: var(--up); }
.kw {
  background: #f3f0ff; color: #6741d9;
  padding: 2px 8px; border-radius: 6px; font-size: 12px;
}
@media (max-width: 720px) {
  .analysis-grid { grid-template-columns: 1fr; }
}

/* ---------- 国际市场 ---------- */
.index-card.global .name { font-size: 12.5px; }
.index-card.global .price { font-size: 22px; }

/* ---------- AI 预测 ---------- */
.ai-settings {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.ai-settings summary { cursor: pointer; font-size: 14px; color: var(--muted); user-select: none; }
.ai-settings-body {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
  margin-top: 10px;
}
.ds-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.ds-field input, .ds-field select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  min-width: 260px;
}
.ds-field input:focus, .ds-field select:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.ai-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  line-height: 1.75;
}
.ai-box h2 { border-left: 4px solid #7c3aed; margin: 18px 0 8px; padding-left: 10px; font-size: 16px; }
.ai-box h3 { margin: 14px 0 6px; font-size: 15px; color: #4c1d95; }
.ai-box h4 { margin: 12px 0 4px; font-size: 14px; }
.ai-box p { margin: 6px 0; font-size: 14px; }
.ai-box ul { margin: 6px 0; padding-left: 22px; }
.ai-box li { margin: 3px 0; font-size: 14px; }
.ai-box strong { color: #b91c1c; }
.ai-btns { margin-top: 14px; display: flex; gap: 8px; }
.ai-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* ---------- 回调观察 ---------- */
.pullback-block { margin-top: 18px; }
.pullback-block h3 { font-size: 14px; color: var(--muted); font-weight: 600; margin: 0 0 10px; }
.grid.ana-pull { grid-template-columns: repeat(auto-fit, minmax(185px, 1fr)); gap: 10px; }
.ana-card .ana-stats .sinflow.up { color: var(--down); }
.ana-card .ana-stats .sinflow.down { color: var(--up); }

/* ---------- 复盘报告 ---------- */
.improvement-block { margin-top: 16px; }
.improvement-block h3 { font-size: 14px; color: var(--muted); font-weight: 600; margin: 0 0 8px; }
.improvement-list { margin: 6px 0; padding-left: 20px; }
.improvement-list li { margin: 4px 0; font-size: 13.5px; color: #3b4252; line-height: 1.6; }
.review-summary { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 12px; }
.review-rate { font-size: 14px; font-weight: 700; color: #1d4ed8; }
.review-err { font-size: 12px; color: var(--up); }
.review-table { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.review-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; font-size: 13px;
  border-bottom: 1px solid #f0f2f5;
}
.review-row:last-child { border-bottom: none; }
.review-kind {
  background: #eef2ff; color: #4f46e5; font-size: 11px;
  padding: 1px 7px; border-radius: 6px; flex-shrink: 0;
}
.review-name { flex: 1; min-width: 0; }
.review-val { width: 90px; text-align: right; font-weight: 600; flex-shrink: 0; }
.review-verdict { width: 96px; text-align: right; flex-shrink: 0; font-size: 12px; }
.review-verdict.hit { color: var(--down); }
.review-verdict.miss { color: var(--up); }
.review-ai-title { margin: 14px 0 6px; font-size: 15px; color: #1d4ed8; }

/* ---------- 每日知识库 ---------- */
.knowledge-day { margin-bottom: 10px; }
.knowledge-head { margin-bottom: 4px; }
.knowledge-date { font-size: 14px; font-weight: 700; }
.knowledge-day details { margin-top: 4px; }
.knowledge-day summary {
  cursor: pointer; font-size: 12.5px; color: var(--primary);
  user-select: none;
}
.knowledge-day details[open] summary { margin-bottom: 6px; }
.knowledge-day details .ai-box { box-shadow: none; border: 1px dashed var(--border); }
.knowledge-day details .ai-box h3 { border-left: 3px solid #0ca678; margin: 12px 0 6px; }

/* ---------- 数据验证/时效标注 ---------- */
.badge.age { background: #fff3bf; color: #8a6d00; }

/* ---------- 折叠面板 ---------- */
.panel {
  margin-bottom: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  cursor: pointer; padding: 12px 16px; user-select: none;
  list-style: none;
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary h2 { margin: 0; font-size: 15px; padding-left: 8px; border-left: 4px solid var(--primary); }
.panel summary .hint { font-size: 12px; }
.panel summary .caret {
  width: 0; height: 0; flex-shrink: 0;
  border-left: 7px solid #99a1ac;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform .15s;
}
.panel[open] summary .caret { transform: rotate(90deg); }
.panel-body { padding: 12px 16px 16px; }
.brief-btn { border-color: #7c3aed; color: #7c3aed; font-weight: 600; }
.brief-btn:hover { background: #f3f0ff; }

/* ---------- 登录/注册弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(20, 26, 36, .5);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: fadeIn .18s ease;
}
.modal-box {
  background: #fff; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
  padding: 22px 24px; width: 100%; max-width: 400px;
  animation: modalIn .18s ease;
}
.modal-box h3 { margin: 0 0 8px; font-size: 17px; }
.modal-tip { margin: 0 0 12px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.modal-box input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font-size: 14px; box-sizing: border-box;
}
.modal-box input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.modal-btns { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

/* ---------- 侧栏导航 + 视图 ---------- */
.menu-btn { display: none; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: 224px;
  background: #16233a; color: #c7d2e0;
  display: flex; flex-direction: column; z-index: 60;
  border-radius: 0 16px 16px 0;
  box-shadow: 2px 0 14px rgba(10, 20, 40, .12);
}
.sidebar-brand {
  padding: 20px 20px 14px; font-size: 16px; font-weight: 700; color: #fff;
  letter-spacing: .5px; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.nav-item {
  padding: 10px 14px; margin: 2px 0; border-radius: 8px; cursor: pointer;
  font-size: 14px; color: #c7d2e0; user-select: none;
  transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: #2563eb; color: #fff; font-weight: 600; }
.nav-item.parent { display: flex; align-items: center; justify-content: space-between; }
.nav-caret {
  width: 0; height: 0;
  border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid #8fa0b8; transition: transform .15s;
}
.nav-item.parent.open .nav-caret { transform: rotate(180deg); }
.nav-sub {
  display: block; margin: 0; max-height: 0; overflow: hidden; opacity: 0;
  transition: max-height .28s ease, opacity .2s ease, margin .2s ease;
}
.nav-item.parent.open + .nav-sub {
  max-height: 220px; opacity: 1; margin: 2px 0 4px;
}
@media (hover: hover) and (min-width: 769px) {
  .nav-item.parent:hover + .nav-sub,
  .nav-sub:hover {
    max-height: 220px; opacity: 1; margin: 2px 0 4px;
  }
}
.nav-item.sub { padding-left: 26px; font-size: 13px; }
.sidebar-actions {
  padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar-actions .btn { background: #e2e8f0; color: #16233a; border: none; text-align: center; }
.sidebar-actions .btn.primary { background: #2563eb; color: #fff; }
.sidebar-actions .btn:hover { filter: brightness(.96); }
.content { margin-left: 224px; padding: 20px 24px 40px; max-width: 1080px; min-height: 100vh; }
.content-head { margin-bottom: 16px; }
.content-head h2 { margin: 0 0 4px; font-size: 20px; padding-left: 10px; border-left: 4px solid #2563eb; }
.content-head .sub { margin: 0; color: var(--muted); font-size: 13px; }
.view { display: none; }
.view.active { display: block; animation: viewIn .22s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.site-footer { margin-left: 224px; text-align: center; color: var(--muted); font-size: 12px; padding: 10px 16px 30px; }
.sidebar-mask { display: none; }

/* 移动端抽屉 */

/* ---------- 管理视图（仅管理员） ---------- */
.admin-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .05);
}
.admin-card h4 { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.admin-card .sub { margin: 0 0 12px; font-size: 12px; color: var(--muted); }
.admin-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.admin-row input[type="text"],
.admin-row input[type="password"] {
  flex: 1 1 160px;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
.admin-row input[readonly] { background: #f8fafc; color: var(--muted); }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 13px;
}
.admin-table th, .admin-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--muted); font-weight: 600; background: #f8fafc; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.admin-self { color: var(--muted); font-size: 12px; padding: 4px 0; display: inline-block; }
.save-msg { font-size: 12px; color: var(--muted); }

@media (max-width: 768px) {
  .menu-btn {
    display: block; position: fixed; top: 10px; left: 12px; z-index: 70;
    background: var(--card); border: 1px solid var(--border); border-radius: 8px;
    padding: 6px 11px; font-size: 18px; cursor: pointer; box-shadow: var(--shadow);
  }
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; width: 248px; }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 30px rgba(0,0,0,.3); }
  .sidebar-mask { position: fixed; inset: 0; background: rgba(10,15,25,.45); z-index: 55; }
  .sidebar-mask.show { display: block; }
  .content { margin-left: 0; padding: 56px 14px 30px; }
  .site-footer { margin-left: 0; }
  .content-head h2 { font-size: 17px; }
}
.view-meta { margin: 0 0 10px; }

/* ---------- 顶部细横栏 ---------- */
.topbar.slim {
  position: fixed; top: 0; left: 224px; right: 0; z-index: 40;
  height: 46px; display: flex; align-items: center; gap: 8px; flex-wrap: nowrap;
  padding: 0 14px;
  background: linear-gradient(135deg, #f4f8ff, #eef2ff);
  border-bottom: 1px solid #e6ebf2;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 2px 8px rgba(20, 30, 50, .06);
  transition: transform .25s ease;
}
.topbar.slim.hidden { transform: translateY(-100%); }
.topbar.slim .menu-btn { display: none; }
.search-box { flex: 1; max-width: 420px; display: flex; gap: 6px; align-items: center; min-width: 0; }
.search-box input {
  flex: 1; min-width: 0; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.search-box input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.topbar-actions { display: flex; gap: 6px; margin-left: auto; flex-shrink: 0; }
.topbar-actions .btn { padding: 5px 10px; font-size: 13px; }
.search-btn { display: flex; align-items: center; justify-content: center; padding: 5px 9px; flex-shrink: 0; }
.search-btn svg { width: 15px; height: 15px; }

/* ---------- 搜索结果视图 ---------- */
.search-results-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.search-results-head h3 { margin: 0; font-size: 16px; }
.search-group { margin-bottom: 18px; }
.search-group h4 {
  font-size: 14px; color: var(--muted); margin: 0 0 8px;
  border-left: 3px solid var(--primary); padding-left: 8px;
}
.search-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 6px; cursor: pointer; background: var(--card);
}
.search-item:hover { border-color: var(--primary); }
.search-item .si-title { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-item .si-tag { font-size: 11px; color: var(--muted); flex-shrink: 0; }

/* 移动端横栏/搜索（常态折叠，点击放大） */
@media (max-width: 768px) {
  .topbar.slim { left: 0; padding-left: 8px; }
  .topbar.slim .menu-btn {
    display: block; position: static; top: auto; left: auto;
    padding: 4px 9px; font-size: 16px; flex-shrink: 0;
  }
  .search-box { max-width: none; flex: 0 0 auto; }
  .search-box input {
    width: 0; padding: 0; border: none; opacity: 0;
    transition: width .2s ease, opacity .15s ease, padding .2s ease;
  }
  .search-box.expanded { flex: 1; }
  .search-box.expanded input {
    width: auto; flex: 1; opacity: 1; padding: 6px 10px;
    border: 1px solid var(--border);
  }
  .search-box.expanded + .topbar-actions { display: none; }
  .topbar-actions .btn { padding: 5px 8px; font-size: 12px; }
}

/* ---------- 板块双标签 ---------- */
.seg-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.seg-tab {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  padding: 6px 16px; border-radius: 999px; cursor: pointer; font-size: 13px;
}
.seg-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.seg-tab:hover:not(.active) { background: #f0f2f5; }
.sector-all-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.sector-all-toolbar input {
  flex: 1; max-width: 320px; padding: 7px 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
}
.sector-all-toolbar input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.sector-all-list { max-height: 60vh; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; }
.sector-all-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-bottom: 1px solid #f0f2f5; font-size: 13px;
}
.sector-all-row:last-child { border-bottom: none; }
.sar-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sar-pct { width: 72px; text-align: right; font-weight: 600; }
.sar-inflow { width: 110px; text-align: right; color: var(--muted); font-size: 12px; }
.sar-btn { padding: 3px 10px; font-size: 12px; }
.sar-btn.added { border-color: var(--down); color: var(--down); }

/* ---------- 搜索历史下拉 ---------- */
.search-box { position: relative; }
.search-history {
  position: absolute; top: calc(100% + 4px); left: 0; width: 300px; max-width: 90vw;
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(20,30,50,.14); z-index: 60; display: none;
  padding: 6px 0;
}
.search-history.show { display: block; animation: dropIn .16s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes modalIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: scale(1); } }
.sh-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 12px 6px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid #f0f2f5;
}
.sh-clear { border: none; background: none; color: var(--primary); cursor: pointer; font-size: 12px; }
.sh-item { padding: 7px 12px; font-size: 13px; cursor: pointer; }
.sh-item:hover { background: #f0f4ff; }

/* ---------- 横栏区分 + 点击收起 ---------- */


/* ---------- 指数图表化卡片 ---------- */
.grid.indices { grid-template-columns: repeat(12, 1fr); gap: 12px; }
.index-card { position: relative; transition: transform .18s ease, box-shadow .18s ease; grid-column: span 3; }
.index-card.big { grid-column: span 8; }
.index-card.md { grid-column: span 4; }
.sector-card { grid-column: span 3; }
.sector-card.big { grid-column: span 8; }
.sector-card.md { grid-column: span 4; }
.index-card .ic-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.index-card .ic-head .code { font-size: 11px; color: var(--muted); }
.index-card .ic-chart { margin-top: 8px; }
.index-card .ic-chart svg { display: block; width: 100%; height: 56px; }
.index-card .ic-chart.md svg { height: 70px; }
.index-card .ic-chart.big svg { height: 120px; }
.card-more {
  display: block; max-height: 0; opacity: 0; overflow: hidden; margin-top: 0;
  font-size: 11.5px; color: var(--muted); line-height: 1.5;
  transition: max-height .2s ease, opacity .15s ease, margin-top .2s ease;
}

/* 悬停放大 + 更多统计（仅桌面） */
@media (hover: hover) and (min-width: 769px) {
  .index-card:hover, .sector-card:hover, .stock-card:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 26px rgba(20, 30, 50, .16);
    z-index: 5;
  }
  .index-card:hover .card-more, .sector-card:hover .card-more { max-height: 44px; opacity: 1; margin-top: 6px; }
}

/* 移动端：两列小卡 + 大卡全宽，无悬停 */
@media (max-width: 768px) {
  .grid.indices, .grid.sectors { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .index-card, .sector-card { grid-column: span 1; }
  .index-card.big, .index-card.md, .sector-card.big, .sector-card.md { grid-column: span 2; }
  .card-more { max-height: 44px; opacity: 1; margin-top: 6px; } /* 移动端直接展示统计，弥补无悬停 */
}

/* ---------- 侧栏底部（帮助与反馈 + 头像） ---------- */
.sidebar-foot {
  margin-top: auto; border-top: 1px solid rgba(255,255,255,.08);
  padding: 10px 10px 14px;
}
.help-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  color: #c7d2e0; font-size: 13px;
}
.help-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.help-ico { width: 18px; height: 18px; flex-shrink: 0; }
.avatar-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; cursor: pointer; border-radius: 8px; margin-top: 4px;
}
.avatar-row:hover { background: rgba(255,255,255,.06); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: #2d4a77; color: #dbe6ff;
  display: flex; align-items: center; justify-content: center;
}
.avatar svg { width: 20px; height: 20px; }
.avatar-name { color: #fff; font-size: 14px; font-weight: 600; }

/* ---------- 导航图标 ---------- */
.nav-item { display: flex; align-items: center; gap: 8px; }
.nav-item .nav-ico { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- 帮助与反馈视图 ---------- */
.help-doc { font-size: 13.5px; line-height: 1.8; color: #3b4252; }
.help-doc h4 { margin: 14px 0 4px; font-size: 14px; color: #1d4ed8; }
.help-doc p { margin: 4px 0; }
.help-fb textarea {
  width: 100%; min-height: 130px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px;
  box-sizing: border-box; font-family: inherit;
}
.help-fb textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.help-fb input[type="text"] {
  width: 100%; max-width: 360px; padding: 8px 12px; margin-top: 8px;
  border: 1px solid var(--border); border-radius: 8px; font-size: 13px;
  box-sizing: border-box;
}
.help-fb .btn { margin-top: 10px; }
.help-fb .save-msg { margin-left: 10px; }

/* ---------- 顺滑细节 ---------- */
.tab, .seg-tab, .chip, .tag { transition: background .15s ease, color .15s ease, border-color .15s ease; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120, 130, 150, .35); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120, 130, 150, .5); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 登录/注册弹窗 ---------- */
.auth-form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.auth-form input {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
}
.auth-form input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.auth-form .btn { align-self: flex-start; }
.auth-logout { padding: 4px 10px; font-size: 12px; margin-left: auto; }
