:root {
  --bg: #080d16;
  --bg-2: #0b1220;
  --panel: #0f1826;
  --panel-2: #131e2e;
  --line: #1d2a3c;
  --line-soft: #16212f;
  --text: #e8eff9;
  --muted: #8595ac;
  --muted-2: #5d6b80;
  --up: #ff5a66;
  --down: #16c784;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, .12);
  --gold: #e0a83c;
  --radius: 10px;
  --font: "Inter", "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(59, 130, 246, .10), transparent 60%),
    radial-gradient(900px 500px at 95% 0%, rgba(224, 168, 60, .05), transparent 55%),
    var(--bg);
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* ---------------- 侧边栏 ---------------- */

.sidebar {
  width: 214px;
  flex: 0 0 214px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 24, 38, .95), rgba(8, 13, 22, .98));
  display: flex;
  flex-direction: column;
  padding: 18px 12px 104px;
  position: sticky;
  top: 0;
  height: 100vh;
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
}

.brand .mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 15px;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  box-shadow: 0 6px 18px rgba(37, 99, 235, .35);
}

.brand-text strong { display: block; font-size: 14px; letter-spacing: .5px; }
.brand-text small { color: var(--muted-2); font-size: 9px; letter-spacing: 1.6px; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  transition: background .15s, color .15s;
  border-left: 2px solid transparent;
}

.nav-item .ic {
  font-style: normal;
  width: 16px;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
}

.nav-item:hover { background: rgba(255,255,255,.03); color: var(--text); }

.nav-item.active {
  background: linear-gradient(90deg, rgba(59,130,246,.16), rgba(59,130,246,.02));
  color: #fff;
  border-left-color: var(--accent);
}

.nav-item.active .ic { color: var(--accent); }

/* 提示信息固定在左侧底部（挂在 body 上，不受侧栏内部包含块影响）：不随滚动漂移 */
.side-foot {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 214px;
  padding: 12px 20px 14px;
  border-top: 1px solid var(--line-soft);
  background: linear-gradient(180deg, rgba(8, 13, 22, .55), rgba(8, 13, 22, .98) 40%);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  z-index: 40;
}

.badge {
  display: inline-block;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .5px;
}
.badge-rule { background: rgba(224,168,60,.12); color: var(--gold); border: 1px solid rgba(224,168,60,.25); }
.badge-llm { background: var(--accent-soft); color: #7fb0ff; border: 1px solid rgba(59,130,246,.3); }
.badge-ai { background: rgba(22,199,132,.10); color: #5de0ad; border: 1px solid rgba(22,199,132,.28); }

.side-note { color: var(--muted-2); font-size: 10px; line-height: 1.7; margin: 10px 0 0; }

/* ---------------- 主区 ---------------- */

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 58px;
  flex: 0 0 58px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 18, 32, .72);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 30;
}

.searchwrap { position: relative; flex: 0 1 420px; display: flex; align-items: center; }

.search-icon { position: absolute; left: 11px; color: var(--muted-2); font-size: 15px; }

#globalSearch {
  width: 100%;
  height: 34px;
  padding: 0 12px 0 32px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 12.5px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

#globalSearch:focus { border-color: rgba(59,130,246,.6); box-shadow: 0 0 0 3px rgba(59,130,246,.10); }
#globalSearch::placeholder { color: var(--muted-2); }

.suggest {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 18px 40px rgba(0,0,0,.55);
  overflow: hidden;
  z-index: 40;
}

.suggest a {
  display: flex;
  justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.suggest a:last-child { border-bottom: 0; }
.suggest a:hover { background: rgba(59,130,246,.10); }
.suggest .code { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }

.suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .15s;
}
.suggest-item:last-child { border-bottom: 0; }
.suggest-item:hover { background: rgba(59,130,246,.10); }
.suggest-item .s-code { color: var(--muted); font-family: var(--mono); font-size: 11.5px; flex: 0 0 62px; }
.suggest-item .s-name { color: var(--text); font-size: 12.5px; flex: 1; }
.suggest-item .s-market { color: var(--muted-2); font-size: 10.5px; }
.suggest-empty { padding: 14px; text-align: center; color: var(--muted-2); font-size: 12px; }

.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.btn {
  height: 30px;
  padding: 0 13px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--panel-2); border-color: #2a3a52; }
.btn.primary { background: linear-gradient(135deg, #2563eb, #3b82f6); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.view { padding: 18px 22px 46px; flex: 1; }

/* ---------------- 通用组件 ---------------- */

.page-head { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 19px; margin: 0; letter-spacing: .3px; font-weight: 600; }
.page-head .sub { color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.page-head .spacer { flex: 1; }

.card {
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  min-width: 0;
}

.card + .card { margin-top: 0; }

.card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: -2px 0 12px;
}

.card-head h2 {
  font-size: 13px;
  font-weight: 600;
  margin: 0;
  letter-spacing: .4px;
}

.card-head .hint { color: var(--muted-2); font-size: 10.5px; }
.card-head .spacer { flex: 1; }

.grid { display: grid; gap: 12px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .g2, .g3, .g4 { grid-template-columns: minmax(0, 1fr); }
}

/* KPI 卡片 */

.kpi {
  padding: 13px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), rgba(8,13,22,.5));
  position: relative;
  overflow: hidden;
}

.kpi::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: .5;
}
.kpi.up::after { background: var(--up); opacity: .8; }
.kpi.down::after { background: var(--down); opacity: .8; }

.kpi .label { color: var(--muted); font-size: 11px; letter-spacing: .4px; }
.kpi .value { font-size: 21px; font-weight: 600; font-family: var(--mono); margin-top: 5px; letter-spacing: -.4px; }
.kpi .meta { font-size: 10.5px; color: var(--muted-2); margin-top: 4px; font-family: var(--mono); }

.up-text { color: var(--up); }
.down-text { color: var(--down); }
.flat-text { color: var(--muted); }

/* 表格 */

.table-wrap { overflow: auto; max-height: 460px; border-radius: 8px; }

table.tb {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.tb thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #101a29;
  color: var(--muted);
  font-weight: 500;
  text-align: left;
  padding: 8px 10px;
  font-size: 10.5px;
  letter-spacing: .5px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.tb tbody td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tb tbody tr:hover { background: rgba(59,130,246,.06); cursor: default; }
.tb tbody tr.clickable { cursor: pointer; }
.tb .name { color: var(--text); }
.tb .code { color: var(--muted-2); font-family: var(--mono); font-size: 10.5px; margin-left: 5px; }
.tb .num { font-family: var(--mono); }
.tb .right { text-align: right; }

/* 标签 */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  border: 1px solid transparent;
  line-height: 1.7;
}
.chip.up { color: var(--up); background: rgba(255,90,102,.10); border-color: rgba(255,90,102,.22); }
.chip.down { color: var(--down); background: rgba(22,199,132,.10); border-color: rgba(22,199,132,.22); }
.chip.flat, .chip.neutral { color: var(--muted); background: rgba(133,149,172,.10); border-color: rgba(133,149,172,.18); }
.chip.accent { color: #7fb0ff; background: var(--accent-soft); border-color: rgba(59,130,246,.28); }
.chip.warn { color: #e0a83c; background: rgba(224,168,60,.10); border-color: rgba(224,168,60,.26); }
.chip.gold { color: var(--gold); background: rgba(224,168,60,.10); border-color: rgba(224,168,60,.26); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }

/* 段落与列表 */

.prose { font-size: 12.5px; line-height: 1.85; color: #cfdcee; }
.prose p { margin: 0 0 8px; }
.prose strong { color: #fff; }

/* ---------------- AI 分析结果：分节卡片 ---------------- */

.ai-report { display: flex; flex-direction: column; gap: 12px; }

.ai-sec {
  border: 1px solid var(--line);
  border-left: 2px solid rgba(59, 130, 246, .45);
  border-radius: 10px;
  padding: 10px 13px 12px;
  background: linear-gradient(180deg, rgba(19, 30, 46, .78), rgba(13, 20, 32, .62));
}

.ai-sec.verdict {
  border-color: rgba(59, 130, 246, .30);
  border-left-color: var(--accent);
  background: linear-gradient(180deg, rgba(59, 130, 246, .13), rgba(13, 20, 32, .7));
}

.ai-sec.risk { border-left-color: rgba(255, 90, 102, .6); }
.ai-sec.watch { border-left-color: rgba(224, 168, 60, .65); }

.ai-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }

.ai-sec-idx {
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 5px;
  color: #8fbaff;
  background: rgba(59, 130, 246, .14);
  border: 1px solid rgba(59, 130, 246, .28);
}

.ai-sec-title { font-size: 13px; font-weight: 600; color: #e8eff9; letter-spacing: .4px; }

.ai-sec.risk .ai-sec-title { color: #ffb3b9; }
.ai-sec.watch .ai-sec-title { color: #edcf92; }

.ai-line { margin: 0 0 7px; font-size: 13px; line-height: 1.9; color: #d6e2f0; }
.ai-sec.verdict .ai-line { font-size: 13.5px; color: #e9f1fb; }
.ai-line:last-child { margin-bottom: 0; }

.ai-item {
  position: relative;
  margin: 0 0 8px;
  padding: 8px 11px 8px 21px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .025);
  font-size: 12.5px;
  line-height: 1.9;
  color: #cbd9ea;
}

.ai-item:last-child { margin-bottom: 0; }

.ai-item::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 14px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .85;
}

.ai-sec.risk .ai-item::before { background: var(--up); }
.ai-sec.watch .ai-item::before { background: var(--gold); }

.ai-item strong { color: #fff; font-weight: 600; }
.ai-colon { color: var(--muted-2); margin: 0 2px; }

.ai-num { font-family: var(--mono); font-weight: 600; }
.ai-num.up { color: var(--up); }
.ai-num.down { color: var(--down); }
.ai-num.flat { color: #9fb4d0; }
.ai-num.thr {
  color: #8fbaff;
  background: rgba(59, 130, 246, .12);
  border-radius: 4px;
  padding: 0 3px;
  font-weight: 500;
}

.ai-foot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(29, 42, 60, .9);
  font-size: 11px;
  color: var(--muted-2);
  line-height: 1.7;
}

.ai-src {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted-2);
  display: flex;
  align-items: center;
  gap: 6px;
}

.bullets { list-style: none; padding: 0; margin: 0; }
.bullets li {
  position: relative;
  padding: 5px 0 5px 15px;
  font-size: 12.5px;
  line-height: 1.75;
  color: #cfdcee;
  border-bottom: 1px dashed rgba(29,42,60,.7);
}
.bullets li:last-child { border-bottom: 0; }
.bullets li::before {
  content: "";
  position: absolute;
  left: 2px; top: 13px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .7;
}
.bullets.risk li::before { background: var(--up); }
.bullets.warn li::before { background: var(--gold); }

.note {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  background: rgba(224,168,60,.06);
  border: 1px solid rgba(224,168,60,.18);
  color: #d9c08a;
  font-size: 11px;
  line-height: 1.7;
}

.empty { padding: 26px 0; text-align: center; color: var(--muted-2); font-size: 12px; }

/* 分段切换 */

.seg { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.seg button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}
.seg button.on { background: var(--accent-soft); color: #9cc3ff; }

/* 图表容器 */

.chart { width: 100%; height: 260px; }
.chart.tall { height: 330px; }
.chart.short { height: 190px; }

/* 热度条 */

.heatbar { display: flex; align-items: center; gap: 8px; }
.heatbar .track { flex: 1; height: 5px; border-radius: 3px; background: rgba(255,255,255,.06); overflow: hidden; }
.heatbar .fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, #1d4ed8, #3b82f6, #60a5fa); }
.heatbar .val { font-family: var(--mono); font-size: 11px; color: #9cc3ff; width: 34px; text-align: right; }

/* 个股页 */

.stock-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.stock-title { display: flex; align-items: baseline; gap: 10px; }
.stock-title h1 { margin: 0; font-size: 22px; letter-spacing: .5px; }
.stock-title .code { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.stock-price { font-family: var(--mono); font-size: 26px; font-weight: 600; letter-spacing: -.5px; }
.stock-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: 11px; }
.stock-meta b { color: var(--text); font-family: var(--mono); font-weight: 500; }

.score-ring { display: flex; align-items: center; gap: 10px; }
.score-ring .num { font-family: var(--mono); font-size: 26px; font-weight: 700; }
.score-ring .lbl { font-size: 11px; color: var(--muted); }

/* 公告流 */

.ann-list { display: flex; flex-direction: column; }
.ann-item {
  display: flex;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
  transition: background .15s;
}
.ann-item:hover { background: rgba(59,130,246,.06); }
.ann-item .date { flex: 0 0 62px; color: var(--muted-2); font-family: var(--mono); font-size: 10.5px; padding-top: 2px; }
.ann-item .body { flex: 1; min-width: 0; }
.ann-item .title { font-size: 12.5px; line-height: 1.6; color: #dbe7f7; }
.ann-item .sub { margin-top: 4px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ann-item .sub .who { color: var(--muted-2); font-size: 10.5px; }

.ann-content {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font);
  font-size: 11.5px;
  line-height: 1.85;
  color: #b9c9dd;
  background: rgba(255,255,255,.02);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin: 0;
  max-height: 340px;
  overflow: auto;
}

/* 抽屉 */

.drawer-mask {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 14, .6);
  backdrop-filter: blur(2px);
  z-index: 60;
  display: flex;
  justify-content: flex-end;
}
.drawer {
  width: min(620px, 92vw);
  height: 100%;
  background: var(--bg-2);
  border-left: 1px solid var(--line);
  padding: 20px 22px;
  overflow: auto;
  animation: slide .22s ease;
}
@keyframes slide { from { transform: translateX(24px); opacity: .7; } to { transform: none; opacity: 1; } }
.drawer h2 { font-size: 15px; margin: 0 0 6px; line-height: 1.6; }
.drawer .drawer-close { position: sticky; top: 0; float: right; }
.drawer-body { margin-top: 14px; }

/* toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: #16233a;
  border: 1px solid #2a3d5c;
  color: #dbe7f7;
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 12px;
  z-index: 90;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
}

.loading { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; padding: 30px 0; justify-content: center; }
.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(59,130,246,.3);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e2c40; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #2a3c56; }

/* ---------------- 弹性布局助手（桌面默认，移动端在下方改写） ---------------- */

.split { display: flex; gap: 12px; align-items: flex-start; }
.split > .card:first-child { flex: 0 0 360px; max-width: 360px; }
.split-main { flex: 1; min-width: 0; }

/* 窄桌面/平板：并排会让详情区只剩 200px 级，改为上下堆叠 */
@media (max-width: 1180px) {
  .split { flex-direction: column; align-items: stretch; }
  .split > .card, .split > .card:first-child, .split-main { width: 100%; max-width: none; flex: 0 0 auto; }
}

.mood-flex { display: flex; gap: 14px; align-items: center; }
.mood-gauge { width: 190px; flex: 0 0 190px; }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar-input { width: 150px; height: 32px; text-align: left; padding: 0 10px; }

/* ---------------- 移动端适配（≤860px 平板/手机；≤430px 小屏手机） ---------------- */

@media (max-width: 860px) {
  body { display: block; }

  /* 侧边栏改为底部导航条，保证 8 个模块在手机上都能进入 */
  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: auto;
    flex: none;
    height: auto;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    border-right: 0;
    border-top: 1px solid var(--line);
    background: rgba(8, 13, 22, .95);
    backdrop-filter: blur(18px);
    z-index: 50;
  }
  .brand, .side-foot { display: none; }

  .nav {
    flex-direction: row;
    gap: 2px;
    margin: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }

  .nav-item {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    justify-content: center;
    gap: 1px;
    min-height: 46px;
    padding: 5px 2px;
    border-left: 0;
    border-radius: 8px;
    font-size: 10px;
    line-height: 1.3;
    text-align: center;
    white-space: nowrap;
  }
  .nav-item .ic { width: auto; font-size: 15px; }
  .nav-item.active {
    border-left-color: transparent;
    background: rgba(59, 130, 246, .18);
    color: #fff;
  }

  /* 顶栏压缩，搜索框占满可用宽度 */
  .topbar {
    height: auto;
    min-height: 54px;
    flex: none;
    gap: 8px;
    padding: 8px 12px;
    flex-wrap: nowrap;
  }
  .searchwrap { flex: 1 1 auto; min-width: 0; }
  #globalSearch { height: 36px; font-size: 13px; }
  .top-actions { gap: 8px; flex: 0 0 auto; }
  #dataTime { display: none; }
  .btn { height: 34px; padding: 0 11px; font-size: 12px; }
  .suggest { top: 42px; max-height: 56vh; overflow: auto; }

  .view { padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); }

  .page-head { gap: 6px 8px; margin-bottom: 12px; }
  .page-head h1 { font-size: 17px; }
  .page-head .sub { font-size: 11px; }
  .page-head .spacer { display: none; }
  .page-head .seg, .page-head .toolbar { width: 100%; }

  .card { padding: 12px; }
  .card-head { gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
  .card-head h2 { font-size: 12.5px; }

  .kpi { padding: 11px 12px; }
  .kpi .value { font-size: 19px; }
  .kpi .meta { font-size: 10px; }

  .chart { height: 220px; }
  .chart.short { height: 170px; }
  .chart.tall { height: 270px; }

  .table-wrap { max-height: none !important; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tb { font-size: 11.5px; }
  .tb thead th, .tb tbody td { padding: 7px 8px; }

  .stock-head { gap: 10px; }
  .stock-title h1 { font-size: 19px; }
  .stock-price { font-size: 22px; }
  .stock-meta { gap: 8px 14px; font-size: 10.5px; }
  .score-ring .num { font-size: 22px; }

  .ann-item { gap: 8px; }
  .ann-item .date { flex: 0 0 50px; font-size: 10px; }
  .ann-item .title { font-size: 12px; }
  .ann-content { max-height: 44vh; font-size: 11px; }

  /* 抽屉改为底部全宽 */
  .drawer-mask { align-items: flex-end; }
  .drawer {
    width: 100%;
    height: 92vh;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 14px 14px 0 0;
    padding: 16px 14px calc(16px + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(84px + env(safe-area-inset-bottom));
    max-width: 88vw;
    text-align: center;
    line-height: 1.6;
  }

  /* 分段切换在窄屏可横向滚动 */
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .seg::-webkit-scrollbar { display: none; }
  .seg button { padding: 8px 14px; }

  /* 两列/横排布局改为纵向 */
  .split { flex-direction: column; align-items: stretch; }
  .split > .card, .split > .card:first-child, .split-main { width: 100%; max-width: none; flex: 0 0 auto; }

  .mood-flex { flex-direction: column; align-items: stretch; gap: 6px; }
  .mood-gauge { width: 100%; flex: 0 0 170px; height: 170px !important; }

  .toolbar { width: 100%; }
  .toolbar-input { width: auto; flex: 1 1 auto; min-width: 0; }

  .tags { gap: 5px; }
  .heatbar .val { width: 30px; }

  .ai-sec { padding: 9px 10px 10px; }
  .ai-item { font-size: 12px; padding: 6px 8px 6px 18px; }
  .ai-item::before { left: 8px; top: 13px; }
  .ai-line { font-size: 12.5px; }
}

@media (max-width: 430px) {
  .view { padding-left: 9px; padding-right: 9px; }
  .nav-item { flex: 1 1 0; font-size: 9.5px; }
  .kpi .value { font-size: 17px; }
  .chart { height: 200px; }
  .chart.short { height: 158px; }
  .page-head h1 { font-size: 16px; }
  .stock-price { font-size: 20px; }
}


/* 选股页：参数条 / 位置进度条 / 命中标签 */

.scr-params {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.pfield { display: flex; flex-direction: column; gap: 4px; }
.pfield label { font-size: 11px; color: var(--muted); letter-spacing: .2px; }
.pfield input {
  width: 96px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 9px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.pfield input:focus { border-color: rgba(59,130,246,.5); }

.posbar { display: flex; align-items: center; gap: 7px; }
.posbar-track {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: rgba(133,149,172,.16);
  overflow: hidden;
  position: relative;
}
.posbar-fill { height: 100%; border-radius: 99px; background: #3b82f6; }
.posbar-fill.up { background: linear-gradient(90deg, #ff8a92, #ff5a66); }
.posbar-fill.down { background: linear-gradient(90deg, #5ee0a8, #16c784); }
.posbar-fill.accent { background: linear-gradient(90deg, #6aa5ff, #3b82f6); }
.posbar-val { font-size: 10.5px; color: var(--muted); width: 38px; text-align: right; }

@media (max-width: 860px) {
  .pfield input { width: 100%; }
  .pfield { flex: 1 1 42%; }
  .scr-params .btn { flex: 1 1 100%; }
}

/* 选股表格紧凑版式：单行 8-9 列在 553px 面板内可读 */
.tb.compact th, .tb.compact td { padding: 6px 5px; font-size: 11.5px; }
.tb.compact td.name { min-width: 88px; }
.tb.compact td.name .code { display: block; font-size: 10px; line-height: 1.5; }
.tb.compact .chip { font-size: 10px; padding: 1px 5px; }

@media (max-width: 860px) {
  .tb.compact th, .tb.compact td { padding: 6px 6px; font-size: 11px; }
}

/* 选股页 KPI 条：纯色块渲染，不依赖渐变与伪元素 */
.scr-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.scr-kpi {
  padding: 12px 14px;
  background: #0f1826;
  border: 1px solid #1d2a3c;
  border-radius: 10px;
}
.scr-kpi .k { color: var(--muted); font-size: 11px; letter-spacing: .4px; }
.scr-kpi .v { font-size: 21px; font-weight: 600; font-family: var(--mono); margin-top: 5px; }
.scr-kpi .m { color: var(--muted-2); font-size: 10.5px; margin-top: 4px; }

@media (max-width: 1180px) {
  .scr-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .scr-kpis { grid-template-columns: minmax(0, 1fr); }
  .scr-kpi .v { font-size: 18px; }
}
/* v1.1.0 · ETF 套利与对冲 / 套利工具箱 */
.subtab-bar { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 14px; }
.subtab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px; font-size: 12px;
  background: #0f1826; border: 1px solid #1d2a3c; color: var(--muted);
  text-decoration: none; cursor: pointer; line-height: 1.4;
}
.subtab:hover { border-color: #2a3a52; color: var(--text); }
.subtab.active { background: rgba(59,130,246,.14); border-color: rgba(59,130,246,.45); color: #9dc0ff; }
.subtab.locked { opacity: .62; }
.subtab .lock { font-size: 9.5px; color: var(--muted-2); border: 1px solid #1d2a3c; border-radius: 4px; padding: 0 4px; }

.tool-layout { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 14px; align-items: start; }
.tool-side { display: flex; flex-direction: column; gap: 12px; }
.tool-group { background: var(--panel); border: 1px solid #1d2a3c; border-radius: 10px; padding: 10px; }
.tool-group-name { color: var(--muted); font-size: 11px; letter-spacing: .5px; margin-bottom: 8px; }
.tool-item {
  display: block; width: 100%; text-align: left; margin-bottom: 6px;
  padding: 7px 9px; border-radius: 7px; font-size: 12px; cursor: pointer;
  background: transparent; border: 1px solid transparent; color: var(--text);
}
.tool-item:last-child { margin-bottom: 0; }
.tool-item:hover { background: #131e2e; border-color: #1d2a3c; }
.tool-item.active { background: rgba(59,130,246,.14); border-color: rgba(59,130,246,.45); color: #9dc0ff; }

.tool-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.tf { display: flex; flex-direction: column; gap: 4px; }
.tf span { font-size: 11px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.tf em { font-style: normal; font-size: 9.5px; color: var(--muted-2); }
.tf input, .tf select {
  width: 100%; box-sizing: border-box; padding: 7px 9px; border-radius: 7px;
  background: #080d16; border: 1px solid #1d2a3c; color: var(--text);
  font-family: var(--mono); font-size: 12px;
}
.tf input:focus, .tf select:focus { outline: none; border-color: rgba(59,130,246,.55); }
.tool-actions { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; align-items: center; }
/* v1.1.5b：工具表单面板化 + 提示条，替掉原生控件观感 */
.tf-panel {
  margin-top: 12px; padding: 12px; border-radius: 10px;
  background: linear-gradient(180deg, #0d1726, #0a111c);
  border: 1px solid #1d2a3c;
}
.tf-panel .tf input, .tf-panel .tf select { background: #0b1421; }
.tool-hint {
  margin-top: 10px; padding: 10px 12px; border-radius: 8px;
  background: #0b1420; border: 1px dashed #22324a;
  color: var(--muted); font-size: 12px; line-height: 1.7;
}
.tool-result { border-top: 1px dashed #1d2a3c; padding-top: 12px; }
.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.res-cell { background: #0f1826; border: 1px solid #1d2a3c; border-radius: 8px; padding: 9px 11px; }
.res-cell .k { color: var(--muted); font-size: 10.5px; }
.res-cell .v { font-size: 15px; font-weight: 600; margin-top: 3px; word-break: break-all; }
.verdict { margin-top: 12px; padding: 9px 12px; border-radius: 8px; font-size: 12px; border-left: 3px solid #2a3a52; background: #0f1826; }
.verdict.up { border-left-color: var(--up); color: #ff9aa3; }
.verdict.down { border-left-color: var(--down); color: #6ee7b7; }
.res-sub { color: var(--muted); font-size: 11px; letter-spacing: .4px; margin: 14px 0 6px; }
.prose-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 11.5px; line-height: 1.7; }

@media (max-width: 1000px) {
  .tool-layout { grid-template-columns: minmax(0, 1fr); }
  .tool-side { flex-direction: row; flex-wrap: wrap; }
  .tool-group { flex: 1 1 46%; }
}
@media (max-width: 640px) {
  .tool-form { grid-template-columns: minmax(0, 1fr); }
  .tool-group { flex: 1 1 100%; }
  .res-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subtab { font-size: 11px; padding: 5px 9px; }
}
/* v1.1.0 表格修正：表头不吸顶、随页滚动，避免滚动后表头消失 */
.table-wrap.tall { max-height: none; }
.tb.no-stick thead th { position: static; }
/* v1.1.0 移动端折溢价卡片列表（≤640px 替代表格） */
.etf-cards { display: none; }
@media (max-width: 640px) {
  .etf-cards { display: flex; flex-direction: column; gap: 8px; margin: 2px 0 4px; }
  .table-wrap.etf-hide-sm { display: none; }
  .ec { background: rgba(255,255,255,.02); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; cursor: pointer; }
  .ec-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .ec-name { font-size: 13px; color: var(--text); }
  .ec-prem { font-size: 15px; }
  .ec-mid { display: flex; gap: 10px; font-size: 11.5px; color: var(--muted); margin-top: 4px; }
  .ec-nav i { font-style: normal; color: var(--muted-2); margin-left: 3px; font-size: 10.5px; }
  .ec-low { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 7px; font-size: 10.5px; color: var(--muted-2); }
}

/* 期现套利卡片（≤640px 时替代表格） */
.ec-main { font-size: 21px; font-weight: 700; margin-top: 3px; letter-spacing: .2px; }
.ec-unit { font-size: 11px; color: var(--muted-2); margin-left: 6px; font-weight: 400; }
.ec-rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }

/* v1.1.2 结果卡片与行高亮（对冲走势 / 风险分析 / 期现复算） */
.res-item {
  background: #0f1826;
  border: 1px solid #1d2a3c;
  border-radius: 8px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.res-item span { color: var(--muted); font-size: 10.5px; }
.res-item strong { font-size: 14px; font-weight: 600; word-break: break-all; }
.tb tbody tr.active-row td { background: rgba(59, 130, 246, .10); }
.tb tbody tr.warn-row td { background: rgba(255, 90, 102, .10); }
@media (max-width: 640px) {
  .res-item strong { font-size: 13px; }
}
/* v1.1.4 事件性套利 + 策略回测 */
.ev-impact { font-size: 11.5px; color: var(--muted); line-height: 1.55; max-width: 560px; }
.ev-limits { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.ev-limit { line-height: 1.55; }
.bt-sens-cards { display: none; }
@media (max-width: 640px) {
  .ev-impact { max-width: none; font-size: 11px; }
  .bt-sens-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
}