/* ==========================================================================
   天天养基 · 网页版 设计系统
   主色 #2E6BFF / A股红涨绿跌 / 卡片圆角14 / 数字等宽
   ========================================================================== */

:root {
  /* 品牌 */
  --primary: #2E6BFF;
  --primary-dark: #2154E8;
  --primary-light: #5B93FF;
  --primary-soft: #EAF1FF;
  --grad: linear-gradient(135deg, #5B93FF 0%, #2154E8 100%);

  /* A股配色：涨红跌绿 */
  --up: #F5222D;
  --up-soft: #FFF1F0;
  --down: #00A870;
  --down-soft: #E8F8F2;
  --flat: #8A93A6;

  /* 中性 */
  --bg: #F4F6FA;
  --card: #FFFFFF;
  --text: #1B1F2A;
  --text-2: #5A6376;
  --muted: #8A93A6;
  --line: #EDF0F5;
  --line-2: #E2E6EF;

  /* 圆角 / 阴影 */
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 18px;
  --shadow: 0 2px 10px rgba(27, 31, 42, .05);
  --shadow-lg: 0 8px 28px rgba(27, 31, 42, .12);

  /* 尺寸 */
  --header-h: 132px;
  --tabbar-h: 58px;
  --sidebar-w: 232px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg: #12151C;
  --card: #1A1E27;
  --text: #E8EBF2;
  --text-2: #A8B0C0;
  --muted: #6E7789;
  --line: #262B36;
  --line-2: #2F3542;
  --primary-soft: #1B2740;
  --up: #FF5A5F;
  --up-soft: #2E1A1C;
  --down: #12C48B;
  --down-soft: #12291F;
  --shadow: 0 2px 10px rgba(0, 0, 0, .3);
  --shadow-lg: 0 8px 28px rgba(0, 0, 0, .45);
}

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body { overscroll-behavior-y: none; }

/* 所有数字等宽对齐 */
.num, .num * { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }

::-webkit-scrollbar { width: 0; height: 0; }

/* ==========================================================================
   布局骨架
   ========================================================================== */

.app { min-height: 100vh; }

/* 顶部品牌横幅 */
.app-header {
  position: relative;
  isolation: isolate;          /* 隔离层叠上下文，避免被 app-body 压错位 */
  z-index: 5;
  background: var(--grad);
  color: #fff;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 16px 26px;
  overflow: hidden;
}
}
.app-header::after {
  content: '';
  position: absolute; right: -40px; top: -50px;
  width: 180px; height: 180px; border-radius: 50%;
  background: rgba(255, 255, 255, .10);
  pointer-events: none;
}
.hd-top { display: flex; align-items: center; gap: 10px; position: relative; z-index: 1; }
.hd-logo-box {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden; border-radius: 11px;
}
.hd-logo { width: 100%; height: 100%; display: block; object-fit: contain; }
.hd-title { font-size: 19px; font-weight: 700; letter-spacing: .5px; }
.hd-spacer { flex: 1; }

.hd-status {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(255, 255, 255, .18);
  border-radius: 20px; padding: 4px 10px; font-size: 12px; font-weight: 500;
  backdrop-filter: blur(4px);
}
.hd-status .dot { width: 6px; height: 6px; border-radius: 50%; background: #52E5A0; }
.hd-status.closed .dot { background: #FFD666; }

.hd-refresh {
  width: 30px; height: 30px; border-radius: 50%;
  background: rgba(255, 255, 255, .18);
  display: flex; align-items: center; justify-content: center;
  transition: transform .3s;
}
.hd-refresh:active { transform: rotate(180deg); }
.hd-refresh svg { width: 15px; height: 15px; }

/* 搜索条 */
.hd-search {
  display: flex; align-items: center; gap: 8px;
  background: #fff; border-radius: 22px;
  margin: 12px 0 0; padding: 0 8px 0 14px; height: 38px;
  box-shadow: 0 4px 14px rgba(20, 40, 90, .18);
  position: relative; z-index: 10; /* 浮于内容区之上，不被 app-body 压住 */
}
.hd-search svg { width: 15px; height: 15px; flex-shrink: 0; }
.hd-search input {
  flex: 1; border: none; outline: none; background: transparent;
  font-size: 14px; color: var(--text); min-width: 0;
}
.hd-search input::placeholder { color: var(--muted); }

.hd-add {
  height: 28px; padding: 0 11px; border-radius: 14px; flex-shrink: 0;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center; gap: 3px;
  font-size: 13px; font-weight: 600; line-height: 1; letter-spacing: 0;
  box-shadow: 0 2px 6px rgba(46, 107, 255, .35);
  transition: transform .12s, box-shadow .15s, background .15s;
}
.hd-add:active { transform: scale(.92); box-shadow: 0 1px 3px rgba(46, 107, 255, .25); }
.hd-add svg { width: 14px; height: 14px; stroke: #fff; flex-shrink: 0; }
.hd-add-text { display: inline-block; }

/* 内容区：轻微上浮压住渐变，但给搜索条留出足够的渐变背景，避免遮挡 */
.app-body {
  margin-top: -18px;
  background: var(--bg);
  border-radius: 22px 22px 0 0;
  min-height: calc(100vh - var(--header-h));
  /* 底部多留 34px：给右下角悬浮操作栏（FAB）让位，避免压住最后一张卡片 */
  padding: 28px 14px calc(var(--tabbar-h) + var(--safe-b) + 34px);
  position: relative; z-index: 2;
}

/* 视图切换 */
.view { display: none; }
.view.active { display: block; animation: fadeUp .24s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* 底部 Tab */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  box-shadow: 0 -2px 12px rgba(27, 31, 42, .06);
}
.tabbar-item {
  flex: 1; height: var(--tabbar-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: 11px; transition: color .15s;
}
.tabbar-item svg { width: 21px; height: 21px; }
.tabbar-item.active { color: var(--primary); font-weight: 600; }

/* 桌面端侧边栏 */
.sidebar { display: none; }

@media (min-width: 1000px) {
  .app { display: flex; }
  .sidebar {
    display: flex; flex-direction: column;
    width: var(--sidebar-w); flex-shrink: 0;
    background: var(--card); border-right: 1px solid var(--line);
    height: 100vh; position: sticky; top: 0; padding: 20px 14px;
  }
  .sb-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
  .sb-brand img { height: 36px; }
  .sb-brand b { font-size: 15px; }
  .sb-brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
  .sb-nav { display: flex; flex-direction: column; gap: 4px; }
  .sb-nav button {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px; font-size: 14px;
    color: var(--text-2); transition: .15s; text-align: left; width: 100%;
  }
  .sb-nav button svg { width: 18px; height: 18px; }
  .sb-nav button:hover { background: var(--bg); }
  .sb-nav button.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
  .sb-foot { margin-top: auto; font-size: 11px; color: var(--muted); padding: 0 8px; line-height: 1.7; }

  .app-main { flex: 1; min-width: 0; }
  /* 内容列紧跟侧边栏左对齐（max-width 1180），不再在剩余空间居中，避免侧边栏与内容间大片留白；
     header 内容与 .app-body（padding 24）同轴：body margin-left 8 + padding 24 = 32 = header padding-left */
  .app-header { padding: 20px 32px 26px; }
  .hd-search { max-width: 420px; }
  .app-body {
    max-width: 1180px; margin: -18px 0 0 8px;
    padding: 28px 24px 40px;
    border-radius: 22px;
  }
  .tabbar { display: none; }
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
}

/* ==========================================================================
   通用组件
   ========================================================================== */

.card {
  background: var(--card);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 12px;
}
.card.p0 { padding: 0; overflow: hidden; }

.sec-title {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 2px 10px;
}
.sec-title h3 { margin: 0; font-size: 15px; font-weight: 700; }
.sec-title .more { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 2px; }
.sec-title .more svg { width: 13px; height: 13px; }

/* 相关基金（详情页底部内部链接，利于搜索引擎爬取） */
.rel-list { display: flex; flex-direction: column; }
.rel-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: var(--text); transition: background .12s;
}
.rel-item:last-child { border-bottom: none; }
.rel-item:active { background: var(--primary-soft); }
.rel-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rel-main b { font-size: 14px; font-weight: 600; }
.rel-main small { font-size: 11px; color: var(--muted); }
.rel-arrow { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 18px;
  background: var(--card); color: var(--text-2); font-size: 13px;
  border: 1px solid var(--line-2); transition: .15s; white-space: nowrap;
}
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: 10px;
  background: var(--primary); color: #fff; font-size: 14px; font-weight: 600;
  transition: opacity .15s;
}
.btn:active { opacity: .82; }
.btn.ghost { background: var(--bg); color: var(--text-2); border: 1px solid var(--line-2); }
.btn.block { width: 100%; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 8px; }

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--flat); }
.bg-up { background: var(--up-soft); }
.bg-down { background: var(--down-soft); }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty img { width: 110px; opacity: .85; margin-bottom: 14px; }
.empty p { margin: 0 0 16px; font-size: 13px; }

.loading { display: flex; align-items: center; justify-content: center; padding: 28px; color: var(--muted); font-size: 13px; gap: 8px; }
.spinner {
  width: 16px; height: 16px; border: 2px solid var(--line-2);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 20px);
  transform: translateX(-50%) translateY(10px);
  background: rgba(27, 31, 42, .92); color: #fff;
  padding: 9px 18px; border-radius: 20px; font-size: 13px;
  z-index: 200; opacity: 0; pointer-events: none; transition: .22s;
  max-width: 80vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 1000px) { .toast { bottom: 32px; } }

/* ==========================================================================
   首页：大盘指数
   ========================================================================== */

.idx-grid { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.idx-grid::-webkit-scrollbar { display: none; }
.idx-card {
  flex: 1 0 0; min-width: 0;
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 10px 8px; cursor: pointer; transition: transform .12s; text-align: center;
}
.idx-card:active { transform: scale(.98); }
.idx-name { font-size: 11px; color: var(--muted); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idx-line { display: flex; align-items: baseline; justify-content: center; gap: 5px; flex-wrap: wrap; }
.idx-price { font-size: 16px; font-weight: 700; line-height: 1.15; }
.idx-rate { font-size: 10px; font-weight: 600; }

/* 涨跌家数条 */
.stat-bar { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.stat-bar .grow { flex: 1; height: 6px; border-radius: 3px; background: var(--line); display: flex; overflow: hidden; }
.stat-bar .grow i { display: block; height: 100%; }
.stat-bar .num { font-size: 12px; }

/* 板块资金流入口行 */
.flow-link {
  display: flex; align-items: center; gap: 10px;
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 11px 14px; margin-bottom: 12px; font-size: 13px;
}
.flow-link .tag {
  background: var(--primary-soft); color: var(--primary);
  padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.flow-link .txt { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.flow-link svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }

/* 插件下载 banner */
.ext-banner {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(100deg, #EAF1FF 0%, #F3F8FF 55%, #FFFFFF 100%);
  color: var(--text); border: 1px solid rgba(46,107,255,.28); border-radius: var(--r); padding: 11px 12px 11px 14px;
  margin-bottom: 12px; text-decoration: none; box-shadow: 0 2px 10px rgba(46,107,255,.08);
  transition: border-color .15s, transform .12s, box-shadow .15s;
  position: relative; overflow: hidden;
  animation: ext-banner-glow 2.6s ease-in-out infinite;
}
@keyframes ext-banner-glow {
  0%, 100% { box-shadow: 0 2px 10px rgba(46,107,255,.08); }
  50% { box-shadow: 0 4px 16px rgba(46,107,255,.20); }
}
.ext-banner:active { transform: scale(.99); }
.ext-banner:hover { border-color: var(--primary); }
.ext-banner .ext-icon {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ext-banner .ext-icon svg { width: 18px; height: 18px; color: #fff; }
.ext-banner .ext-txt { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ext-banner .ext-txt b { font-size: 14px; font-weight: 700; color: var(--primary); }
.ext-banner .ext-txt small { font-size: 11px; color: var(--muted); }
.ext-banner .ext-cta {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 4px;
  background: var(--primary); color: #fff; font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: 14px; transition: background .15s;
}
.ext-banner:hover .ext-cta { background: var(--primary-dark); }
.ext-banner .ext-dot {
  width: 6px; height: 6px; border-radius: 50%; background: #fff; opacity: .9;
  animation: ext-dot-pulse 1.4s ease-in-out infinite;
}
@keyframes ext-dot-pulse {
  0%, 100% { transform: scale(1); opacity: .9; }
  50% { transform: scale(1.5); opacity: .45; }
}

/* ==========================================================================
   自选基金列表
   ========================================================================== */

.fund-list { display: flex; flex-direction: column; gap: 10px; }

.fund-card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 13px 14px; display: flex; align-items: center; gap: 12px;
  cursor: pointer; transition: transform .12s;
  position: relative; overflow: hidden;
}
.fund-card:active { transform: scale(.99); }
.fund-main { flex: 1; min-width: 0; }
.fund-name {
  font-size: 14px; font-weight: 600; margin-bottom: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fund-sub {
  font-size: 11.5px; color: var(--muted);
  display: flex; gap: 6px; align-items: center; justify-content: flex-end;
}
.fund-sub .badge {
  font-size: 10px; padding: 1px 5px; border-radius: 4px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line-2);
}
.fund-sub .badge.pos { background: var(--primary-soft); color: var(--primary); border-color: transparent; }

/* 估值卡片：左侧 = 名称 + 主涨跌（强显）；右侧 = 代码/标记 + 实际净值（淡化） */
.fund-right {
  text-align: right; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  gap: 3px;
  font-feature-settings: "tnum";      /* 等宽数字 */
  font-variant-numeric: tabular-nums;
}
.fund-est {
  display: flex; align-items: center; gap: 4px;
  font-weight: 700; line-height: 1.2;
  justify-content: flex-start;
}
.fund-est .val { font-family: "SF Mono", Consolas, monospace, "DIN Alternate"; letter-spacing: -.3px; }
.fund-main .fund-est { margin-top: 3px; }
.fund-est.line-1 { font-size: 19px; }   /* 主涨跌（强显） */
.est-tag {
  font-size: 10.5px; font-weight: 600;
  padding: 1px 5px; border-radius: 4px;
  background: var(--primary-soft); color: var(--primary);
  letter-spacing: 0; line-height: 1.4;
  transform: translateY(-1px);              /* 与大数字对齐基线 */
}
.fund-actual {
  font-size: 11.5px;
  display: flex; align-items: center; gap: 4px; justify-content: flex-end;
  font-weight: 500; line-height: 1.2;
}
.fund-actual.muted { color: var(--muted); opacity: .8; }
.fund-actual .dot { opacity: .5; }
.fund-actual .date { opacity: .55; font-weight: 400; }

/* 列表底部加载更多 */
.load-more {
  text-align: center; padding: 16px; color: var(--muted); font-size: 12.5px;
}

/* ==========================================================================
   详情页
   ========================================================================== */

.detail-head {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 22px 18px 20px; margin-bottom: 12px; text-align: center;
}

.head-label-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--muted); margin-bottom: 14px;
}
.head-label-row .badge {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line-2);
}
.head-label-row .badge.pos {
  background: var(--primary-soft); color: var(--primary); border-color: transparent;
}

.head-main { margin-bottom: 14px; }

/* 估值时段：涨跌% 与 估算净值 同排显示 */
.rate-line {
  display: flex; align-items: baseline; justify-content: center;
  gap: 3px; flex-wrap: wrap;
}
.rate-line.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
  align-items: center;
  justify-content: center;
}
.rate-line.two-col .col {
  display: flex; align-items: baseline; justify-content: flex-start;
  gap: 3px; flex-wrap: wrap;
}
.head-main .c.lead { font-size: 24px; font-weight: 700; opacity: 1; letter-spacing: -.4px; margin: 0; line-height: 1.1; }
.rate-label, .val-label {
  font-size: 12px; color: var(--muted); font-weight: 500; line-height: 1;
}
.est-hint {
  font-size: 10px; color: var(--muted); opacity: .8;
  margin-top: 16px;
  line-height: 1.6; text-align: left;
}

/* 非估值时段：净值在上（22px），涨跌在下 */
.head-main .v {
  font-size: 22px; font-weight: 700; line-height: 1.15;
  letter-spacing: -0.3px; display: flex; align-items: flex-start; justify-content: center; gap: 6px;
}
.head-main .v.sub { font-size: 15px; font-weight: 500; opacity: .9; letter-spacing: -.1px; display: inline-flex; align-items: flex-start; gap: 5px; }
.head-main .c { font-size: 13px; font-weight: 600; margin-top: 8px; opacity: .85; }

.head-meta {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px 14px;
  margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line);
  text-align: left;
}
.meta-item { display: flex; flex-direction: column; gap: 6px; }
.meta-item.full { grid-column: 1 / -1; padding-bottom: 4px; }
.meta-item span { font-size: 11px; color: var(--muted); font-weight: 400; }
.meta-item b { font-size: 14px; font-weight: 600; color: var(--text); }

.kv { display: flex; flex-wrap: wrap; gap: 0; }
.kv-item { width: 50%; padding: 9px 0; }
.kv-item .k { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.kv-item .v { font-size: 13.5px; font-weight: 500; word-break: break-all; }
@media (min-width: 1000px) { .kv-item { width: 33.33%; } }

/* 走势图 */
.spark { width: 100%; height: 92px; display: block; }

/* 区间业绩表 */
.perf-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.perf-table th {
  font-weight: 500; color: var(--muted); font-size: 11.5px;
  padding: 6px 4px; text-align: right; border-bottom: 1px solid var(--line);
}
.perf-table th:first-child, .perf-table td:first-child { text-align: left; }
.perf-table td { padding: 8px 4px; text-align: right; border-bottom: 1px solid var(--line); }
.perf-table tr:last-child td { border-bottom: none; }
.perf-table .rank { color: var(--muted); font-size: 11px; }

/* 持仓 */
.pos-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.pos-row:last-child { border-bottom: none; }
.pos-row .nm { flex: 1; min-width: 0; }
.pos-row .nm b { font-size: 13px; font-weight: 500; display: block; }
.pos-row .nm small { font-size: 11px; color: var(--muted); }
.pos-row .w { width: 54px; text-align: right; font-size: 13px; }
.pos-row .r { width: 62px; text-align: right; font-size: 13px; font-weight: 600; }

/* 资产配置条 */
.alloc-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line); margin: 10px 0 12px; }
.alloc-bar i { display: block; height: 100%; }
.alloc-legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 11.5px; }
.alloc-legend span { display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); }
.alloc-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

/* 实时估值走势（分时图） */
.est-chart { width: 100%; max-width: 520px; height: 170px; display: block; margin: 0 auto; }
.est-line {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin-top: 8px; font-size: 12px; color: var(--text-2);
}
.est-line b { font-size: 13px; font-weight: 600; }
.est-line .muted { color: var(--muted); margin-left: auto; }
.est-tip { font-size: 10.5px; color: var(--muted); line-height: 1.5; margin-top: 6px; }

/* 净值走势（多周期 tab + 双线 + tooltip） */
.hist-wrap { position: relative; max-width: 520px; margin: 0 auto; }
.hist-chart { width: 100%; height: 190px; display: block; }
.hist-legend { display: flex; gap: 16px; justify-content: center; margin-top: 4px; }
.hist-legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-2); }
.hist-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.pt-tabs { display: flex; gap: 5px; margin-top: 12px; flex-wrap: wrap; }
.pt-tab {
  padding: 5px 10px; border-radius: 15px; font-size: 12px;
  background: var(--bg); color: var(--text-2); border: 1px solid var(--line-2);
  transition: .15s; white-space: nowrap;
}
.pt-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.chart-tip {
  position: absolute; top: 8px; left: 70px; z-index: 3;
  background: rgba(27, 31, 42, .88); color: #fff; border-radius: 8px;
  padding: 7px 10px; font-size: 11px; line-height: 1.7; pointer-events: none;
  box-shadow: var(--shadow-lg); white-space: nowrap;
}

/* 设置成本 */
.cost-row { display: flex; gap: 10px; }
.cost-field { flex: 1; min-width: 0; }
.cost-field label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.cost-field input {
  width: 100%; height: 38px; border-radius: 9px; border: 1px solid var(--line-2);
  padding: 0 10px; outline: none; background: var(--bg); font-size: 13.5px;
}
.cost-field input:focus { border-color: var(--primary); background: var(--card); }
.cost-actions { display: flex; gap: 8px; margin-top: 10px; }

/* 持仓概览（详情页上部） */
.holding-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 10px;
}
@media (min-width: 1000px) { .holding-grid { grid-template-columns: repeat(4, 1fr); } }
.holding-item span {
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--muted); margin-bottom: 4px;
}
.holding-item b { font-size: 15px; font-weight: 600; }

/* 详情页顶部返回栏 */
.detail-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.detail-bar .back {
  width: 32px; height: 32px; border-radius: 50%; background: var(--card);
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow); flex-shrink: 0;
}
.detail-bar .back svg { width: 17px; height: 17px; }
.detail-bar h2 { margin: 0; font-size: 16px; flex: 1; }
.detail-bar .grp {
  font-size: 12px; color: var(--primary); background: var(--primary-soft);
  padding: 5px 12px; border-radius: 16px; flex-shrink: 0;
}

/* ==========================================================================
   板块行情
   ========================================================================== */

.board-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.board-row:last-child { border-bottom: none; }
.board-row .rk {
  width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; background: var(--bg); color: var(--muted);
}
.board-row .rk.top { background: var(--primary-soft); color: var(--primary); }
.board-row .nm { flex: 1; min-width: 0; }
.board-row .nm b { font-size: 13.5px; font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-row .nm small { font-size: 11px; color: var(--muted); }
.board-row .fl { width: 84px; text-align: right; font-size: 12.5px; }
.board-row .pc { width: 64px; text-align: right; font-size: 14px; font-weight: 600; }

/* ==========================================================================
   资金流向
   ========================================================================== */

.mini-stats { display: flex; gap: 8px; margin-bottom: 12px; }
.mini-stat {
  flex: 1; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 12px 10px; text-align: center;
}
.mini-stat .n { font-size: 21px; font-weight: 700; line-height: 1.2; }
.mini-stat .l { font-size: 11px; color: var(--muted); margin-top: 2px; }

.flow-split { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.flow-item { text-align: center; padding: 10px 4px; border-radius: 10px; background: var(--bg); }
.flow-item .l { font-size: 11px; color: var(--muted); }
.flow-item .v { font-size: 13px; font-weight: 600; margin-top: 2px; }

.flow-chart { width: 100%; height: 120px; display: block; }

/* ==========================================================================
   我的
   ========================================================================== */

.mine-head {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 18px 16px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 14px;
}
.mine-head img { width: 54px; height: 54px; border-radius: 14px; }
.mine-head .t b { font-size: 16px; }
.mine-head .t small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

.qr-card {
  background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 12px; text-align: center;
}
.qr-card img { width: 140px; height: 140px; border-radius: 10px; display: block; margin: 0 auto 8px; }
.qr-card small { color: var(--muted); font-size: 11px; word-break: break-all; }

.set-row {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-bottom: 1px solid var(--line);
}
.set-row:last-child { border-bottom: none; }
.set-row .ic {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-soft); color: var(--primary);
}
.set-row .ic svg { width: 16px; height: 16px; }
.set-row .tx { flex: 1; min-width: 0; }
.set-row .tx b { font-size: 13.5px; font-weight: 500; display: block; }
.set-row .tx small { font-size: 11.5px; color: var(--muted); }
.set-row .rt { color: var(--muted); font-size: 12.5px; flex-shrink: 0; display: flex; align-items: center; gap: 4px; }
.set-row .rt svg { width: 14px; height: 14px; }
.set-row.clickable:active { background: var(--bg); }

/* 开关 */
.switch {
  width: 42px; height: 24px; border-radius: 12px; background: var(--line-2);
  position: relative; transition: background .2s; flex-shrink: 0;
}
.switch.on { background: var(--primary); }
.switch i {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}
.switch.on i { transform: translateX(18px); }

/* ==========================================================================
   弹窗
   ========================================================================== */

.mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(15, 20, 30, .45);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.mask.show { opacity: 1; pointer-events: auto; }
.modal {
  width: 100%; max-width: 480px;
  background: var(--card); border-radius: 20px 20px 0 0;
  padding: 18px 16px calc(18px + var(--safe-b));
  transform: translateY(100%); transition: transform .26s cubic-bezier(.3, .9, .3, 1);
  max-height: 86vh; display: flex; flex-direction: column;
}
.mask.show .modal { transform: none; }
@media (min-width: 1000px) {
  .mask { align-items: center; }
  .modal { border-radius: 18px; max-height: 80vh; transform: scale(.94); opacity: 0; }
  .mask.show .modal { transform: none; opacity: 1; }
}

.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; flex-shrink: 0;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.modal-head .x { width: 28px; height: 28px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.modal-head .x svg { width: 14px; height: 14px; color: var(--muted); }
.modal-body { overflow-y: auto; flex: 1; margin: 0 -16px; padding: 0 16px; }

.search-input {
  width: 100%; height: 42px; border-radius: 10px; border: 1px solid var(--line-2);
  padding: 0 14px; outline: none; background: var(--bg); margin-bottom: 12px;
}
.search-input:focus { border-color: var(--primary); background: var(--card); }

.result-row {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 2px; border-bottom: 1px solid var(--line);
}
.result-row:last-child { border-bottom: none; }
.result-row .nm { flex: 1; min-width: 0; }
.result-row .nm b { font-size: 13.5px; font-weight: 500; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-row .nm small { font-size: 11px; color: var(--muted); }

.group-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.group-item:last-child { border-bottom: none; }
.group-item .nm { flex: 1; font-size: 13.5px; }
.group-item .nm small { color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.group-item .act { display: flex; gap: 6px; }

.donate-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.donate-tabs button {
  flex: 1; height: 34px; border-radius: 9px; font-size: 13px;
  background: var(--bg); color: var(--text-2); border: 1px solid var(--line-2);
}
.donate-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }
.donate-qr { text-align: center; }
.donate-qr img { width: 200px; max-width: 70vw; border-radius: 12px; }
.donate-qr p { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }

/* 分组下拉 */
.select {
  width: 100%; height: 42px; border-radius: 10px; border: 1px solid var(--line-2);
  padding: 0 12px; outline: none; background: var(--bg); margin-bottom: 10px;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A93A6' stroke-width='3'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center;
}
.select:focus { border-color: var(--primary); }

/* ==========================================================================
   悬浮操作栏（FAB）：收藏 / 分享 / 添加到桌面
   层级：tabbar 60 < 遮罩 65 < fab 70 < 弹窗 100 < toast 200
   ========================================================================== */

.fab-backdrop {
  position: fixed; inset: 0; z-index: 65;
  background: rgba(15, 20, 30, .30);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.fab-backdrop.show { opacity: 1; pointer-events: auto; }

.fab {
  position: fixed; z-index: 70;
  right: 14px;
  bottom: calc(var(--tabbar-h) + var(--safe-b) + 14px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
}

.fab-menu {
  display: flex; flex-direction: column; align-items: flex-end; gap: 10px;
  opacity: 0; transform: translateY(10px) scale(.96); transform-origin: bottom right;
  pointer-events: none; transition: opacity .18s, transform .22s cubic-bezier(.3, .9, .3, 1);
}
.fab.open .fab-menu { opacity: 1; transform: none; pointer-events: auto; }

.fab-item {
  --accent: var(--primary);     /* 每项在 [data-act="..."] 选择器里覆盖 */
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(27, 31, 42, .18);
  transition: transform .14s, box-shadow .18s ease;
  position: relative;          /* 标签气泡的定位锚 */
  cursor: pointer;
}
.fab-item:hover { box-shadow: 0 8px 22px rgba(27, 31, 42, .26); transform: translateY(-1px); }
.fab-item:active { transform: scale(.94); }

/* 每个动作独立的强调色：收藏=琥珀，分享=主蓝，安装=紫 */
.fab-item[data-act="fav"]     { --accent: #FFB020; }
.fab-item[data-act="share"]   { --accent: #2E6BFF; }
.fab-item[data-act="install"] { --accent: #7B5AF0; }

/* 标签：绝对定位弹出按钮右侧（黑底白字小气泡）
   默认隐藏，hover/聚焦时滑出 + 淡入 */
.fab-label {
  position: absolute;
  right: calc(100% + 10px); top: 50%;
  transform: translate(4px, -50%);
  font-size: 12.5px; font-weight: 500; white-space: nowrap;
  color: #fff; background: rgba(15, 20, 30, .82);
  padding: 6px 10px; border-radius: 6px;
  pointer-events: none; opacity: 0;
  transition: opacity .18s, transform .22s cubic-bezier(.3, .9, .3, 1);
  box-shadow: 0 4px 12px rgba(15, 20, 30, .15);
}
.fab-label::after {              /* 三角箭头指向按钮 */
  content: ''; position: absolute;
  left: 100%; top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-left-color: rgba(15, 20, 30, .82);
}
@media (hover: hover) and (pointer: fine) {
  .fab-item:hover .fab-label,
  .fab-item:focus-visible .fab-label {
    opacity: 1;
    transform: translate(0, -50%);
  }
}

/* 图标：纯色背景上的白色描边 */
.fab-ic {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  border-radius: 50%;
}
.fab-ic svg {
  width: 22px; height: 22px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}

/* 已收藏：保持强调色背景 + 实心星（白色） */
.fab-item.on .fab-ic svg { fill: currentColor; }

.fab-main {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(33, 84, 232, .38);
  transition: transform .18s;
}
.fab-main:active { transform: scale(.92); }
.fab-main svg { width: 22px; height: 22px; transition: transform .28s cubic-bezier(.3, .9, .3, 1); }
.fab.open .fab-main svg { transform: rotate(135deg); }

/* 移动端：底部居中元素（分页、加载更多、全宽按钮）给右下角悬浮按钮让出 58px 安全区
   用 .app-body 前缀提高特异性，避免被前面的 .pager / .btn 简写覆盖 */
@media (max-width: 999px) {
  .app-body .pager,
  .app-body .load-more { padding-right: 58px; }
  .app-body .btn.block {
    /* btn 自带 padding: 0 18px，右 padding 单独加大，文字 flex 居中后视觉中心略左移 */
    padding-right: 58px;
  }
}

@media (min-width: 1000px) {
  .fab { right: 28px; bottom: 28px; }
  .fab-main { width: 48px; height: 48px; }
  .fab-main svg { width: 20px; height: 20px; }
  .fab-item { width: 48px; height: 48px; }
  .fab-ic svg { width: 20px; height: 20px; }
}

/* ==========================================================================
   引导弹窗（收藏 / 添加到桌面）
   ========================================================================== */

.guide-hero { text-align: center; padding: 4px 0 14px; }
.guide-hero .ring {
  width: 62px; height: 62px; border-radius: 50%; margin: 0 auto;
  background: var(--grad); color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 16px rgba(33, 84, 232, .28);
}
.guide-hero .ring svg { width: 30px; height: 30px; stroke-width: 2.2; flex-shrink: 0; }
.guide-hero p { margin: 12px 0 0; font-size: 13px; color: var(--text-2); line-height: 1.7; }

.guide-steps { margin: 0; padding: 0; list-style: none; counter-reset: gs; }
.guide-steps li {
  counter-increment: gs; position: relative;
  padding: 9px 0 9px 34px; font-size: 13.5px; color: var(--text-2); line-height: 1.65;
  border-bottom: 1px solid var(--line);
}
.guide-steps li:last-child { border-bottom: none; }
.guide-steps li::before {
  content: counter(gs); position: absolute; left: 0; top: 10px;
  width: 21px; height: 21px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.guide-steps b { color: var(--text); font-weight: 600; }

/* 提示条 */
.tip {
  background: var(--primary-soft); color: var(--primary);
  border-radius: 10px; padding: 10px 12px; font-size: 12px; line-height: 1.65;
  margin-bottom: 12px;
}
.tip.warn { background: #FFF7E6; color: #AD6800; }
[data-theme="dark"] .tip.warn { background: #33290F; color: #FFC53D; }

/* ============ 自选栏目（watchlist） ============ */
.wl-actions { display: flex; gap: 10px; margin-bottom: 10px; }
.wl-actions .btn { flex: 1; }
.wl-actions .btn svg { width: 16px; height: 16px; }

.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 18px 0 6px;
}
.pg-btn {
  min-width: 86px; height: 36px; padding: 0 16px; border-radius: 9px;
  background: var(--card); color: var(--text-1); font-size: 14px; font-weight: 600;
  border: 1px solid var(--line-2); transition: .15s;
}
.pg-btn:active { opacity: .82; }
.pg-btn:disabled { opacity: .4; cursor: not-allowed; }
.pg-info { font-size: 13px; color: var(--muted); white-space: nowrap; }

/* SEO 无障碍：仅给屏幕阅读器与搜索引擎 */
.sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
