/* ==========================================================================
   Wise Quant · 移动端 App 样式
   —— 与网页版（style.css）**完全独立**：互不污染，可单独改版式。
   A 股配色铁律：涨 = 红，跌 = 绿（与欧美相反）

   版式：`.app` 是 flex 列 —— 顶栏 / 滚动主区 / 底部标签栏。
   刻意**不用 position:fixed**：桌面预览时 .app 是一个居中的手机框，
   内部若用 fixed 会相对视口定位，框架就散了。改用 flex + 主区自滚动，
   一套代码在「真机全屏」与「桌面手机框」两种形态下都对。
   ========================================================================== */

:root {
  --up: #e5384a;
  --up-soft: rgba(229, 56, 74, .10);
  --down: #12a552;
  --down-soft: rgba(18, 165, 82, .10);
  --flat: #8b95a5;

  --brand: #2b5cd9;
  --brand-2: #4f8bff;
  --brand-soft: rgba(43, 92, 217, .09);

  --bg: #f1f4f9;
  --panel: #ffffff;
  --panel-2: #f7f9fc;
  --border: #e5eaf2;
  --text: #131a26;
  --text-2: #576175;
  --text-3: #8d97a8;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 6px 20px rgba(16, 24, 40, .07);
  --shadow-lg: 0 18px 50px rgba(16, 24, 40, .16);

  --r: 16px;
  --r-sm: 11px;
  --tabbar-h: 58px;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] {
  --up: #ff4d63;
  --up-soft: rgba(255, 77, 99, .14);
  --down: #17c46a;
  --down-soft: rgba(23, 196, 106, .14);

  --brand: #5b8cff;
  --brand-2: #7ba7ff;
  --brand-soft: rgba(91, 140, 255, .15);

  --bg: #0c1119;
  --panel: #151b25;
  --panel-2: #1b222e;
  --border: #242c3a;
  --text: #e9edf5;
  --text-2: #a5b0c2;
  --text-3: #6d788c;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 6px 20px rgba(0, 0, 0, .45);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { margin: 0; padding: 0; height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
button { font: inherit; color: inherit; }

/* ========================== 应用外壳 ========================== */

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}

/* 顶部氛围层：品牌渐变 + 两团柔光，往下晕开。滚动时它不动，内容浮上来。 */
.app::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 330px;
  background:
    radial-gradient(120% 85% at 14% -22%, rgba(255, 255, 255, .20), transparent 58%),
    radial-gradient(85% 75% at 100% -4%, rgba(122, 176, 255, .42), transparent 55%),
    linear-gradient(170deg, var(--brand) 0%, var(--brand-2) 36%,
                    rgba(79, 139, 255, .34) 62%, rgba(79, 139, 255, 0) 86%);
  pointer-events: none;
  z-index: 0;
}

/* 深色主题要另配一套更沉的蓝：直接沿用浅色那套（--brand 在深色下是 #5b8cff）
   会在夜里糊一大片亮蓝，又刺眼又和深色卡片割裂。 */
html[data-theme="dark"] .app::before {
  background:
    radial-gradient(120% 85% at 14% -22%, rgba(255, 255, 255, .06), transparent 58%),
    radial-gradient(85% 75% at 100% -4%, rgba(91, 140, 255, .24), transparent 55%),
    linear-gradient(170deg, #16255c 0%, #1d3378 36%,
                    rgba(29, 51, 120, .32) 62%, rgba(29, 51, 120, 0) 86%);
}

/* ---------- 顶栏（浮在氛围层之上，透明） ---------- */
.appbar {
  position: relative;
  z-index: 3;
  flex: 0 0 auto;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
}
.appbar .mark {
  width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 9px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .34);
  display: grid; place-content: center;
  font-size: 8.6px; font-weight: 700; line-height: 1.12;
  letter-spacing: .3px; text-align: center;
  backdrop-filter: blur(6px);
}
.appbar-titles { display: flex; flex-direction: column; line-height: 1.16; min-width: 0; }
.appbar-titles b { font-size: 16.5px; font-weight: 650; letter-spacing: .2px; }
.appbar-titles span {
  font-size: 11.5px; opacity: .82;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.appbar .grow { flex: 1; }
.appbar-btn {
  width: 34px; height: 34px; flex: 0 0 34px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 11px;
  background: rgba(255, 255, 255, .16);
  display: grid; place-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform .14s, background .14s;
}
.appbar-btn:active { transform: scale(.92); background: rgba(255, 255, 255, .3); }
.appbar-btn svg { width: 17px; height: 17px; fill: currentColor; }
.appbar-btn[hidden] { display: none; }

/* ---------- 主滚动区 ---------- */
.view {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  /* 底部留白要让开两样东西：标签栏本身，以及**向上浮起 26px 的中间 AI 按钮**。
     只算标签栏高度的话，页面最下面那行字会被凸起的圆钮压住。 */
  padding: 2px 14px calc(var(--tabbar-h) + var(--safe-bottom) + 40px);
}

/* ---------- 底部标签栏 ---------- */
.tabbar {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 2px;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 6px var(--safe-bottom);
  background: rgba(255, 255, 255, .86);
  border-top: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px);
}
html[data-theme="dark"] .tabbar { background: rgba(18, 24, 34, .88); }

.tab {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  height: var(--tabbar-h);
  color: var(--text-3);
  font-size: 10.5px;
  cursor: pointer;
  transition: color .16s;
  position: relative;
}
.tab svg { width: 22px; height: 22px; fill: currentColor; transition: transform .2s; }
.tab.active { color: var(--brand); font-weight: 600; }
.tab.active svg { transform: translateY(-1px) scale(1.06); }
.tab.active::after {
  content: '';
  position: absolute; top: 4px;
  width: 18px; height: 3px; border-radius: 2px;
  background: var(--brand);
}

/* 中间 AI 凸起按钮：整个 App 的视觉记忆点 */
.tab-ai { flex: 1; }
.tab-ai .ai-orb {
  width: 54px; height: 54px;
  margin-top: -26px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 22px rgba(43, 92, 217, .42), 0 0 0 5px var(--bg);
  display: grid; place-content: center;
  color: #fff;
  transition: transform .18s;
}
html[data-theme="dark"] .tab-ai .ai-orb { box-shadow: 0 8px 22px rgba(43, 92, 217, .5), 0 0 0 5px var(--bg); }
.tab-ai .ai-orb svg { width: 26px; height: 26px; }
.tab-ai:active .ai-orb { transform: scale(.93); }
.tab-ai span { margin-top: 2px; }
.tab-ai.active::after { display: none; }

/* ========================== 通用块 ========================== */

.hero {
  color: #fff;
  padding: 4px 2px 16px;
}
.hero h1 { margin: 0; font-size: 23px; font-weight: 650; letter-spacing: .2px; }
.hero p { margin: 5px 0 0; font-size: 12.5px; opacity: .86; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card + .card, .card + .sec, .sec + .card, .sec + .sec { margin-top: 12px; }

.card-head {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 14px 9px;
}
.card-head h3 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: .1px; }
.card-head .sub { font-size: 11.5px; color: var(--text-3); }
.card-head .grow { flex: 1; }
.card-body { padding: 0 14px 14px; }
.card-body.flush { padding: 0; }

.sec { color: var(--text); }
.sec-title {
  display: flex; align-items: baseline; gap: 8px;
  margin: 18px 2px 9px;
}
.sec-title h2 { margin: 0; font-size: 15px; font-weight: 650; }
/* 用 --text-2 而不是 --text-3：头部那几条 sec-title 是**压在品牌渐变上**的
   （渐变层绝对定位在 .app 上、不随内容滚动），最浅的灰在蓝底上几乎看不见。 */
.sec-title .sub { font-size: 11.5px; color: var(--text-2); opacity: .9; }
.sec-title .grow { flex: 1; }

/* 卡片逐个浮入 */
.stagger > * { animation: rise .42s cubic-bezier(.22, .8, .3, 1) backwards; }
.stagger > *:nth-child(1) { animation-delay: .02s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .12s; }
.stagger > *:nth-child(4) { animation-delay: .17s; }
.stagger > *:nth-child(5) { animation-delay: .22s; }
.stagger > *:nth-child(6) { animation-delay: .27s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .stagger > * { animation: none; } }

/* ========================== 指数横滑 ========================== */

.idx-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.idx-scroll::-webkit-scrollbar { display: none; }

.idx-card {
  flex: 0 0 152px;
  scroll-snap-align: start;
  background: rgba(255, 255, 255, .96);
  border-radius: 15px;
  padding: 12px 13px 13px;
  box-shadow: 0 8px 24px rgba(9, 22, 60, .13);
  position: relative;
  overflow: hidden;
}
html[data-theme="dark"] .idx-card { background: rgba(24, 31, 43, .95); }
.idx-card::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--flat);
}
.idx-card.up::before { background: var(--up); }
.idx-card.down::before { background: var(--down); }
.idx-card .n { font-size: 12px; color: var(--text-3); font-weight: 500; }
.idx-card .v { font-size: 21px; font-weight: 700; letter-spacing: .3px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.idx-card .d { font-size: 12.5px; font-weight: 650; margin-top: 1px; font-variant-numeric: tabular-nums; }
.idx-card .m { font-size: 10.5px; color: var(--text-3); margin-top: 4px; }
.up-c { color: var(--up); }
.down-c { color: var(--down); }
.flat-c { color: var(--flat); }

/* ========================== 涨跌结构 ========================== */

.dist { display: flex; height: 30px; border-radius: 9px; overflow: hidden; gap: 2px; }
.dist-seg {
  display: grid; place-content: center;
  font-size: 11px; font-weight: 600; color: #fff;
  min-width: 4px;
  transition: flex .5s cubic-bezier(.3, .9, .3, 1);
}
.dist-legend {
  display: flex; flex-wrap: wrap; gap: 6px 14px;
  margin-top: 10px; font-size: 12px; color: var(--text-2);
}
.dist-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dist-legend i { width: 8px; height: 8px; border-radius: 3px; }
.dist-meta { margin-top: 10px; font-size: 12px; color: var(--text-2); }
.dist-meta b { color: var(--text); }

/* ========================== 列表行 ========================== */

.row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background .13s;
}
.card-body.flush .row:first-child, .list .row:first-child { border-top: 0; }
.row:active { background: var(--panel-2); }
/* 点不进详情的行（板块等）：不给手型、不给按下反馈 —— 别让用户以为能点 */
.row.no-nav { cursor: default; }
.row.no-nav:active { background: transparent; }
.row .rk {
  flex: 0 0 22px; height: 22px; border-radius: 7px;
  background: var(--panel-2); color: var(--text-3);
  display: grid; place-content: center;
  font-size: 11px; font-weight: 700;
}
.row .rk.top { background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: #fff; }
.row .nm { flex: 1; min-width: 0; }
.row .nm b { display: block; font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .nm span { font-size: 11.5px; color: var(--text-3); }
.row .rt { text-align: right; flex: 0 0 auto; }
.row .rt b { display: block; font-size: 14.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.row .rt span { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.list { border-radius: var(--r); overflow: hidden; }

.pill {
  display: inline-block;
  padding: 1px 7px; border-radius: 999px;
  font-size: 11.5px; font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.pill.up { background: var(--up-soft); color: var(--up); }
.pill.down { background: var(--down-soft); color: var(--down); }
.pill.flat { background: rgba(139, 149, 165, .14); color: var(--flat); }

/* ========================== 仪表 / 指标 ========================== */

.gauges { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.gauge {
  background: var(--panel-2);
  border-radius: var(--r-sm);
  padding: 10px 8px 8px;
  text-align: center;
}
.gauge svg { width: 100%; height: auto; display: block; }
.gauge .g-n { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.gauge .g-v { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

.kv { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border); border-radius: var(--r-sm); overflow: hidden; }
.kv-i { background: var(--panel); padding: 10px 12px; }
.kv-i span { display: block; font-size: 11.5px; color: var(--text-3); }
.kv-i b { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }

.meter { margin: 10px 0 0; }
.meter-top { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 5px; }
.meter-top b { color: var(--text); font-variant-numeric: tabular-nums; }
.meter-bar { height: 6px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.meter-bar i { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .6s cubic-bezier(.3, .9, .3, 1); }

.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tag {
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  transition: all .14s;
}
.tag:active { transform: scale(.95); }
.tag.on { background: var(--brand-soft); border-color: transparent; color: var(--brand); font-weight: 600; }

/* ========================== 表单 ========================== */

/* 表单控件列全了再写：只列 `input[type="text"]` 时，回测面板的
   `number` / `date` 会退化成浏览器默认宽度（约 170–200px），
   把 `.grid2` 的 1fr 轨道顶开 → **整行溢出卡片 46px**（冒烟测出来的）。 */
textarea, input[type="text"], input[type="number"], input[type="date"],
input[type="tel"], input[type="search"], select {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
}
textarea:focus, input[type="text"]:focus, input[type="number"]:focus,
input[type="date"]:focus, input[type="tel"]:focus, input[type="search"]:focus, select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input[type="number"] { text-align: right; font-variant-numeric: tabular-nums; }
textarea { resize: vertical; line-height: 1.6; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* iOS Safari 有个坑：聚焦到字号 < 16px 的输入框会自动放大整个页面，
   而且放大了不会自动缩回去。触屏设备上把表单字号顶到 16px 即可绕过；
   桌面（精度指针）保持 14px 的精致观感。 */
@media (pointer: coarse) {
  textarea, input[type="text"], input[type="number"], input[type="date"],
  input[type="tel"], input[type="search"], select { font-size: 16px; }
  textarea { font-size: 15px; }
}
label.lb { display: block; font-size: 12.5px; color: var(--text-2); margin: 12px 0 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--panel);
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  transition: transform .14s, opacity .14s;
}
.btn:active { transform: scale(.97); }
.btn.primary {
  background: linear-gradient(140deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px rgba(43, 92, 217, .3);
}
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.search-bar {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 13px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.search-bar svg { width: 17px; height: 17px; fill: var(--text-3); flex: 0 0 17px; }
.search-bar input {
  border: 0; background: transparent; padding: 0;
  font-size: 14.5px;
}
.search-bar input:focus { box-shadow: none; }

/* ========================== 代码块 ========================== */

pre.code {
  margin: 0;
  padding: 13px;
  border-radius: var(--r-sm);
  background: #0f1520;
  color: #d8e3f5;
  font-family: ui-monospace, Menlo, Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
  line-height: 1.65;
  overflow: auto;
  max-height: 46vh;
  white-space: pre;
  -webkit-overflow-scrolling: touch;
}
html[data-theme="dark"] pre.code { background: #0a0f17; }

/* ============ 可折叠块（机构观点 / 国产科技） ============
   用原生 <details>，省掉一堆 JS。默认的三角 marker 在各浏览器里很丑，
   统一换成右侧的「＋/－」，展开时旋转。 */

details summary { list-style: none; display: flex; align-items: center; gap: 8px; }
details summary::-webkit-details-marker { display: none; }
details summary::after {
  content: '＋';
  margin-left: auto;
  flex: 0 0 auto;
  color: var(--text-3);
  font-size: 15px;
  line-height: 1;
  transition: transform .18s;
}
details[open] summary::after { content: '－'; color: var(--brand); }
details summary:active { opacity: .7; }

/* ========================== 空态 / 加载 / 提示 ========================== */

.empty { padding: 26px 16px; text-align: center; color: var(--text-3); font-size: 13px; }
.empty b { display: block; color: var(--text-2); font-size: 14px; margin-bottom: 4px; }

.skel { padding: 14px; }
.skel i {
  display: block; height: 12px; border-radius: 6px; margin-bottom: 9px;
  background: linear-gradient(90deg, var(--panel-2) 25%, var(--border) 37%, var(--panel-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
}
.skel i:nth-child(2) { width: 82%; }
.skel i:nth-child(3) { width: 64%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

.err {
  margin: 10px 0;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--up-soft);
  color: var(--up);
  font-size: 13px;
  border: 1px solid rgba(229, 56, 74, .22);
}

.note {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.7;
}

/* 顶部的「下拉刷新」指示 */
.ptr {
  height: 0;
  overflow: hidden;
  display: grid; place-content: center;
  color: var(--text-3); font-size: 12px;
  transition: height .2s;
}
.ptr.on { height: 42px; }
.ptr svg { width: 18px; height: 18px; fill: currentColor; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-wrap {
  position: absolute;
  left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 18px);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; z-index: 50;
}
.toast {
  max-width: 82%;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(20, 26, 36, .93);
  color: #fff;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toastIn .26s cubic-bezier(.22, .8, .3, 1);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(10px) scale(.96); } }
.toast.warn { background: rgba(196, 120, 0, .95); }

/* ========================== 启动闪屏 ========================== */

.splash {
  position: absolute;
  inset: 0;
  z-index: 99;
  display: grid; place-content: center; justify-items: center; gap: 16px;
  background: linear-gradient(160deg, var(--brand), var(--brand-2));
  color: #fff;
  transition: opacity .4s, visibility .4s;
}
.splash.gone { opacity: 0; visibility: hidden; }
.splash .mark {
  width: 84px; height: 84px; border-radius: 23px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .34);
  display: grid; place-content: center;
  font-size: 19px; font-weight: 700; line-height: 1.1;
  letter-spacing: .4px;
  box-shadow: 0 14px 40px rgba(9, 22, 60, .3);
  backdrop-filter: blur(8px);
}
.splash .nm { font-size: 21px; font-weight: 650; letter-spacing: .6px; }
.splash .sb { font-size: 12.5px; opacity: .84; margin-top: -8px; }
.splash .beian { margin-top: 6px; font-size: 11px; opacity: .72; }
.splash .beian a { color: #fff; text-decoration: none; }

/* ========================== 个股详情 ========================== */

.quote-hero {
  background: rgba(255, 255, 255, .97);
  border-radius: var(--r);
  padding: 14px 15px 15px;
  box-shadow: 0 10px 30px rgba(9, 22, 60, .14);
}
html[data-theme="dark"] .quote-hero { background: rgba(24, 31, 43, .96); }
.quote-hero .qh-top { display: flex; align-items: baseline; gap: 8px; }
.quote-hero .qh-top b { font-size: 18px; font-weight: 650; }
.quote-hero .qh-top span { font-size: 12px; color: var(--text-3); }
.quote-hero .qh-p { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.quote-hero .qh-p b { font-size: 32px; font-weight: 700; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.quote-hero .qh-p span { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.quote-hero .qh-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 9px 6px; margin-top: 14px;
  padding-top: 13px; border-top: 1px solid var(--border);
}
.quote-hero .qh-grid div { font-size: 11.5px; color: var(--text-3); }
.quote-hero .qh-grid b { display: block; font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; margin-top: 1px; }

.kchart { width: 100%; height: auto; display: block; }

/* ========================== 通用小件 ========================== */

/* 页头「瘦身版」：内容型的页面（个股分析 / 每日观察）顶栏下面紧跟卡片，
   不需要普通 .hero 那么厚的留白。 */
.hero-slim { padding-bottom: 10px; }
.hero-slim h1 { font-size: 20px; }
.hero-slim p { font-size: 12px; margin-top: 3px; }

.btn.sm { padding: 7px 13px; font-size: 12.5px; border-radius: 9px; }
.btn.ghost { background: transparent; color: var(--text-2); }
.btn.ghost:not([disabled]):active { background: var(--panel-2); }

/* 网格子项给 min-width:0：表控件的固有宽度否则会把 1fr 轨道顶开（见上方表单注释） */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid2 > * { min-width: 0; }
.sel { font-size: 13.5px; }
.brand-c { color: var(--brand); }

/* 进度条：AI 工坊的历史回测轮询时用 */
.bar { height: 5px; border-radius: 4px; background: var(--panel-2); overflow: hidden; margin-top: 9px; }
.bar i {
  display: block; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  transition: width .4s cubic-bezier(.3, .9, .3, 1);
}

/* ========================== 总览 · 恐贪指数（数字） ==========================
   总览里刻意不画曲线 —— 四张迷你折线挤在一起，手机上根本看不出差异。
   改成「大数字 + 一条带 30/70 刻度的轨道」，一眼定位在恐惧区还是贪婪区。
   曲线版放在「每日观察」页（那里有纵向空间）。 */

.fg-chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.fg-chip { background: var(--panel-2); border-radius: var(--r-sm); padding: 10px 11px 12px; }
.fg-chip-top { display: flex; align-items: center; gap: 6px; }
.fg-chip-top .n {
  font-size: 12px; color: var(--text-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fg-chip-top .l { margin-left: auto; flex: 0 0 auto; font-size: 10.5px; color: var(--text-3); }
.fg-chip > .v {
  display: block; margin-top: 2px;
  font-size: 25px; font-weight: 700; line-height: 1.15;
  font-variant-numeric: tabular-nums;
}
.fg-chip .track {
  position: relative; height: 5px; border-radius: 4px;
  margin-top: 9px; background: var(--border); overflow: hidden;
}
.fg-chip .track i {
  display: block; height: 100%; border-radius: 4px;
  transition: width .6s cubic-bezier(.3, .9, .3, 1);
}
/* 30 / 70 阈值刻度：压在轨道上，给裸数字一个参照 */
.fg-chip .track .mk {
  position: absolute; top: 0; bottom: 0; width: 1px; z-index: 1;
  background: var(--text-3); opacity: .55;
}

/* ========================== 每日观察 · 恐贪曲线 ========================== */

.fg-list { display: flex; flex-direction: column; }
.fg-row { padding-top: 13px; border-top: 1px solid var(--border); }
.fg-row:first-child { padding-top: 0; border-top: 0; }
.fg-row + .fg-row { margin-top: 13px; }
.fg-top { display: flex; align-items: baseline; gap: 8px; }
.fg-top b { font-size: 13.5px; font-weight: 600; }
.fg-top .grow { flex: 1; }
.fg-lv { font-size: 11.5px; color: var(--text-3); }
.fg-v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fg-svg { display: block; width: 100%; height: auto; margin-top: 7px; }
.fg-span {
  display: flex; justify-content: space-between; gap: 8px;
  margin-top: 4px; font-size: 10.5px; color: var(--text-3);
}
.fg-no { padding: 16px; text-align: center; font-size: 12.5px; color: var(--text-3); }

/* ========================== 完整观察记录：全屏文档查看器 ==========================
   报告本身是**自包含的响应式 HTML**（无 JS、图表全是内联 SVG），
   直接塞进 iframe 就是网页版的完整表达，不需要二次渲染。 */

.docrow { display: flex; align-items: center; gap: 12px; }
.docrow-t { flex: 1; min-width: 0; }
.docrow-t b { display: block; font-size: 14.5px; font-weight: 600; }
.docrow-t span { font-size: 11.5px; color: var(--text-3); }

.docview {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column;
  background: var(--bg);
  transform: translateY(100%);
  visibility: hidden;
  transition: transform .3s cubic-bezier(.2, .8, .3, 1), visibility .3s;
}
.docview.show { transform: none; visibility: visible; }
.docview-bar {
  display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
  padding: calc(var(--safe-top) + 12px) 14px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.docview-bar b {
  font-size: 14.5px; font-weight: 650;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.docview-bar .grow { flex: 1; }
.docview-bar .sub { flex: 0 0 auto; font-size: 11px; color: var(--text-3); }
.dv-close {
  display: grid; place-content: center; flex: 0 0 auto;
  width: 30px; height: 30px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--panel-2);
  font-size: 13px; line-height: 1; cursor: pointer;
}
.docview-frame { flex: 1; width: 100%; border: 0; background: #0f1520; }
body.no-scroll { overflow: hidden; }

/* ========================== 个股分析 · 趋势统计卡 ========================== */

.verdict {
  border-radius: var(--r-sm);
  padding: 12px 13px;
  background: var(--panel-2);
  border-left: 3px solid var(--flat);
}
.verdict.up { background: var(--up-soft); border-left-color: var(--up); }
.verdict.down { background: var(--down-soft); border-left-color: var(--down); }
.verdict .vd-top { display: flex; align-items: baseline; gap: 8px; }
.verdict .vd-top b { font-size: 19px; font-weight: 700; letter-spacing: .3px; }
.verdict.up .vd-top b { color: var(--up); }
.verdict.down .vd-top b { color: var(--down); }
.verdict .vd-s {
  margin-left: auto; font-size: 20px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.verdict.down .vd-s { color: var(--down); }
.verdict.up .vd-s { color: var(--up); }
.verdict .vd-s i { margin-left: 1px; font-size: 11px; font-weight: 500; font-style: normal; color: var(--text-3); }
.verdict .vd-bar {
  height: 6px; border-radius: 4px; margin-top: 9px;
  background: rgba(0, 0, 0, .07); overflow: hidden;
}
html[data-theme="dark"] .verdict .vd-bar { background: rgba(255, 255, 255, .09); }
.verdict .vd-bar i { display: block; height: 100%; border-radius: 4px; background: var(--flat); transition: width .6s cubic-bezier(.3, .9, .3, 1); }
.verdict.up .vd-bar i { background: var(--up); }
.verdict.down .vd-bar i { background: var(--down); }
.verdict .vd-h { margin-top: 7px; font-size: 11.5px; color: var(--text-2); }

.an-sum { margin-top: 11px; }
.an-sec { margin-top: 16px; }
.an-title { margin-bottom: 8px; font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.an-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px;
  background: var(--border); border-radius: var(--r-sm); overflow: hidden;
}
.an-i { background: var(--panel); padding: 9px 11px; }
.an-i .k { display: block; font-size: 11.5px; color: var(--text-3); }
.an-i .v { display: block; margin-top: 1px; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.an-i .hint { display: block; margin-top: 2px; font-size: 10.5px; line-height: 1.4; color: var(--text-3); }
.an-ul { margin: 0; padding-left: 19px; font-size: 12.5px; color: var(--text-2); }
.an-ul li { margin: 5px 0; }
/* 风险提示给一个浅底盒子，靠版式区分，而不是靠颜色 —— 
   红色在这套配色里表示「涨」，拿来当警告会误导。 */
.an-ul.warn {
  padding: 10px 12px 10px 28px;
  background: var(--panel-2);
  border-radius: var(--r-sm);
}
.an-disc { margin-top: 12px; }

.sig-list { display: flex; flex-direction: column; }
.sig { padding: 9px 0; border-top: 1px solid var(--border); }
.sig:first-child { padding-top: 0; border-top: 0; }
.sig-h { display: flex; align-items: baseline; gap: 8px; font-size: 13px; }
.sig-h span { color: var(--text-2); }
.sig-h b { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.sig .note { margin-top: 2px; }

/* ========================== AI 工坊 · 历史回测 ========================== */

.bt-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border); border-radius: var(--r-sm); overflow: hidden;
}
.bt-i { background: var(--panel); padding: 10px 7px; text-align: center; }
.bt-i .k { display: block; font-size: 10.5px; color: var(--text-3); }
.bt-i .v { display: block; margin-top: 2px; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }

.bt-stage { font-size: 12.5px; color: var(--text-2); }
.bt-log {
  margin: 9px 0 0; padding: 10px;
  border-radius: var(--r-sm);
  background: #0f1520; color: #c7d5ea;
  font-family: ui-monospace, Menlo, Consolas, "Cascadia Mono", monospace;
  font-size: 11px; line-height: 1.55;
  max-height: 150px; overflow: auto;
  white-space: pre-wrap;
}
html[data-theme="dark"] .bt-log { background: #0a0f17; }

.bt-trades { display: flex; flex-direction: column; }
.bt-tr {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 0; border-top: 1px solid var(--border);
  font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.bt-tr:first-child { padding-top: 0; border-top: 0; }
.bt-tr b { flex: 0 0 auto; font-weight: 650; }
.bt-tr .c { flex: 0 0 auto; color: var(--text-2); }
.bt-tr .p { flex: 1; min-width: 0; text-align: right; color: var(--text-2); }
.bt-tr .t { flex: 0 0 auto; font-size: 11px; color: var(--text-3); }
.bt-tr b:last-child { flex: 0 0 52px; min-width: 52px; text-align: right; }

/* ========================== 桌面预览：手机框 ==========================
   在电脑上打开 /app 时，不要拉成一片宽屏 —— 摆一个居中的手机框，
   所见即真机所见。宽屏访客（含你自己调试时）看到的就是 App 的样子。 */

@media (min-width: 768px) and (min-height: 620px) {
  body {
    background:
      radial-gradient(110% 80% at 50% 0%, #eef3fc, #dde5f2 55%, #cfd9ea);
    display: grid;
    place-items: center;
    padding: 24px;
  }
  html[data-theme="dark"] body {
    background: radial-gradient(110% 80% at 50% 0%, #131a26, #0a0e15 60%);
  }
  .app {
    width: 392px;
    height: min(844px, calc(100vh - 48px));
    border-radius: 30px;
    box-shadow: 0 30px 80px rgba(12, 22, 48, .3), 0 0 0 9px #1a1f2b, 0 0 0 10px #2c3342;
    border: 0;
  }
  /* 桌面浏览器没有 safe-area，但手机框的「状态条」需要一点留白 */
  .appbar { padding-top: 16px; }
  .toast-wrap { bottom: calc(var(--tabbar-h) + 18px); }

  /* 文档查看器也只在手机框里展开，保住「预览即真机」的观感 ——
     若让它铺满整个浏览器窗口，桌面预览就露馅了。 */
  .docview {
    left: 50%; right: auto; top: 50%; bottom: auto;
    width: 392px;
    height: min(844px, calc(100vh - 48px));
    border-radius: 30px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(12, 22, 48, .3);
    transform: translate(-50%, calc(-50% + 100%));
  }
  .docview.show { transform: translate(-50%, -50%); }
  .docview-bar { padding-top: 12px; }
}
