/* 金融终端 · 网页版
 *
 * 断点三档：
 *   手机  < 640      单列，概览与聊天同一条滚动，输入栏贴底
 *   平板  640 – 899  卡片两列，仍然上下排
 *   桌面  ≥ 900      左栏概览常驻、右栏聊天独立滚动，互不干扰
 *
 * 涨红跌绿 —— 跟着国内习惯走，跟欧美相反。
 */

:root {
  --bg: #f5f6f8;
  --bg-blur: rgba(245, 246, 248, .86);
  --panel: #ffffff;
  --panel-2: #eef0f4;
  --line: #e2e5ea;
  --line-soft: #eceff3;
  --text: #15181e;
  --text-2: #5a6270;
  --text-3: #8c95a3;
  --accent: #0e7c6b;
  --accent-ink: #ffffff;
  --accent-soft: rgba(14, 124, 107, .09);
  --up: #d13b2e;
  --down: #0a7d4f;
  --warn: #a9591a;
  --radius: 15px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 18px rgba(15, 23, 42, .05);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0d12;
    --bg-blur: rgba(10, 13, 18, .84);
    --panel: #131820;
    --panel-2: #1a202a;
    --line: #222a36;
    --line-soft: #1c232d;
    --text: #e7ecf4;
    --text-2: #98a2b3;
    --text-3: #68737f;
    --accent: #2fd6a6;
    --accent-ink: #05201a;
    --accent-soft: rgba(47, 214, 166, .1);
    --up: #ff6b6b;
    --down: #3ddc97;
    --warn: #f0a35e;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 22px rgba(0, 0, 0, .28);
  }
}

* { 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, "SF Pro SC", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overscroll-behavior-y: none; }

[hidden] { display: none !important; }

button, input, textarea {
  font: inherit;
  color: inherit;
}

/* ------------------------------------------------------------------ 登录 */
.login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(1100px 520px at 50% -10%, var(--accent-soft), transparent 70%),
    var(--bg);
}

.login-box {
  width: 100%;
  max-width: 340px;
  text-align: center;
}

.login-mark {
  width: 54px; height: 54px;
  margin: 0 auto 18px;
  border-radius: 16px;
  display: grid; place-items: center;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--line);
}

.login-box h1 {
  margin: 0 0 6px;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .01em;
}

.login-sub {
  margin: 0 0 22px;
  color: var(--text-3);
  font-size: 13.5px;
}

#login-form { display: grid; gap: 10px; }

#pwd {
  width: 100%;
  padding: 13px 15px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 16px; /* 16px 以下 iOS 会自动放大页面 */
  text-align: center;
  letter-spacing: .08em;
  transition: border-color .18s, box-shadow .18s;
}

#pwd:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#login-btn {
  padding: 13px;
  border: none;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}

#login-btn:active { transform: scale(.985); }
#login-btn[disabled] { opacity: .55; cursor: default; }

.login-err {
  margin: 12px 0 0;
  color: var(--up);
  font-size: 13px;
}

.login-foot {
  margin: 26px 0 0;
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.7;
}

.login-foot code {
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--panel-2);
}

/* ------------------------------------------------------------------ 骨架 */
.shell {
  display: block;
  height: 100dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.side { padding-bottom: 4px; }

.side-head {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-blur);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}

.side-head.scrolled { border-bottom-color: var(--line); }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: .01em;
}

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  transition: background .3s;
}

.dot.live {
  background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-soft);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(47, 214, 166, .34); }
  70%  { box-shadow: 0 0 0 7px rgba(47, 214, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 214, 166, 0); }
}

.head-actions { display: flex; gap: 2px; }

.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.spin svg { animation: spin .7s linear; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ 卡片 */
.cards {
  display: grid;
  gap: 10px;
  padding: 6px 16px 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 15px 13px;
  box-shadow: var(--shadow);
}

.card.slim { padding: 13px 15px; }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.card-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--text-3);
}

.card-hint {
  font-size: 11.5px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.big-num {
  font-size: 27px;
  font-weight: 650;
  letter-spacing: -.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.big-num.sm { font-size: 22px; }

.sub {
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.row2 {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.tight { text-align: right; }

.mini {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.mini + .mini { margin-top: 3px; }

.bar {
  height: 6px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
  margin: 11px 0 8px;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
  transition: width .6s cubic-bezier(.22, .8, .3, 1);
}

.bar i.over { background: var(--up); }
.bar i.warn { background: var(--warn); }

.card-foot {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

.card-foot b { font-weight: 600; color: var(--text); }

.verdict {
  flex: 0 0 auto;
  align-self: center;
  font-size: 13.5px;
  font-weight: 700;
  padding: 7px 11px;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}

.verdict.short { background: rgba(209, 59, 46, .1); color: var(--up); }
.verdict.wait  { background: var(--panel-2); color: var(--text-2); }

/* 三周期小表 */
.periods { display: grid; gap: 7px; margin-top: 12px; }

.period {
  display: grid;
  grid-template-columns: 3.6em 1fr auto;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
}

.period .pn { color: var(--text-3); }

.period .track {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
}

/* 方向条：中点为零，向左右各画一半 */
.period .track i {
  position: absolute;
  top: 0; bottom: 0;
  border-radius: 999px;
  transition: width .5s, left .5s;
}

.period .pv {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  white-space: nowrap;
}

/* 分类 */
.cats { display: grid; gap: 9px; }

.cat {
  display: grid;
  grid-template-columns: 3.4em 1fr auto;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
}

.cat .cn { color: var(--text-2); }
.cat .track { height: 5px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.cat .track i { display: block; height: 100%; background: var(--accent); opacity: .75; border-radius: 999px; }
.cat .ca { font-variant-numeric: tabular-nums; color: var(--text-3); }

/* 最近几笔 */
.recent { display: grid; gap: 8px; }

.rec {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  font-size: 12.5px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}

.rec:last-child { border-bottom: none; padding-bottom: 0; }
.rec .rn { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec .ra { font-variant-numeric: tabular-nums; font-weight: 600; }
.rec .rd { grid-column: 1 / -1; color: var(--text-3); font-size: 11.5px; }

.empty {
  font-size: 12.5px;
  color: var(--text-3);
  padding: 4px 0;
}

/* ------------------------------------------------------------------ 聊天 */
.chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.log {
  padding: 14px 16px 8px;
  display: flex;
  flex-direction: column;
}

.msg { margin-bottom: 16px; animation: rise .26s ease-out both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: none; }
}

.msg.user { display: flex; justify-content: flex-end; }

.msg.user .bubble {
  max-width: 82%;
  padding: 9px 14px;
  border-radius: 16px 16px 5px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14.5px;
  word-break: break-word;
  white-space: pre-wrap;
}

.msg.bot .bubble {
  max-width: 100%;
  font-size: 14.5px;
  word-break: break-word;
}

.msg.err .bubble {
  border-left: 2px solid var(--up);
  padding-left: 11px;
  color: var(--text-2);
}

.msg .meta {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* markdown：终端的输出就这几种形态，按行渲染即可 */
.bubble h1 {
  margin: 0 0 9px;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -.01em;
  line-height: 1.35;
}

.bubble h2 {
  margin: 14px 0 7px;
  font-size: 14px;
  font-weight: 650;
  color: var(--text);
}

.bubble h2:first-child { margin-top: 0; }

.bubble p {
  margin: 0 0 6px;
  line-height: 1.62;
}

.bubble p:last-child { margin-bottom: 0; }

.bubble strong { font-weight: 650; }

.bubble code {
  font-family: var(--mono);
  font-size: .88em;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--panel-2);
}

.bubble hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: 12px 0;
}

/* 引用块 = 终端里那一行行「>」，连在一起做成一张小卡 */
.bubble blockquote {
  margin: 8px 0;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--panel-2);
}

.bubble blockquote p {
  margin: 0;
  padding: 1.5px 0;
  font-size: 13.8px;
  line-height: 1.6;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}

.bubble img {
  display: block;
  width: 100%;
  height: auto;
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: var(--panel-2);
}

/* 输入中 */
.typing { display: inline-flex; gap: 4px; align-items: center; padding: 3px 0; }

.typing i {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--text-3);
  animation: blink 1.3s infinite;
}

.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }

@keyframes blink {
  0%, 60%, 100% { opacity: .28; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* 清空确认条：替代 window.confirm，免得被微信内置浏览器吞掉 */
.confirm-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 16px 8px;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 13px;
  color: var(--text-2);
  animation: rise .2s ease-out both;
}

/* hidden 属性要能压住上面的 display:flex */
.confirm-bar[hidden] { display: none; }

.confirm-bar > span { flex: 1 1 auto; min-width: 0; }

.confirm-bar button {
  flex: 0 0 auto;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.confirm-bar button:active { transform: scale(.96); }
.confirm-bar .cf-no:hover { color: var(--text); border-color: var(--text-3); }
.confirm-bar .cf-yes {
  color: #fff;
  background: var(--warn);
  border-color: var(--warn);
}
.confirm-bar .cf-yes:hover { filter: brightness(.94); }

/* 深色主题下 --warn 是浅橙，白字会糊成一片，换深色字 */
@media (prefers-color-scheme: dark) {
  .confirm-bar .cf-yes { color: #1c1006; }
}

/* 快捷指令 + 清空按钮：快捷那排横向滚动，清空固定钉在右边 */
.chat-tools {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-right: 10px;
  /* .chat 是 flex 纵向容器，子项 min-width 默认 auto 会被 quick 的内容撑破，
     窄屏下整排会溢出到视口外、把清空按钮挤没。必须显式归零。 */
  min-width: 0;
}

.chat-tools .quick {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 4px;
}

.clear-btn {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-2);
  cursor: pointer;
  /* 手指点下去立刻响应，别等 300ms 双击缩放判定 */
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s, background .15s, border-color .15s, transform .1s;
}

.clear-btn:hover {
  color: var(--warn);
  border-color: var(--warn);
  background: var(--panel);
}

.clear-btn:active { transform: scale(.9); }
.clear-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.quick {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 6px 16px 4px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.quick::-webkit-scrollbar { display: none; }

.quick button {
  flex: 0 0 auto;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.quick button:hover { color: var(--text); border-color: var(--text-3); }
.quick button:active { transform: scale(.96); }

/* 窄屏：把按钮收窄，让「立场…帮助」六个加清空按钮在 390 宽的手机上
   能一排放下 —— 否则最后一个会被裁掉半截，看着像坏了 */
@media (max-width: 639px) {
  .quick { gap: 5px; padding-left: 12px; }
  .quick button { padding: 5px 9px; font-size: 12px; }
  .chat-tools { padding-right: 8px; }
}

/* 输入栏 */
.composer {
  position: sticky;
  bottom: 0;
  z-index: 7;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 62%, transparent);
}

#input {
  flex: 1;
  min-height: 42px;
  max-height: 128px;
  padding: 10px 15px;
  border-radius: 21px;
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: 16px; /* 别低于 16px，否则 iOS 聚焦会放大整页 */
  line-height: 1.5;
  resize: none;
  overflow-y: auto;
  transition: border-color .18s, box-shadow .18s;
}

#input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

#send {
  flex: 0 0 auto;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}

#send:active { transform: scale(.93); }
#send[disabled] { opacity: .4; cursor: default; }

/* 灯箱 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .93);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fade .18s ease-out;
  cursor: zoom-out;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

/* ------------------------------------------------------------------ 平板 */
@media (min-width: 640px) and (max-width: 899px) {
  .cards {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 10px 20px 18px;
  }
  .card.slim { grid-column: span 2; }
  .side-head { padding: 12px 20px; }
  .log { padding: 16px 20px 8px; }
  .quick { padding: 8px 20px 4px; }
  .composer { padding: 8px 20px calc(12px + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------------ 桌面 */
@media (min-width: 900px) {
  .shell {
    display: grid;
    grid-template-columns: 392px minmax(0, 1fr);
    height: 100dvh;
    overflow: hidden;
  }

  .side {
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    padding-bottom: 20px;
    scrollbar-width: thin;
  }

  .side::-webkit-scrollbar { width: 6px; }
  .side::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 3px;
  }

  .cards { padding: 10px 18px 4px; }

  .chat {
    height: 100%;
    overflow: hidden;
  }

  .log {
    flex: 1;
    overflow-y: auto;
    max-width: 880px;
    width: 100%;
    margin: 0 auto;
    padding: 24px 28px 12px;
    scrollbar-width: thin;
  }

  .log::-webkit-scrollbar { width: 8px; }
  .log::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 4px;
  }

  .quick,
  .composer {
    max-width: 880px;
    width: 100%;
    margin: 0 auto;
  }

  .composer {
    position: static;
    padding: 8px 28px 18px;
  }

  .msg.bot .bubble { max-width: 96%; }
  .big-num { font-size: 28px; }
}

/* 桌面宽屏再松一点 */
@media (min-width: 1280px) {
  .shell { grid-template-columns: 420px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------------------ 详情抽屉
 *
 * 手机从底部推上来（拇指够得着），平板/桌面居中。
 * 里面全是「点开才看」的明细，所以允许自己滚，不影响外面那一屏。
 */

.card.tap { cursor: pointer; }
.card.tap:active { transform: scale(.995); }
.card.tap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.chev {
  font-style: normal;
  color: var(--text-3);
  font-size: 15px;
  margin-left: 2px;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-veil {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 18, .42);
  backdrop-filter: blur(2px);
}
.sheet-panel {
  position: relative;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -8px 40px rgba(8, 12, 18, .22);
  animation: sheetUp .22s ease-out;
}
@keyframes sheetUp {
  from { transform: translateY(14px); opacity: .6; }
  to   { transform: translateY(0); opacity: 1; }
}
.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  background: var(--panel);
  border-radius: 18px 18px 0 0;
  z-index: 2;
}
.sheet-tabs { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.sheet-tabs::-webkit-scrollbar { display: none; }
.sheet-tabs button {
  flex: none;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13.5px;
  padding: 7px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.sheet-tabs button.on {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.sheet-body {
  overflow-y: auto;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* ---- 通用块 ---- */
.sec { margin: 0 0 18px; }
.sec:last-child { margin-bottom: 4px; }
.sec-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-3);
  letter-spacing: .02em;
  margin: 0 0 9px;
}
.sec-title b { color: var(--text); font-size: 15px; font-weight: 650; letter-spacing: 0; }

.hero-num {
  font-size: 30px;
  font-weight: 680;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
  margin: 2px 0 4px;
}
.delta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.delta b { font-variant-numeric: tabular-nums; }

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

/* ---- 构成条 ---- */
.stack { display: flex; flex-direction: column; gap: 9px; }
.stack-row { display: grid; grid-template-columns: 88px 1fr auto; gap: 10px; align-items: center; }
.stack-label { font-size: 13px; color: var(--text-2); }
.stack-track { height: 8px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.stack-track i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.stack-val { font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---- 表格 ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left;
  font-weight: 500;
  font-size: 11.5px;
  color: var(--text-3);
  padding: 0 0 7px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
}
.tbl td { padding: 9px 0; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .ccy { color: var(--text-3); font-size: 11.5px; }
.tbl-wrap { overflow-x: auto; }

/* ---- 环形分布 ---- */
.donut-wrap { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.legend { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 7px; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.legend-name { flex: 1; color: var(--text-2); }
.legend-val { font-variant-numeric: tabular-nums; }

/* ---- 柱状 ---- */
.chart { position: relative; }
.bars { width: 100%; display: block; overflow: visible; }
.bars rect { fill: var(--accent); opacity: .82; }
.bars rect.dim { fill: var(--line); opacity: 1; }
.bars rect.today { fill: var(--accent); opacity: 1; }
/* 没有消费的那个月也留一条灰线，否则整张图看着像没加载出来 */
.bars rect.zero { fill: var(--text-3); opacity: .38; }
.axis { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-3); margin-top: 5px; }

/* ---- 持仓明细 ---- */
.pos-list { display: flex; flex-direction: column; gap: 9px; }
.pos {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  background: var(--panel);
}
.pos-top { display: flex; align-items: baseline; gap: 8px; }
.pos-sym { font-weight: 650; font-size: 15px; }
.pos-mkt {
  font-size: 10.5px;
  color: var(--text-3);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 999px;
}
.pos-val { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; }
.pos-nums {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 9px;
  font-size: 12px;
}
.pos-nums div span { display: block; color: var(--text-3); font-size: 10.5px; margin-bottom: 2px; }
.pos-nums div b { font-weight: 560; font-variant-numeric: tabular-nums; }
.pos-flow { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-2);
}
.tag.buy { background: rgba(209, 59, 46, .1); color: var(--up); }
.tag.sell { background: rgba(10, 125, 79, .1); color: var(--down); }

.note {
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.6;
  margin-top: 8px;
}
.sheet-body .empty {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 26px 0;
}
.loading {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 40px 0;
}
.alert {
  font-size: 12.5px;
  color: var(--warn);
  background: rgba(169, 89, 26, .07);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  margin-bottom: 12px;
  line-height: 1.55;
}

/* ---- 自选清单 ---- */
.wlist { display: flex; flex-direction: column; }
.wrow {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 2px;
  background: none;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  cursor: pointer;
}
.wrow:last-child { border-bottom: 0; }
.wrow:active { background: var(--panel-2); }
.w-id { flex: 1; min-width: 0; }
.w-line1 { display: flex; align-items: center; gap: 6px; }
.w-sym { font-weight: 650; font-size: 14.5px; letter-spacing: .2px; }
.w-name {
  display: block;
  color: var(--text-2);
  font-size: 11.5px;
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.w-px { text-align: right; font-variant-numeric: tabular-nums; }
.w-px b { display: block; font-weight: 600; font-size: 14px; }
.w-px i { display: block; font-style: normal; font-size: 11.5px; }
/* 档位徽章：只有今天算过估值的才出现，没算过不占位也不瞎猜 */
.w-tier {
  font-style: normal;
  font-size: 10.5px;
  font-weight: 620;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text-2);
  white-space: nowrap;
}
.w-tier.cheap { background: var(--accent-soft); color: var(--accent); }
.w-tier.pricey { background: rgba(169, 89, 26, .18); color: var(--warn); }
.w-tier.unknown { background: var(--panel-2); color: var(--text-3); }

/* ---- 估值面板 ---- */
.back-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--panel-2);
  border: 0;
  border-radius: 999px;
  padding: 5px 12px 5px 9px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
}
.back-btn.later { margin-left: auto; }
.back-btn:active { opacity: .7; }

.val-head { display: flex; align-items: flex-start; gap: 10px; }
.val-title { flex: 1; min-width: 0; }
.val-sym { font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.val-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.val-px {
  font-size: 19px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.val-verdict { display: flex; align-items: center; gap: 10px; margin: 16px 0 2px; }
.val-badge {
  font-size: 13px;
  font-weight: 650;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
}
.val-badge.cheap { background: var(--accent-soft); color: var(--accent); }
.val-badge.pricey { background: rgba(169, 89, 26, .12); color: var(--warn); }
.val-badge.unknown { background: var(--panel-2); color: var(--text-3); }
.val-score { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.val-score b { font-size: 21px; color: var(--text); margin-right: 2px; }

/* 指标网格：1px 缝隙露出底色当分隔线，比给每格加边框干净 */
.val-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 14px;
}
.val-cell { background: var(--panel); padding: 9px 11px; }
.val-cell span { display: block; font-size: 10.5px; color: var(--text-3); }
.val-cell b { font-size: 14.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.val-cell i { font-style: normal; font-size: 10.5px; color: var(--text-3); margin-left: 5px; }

.val-parts { display: flex; flex-direction: column; gap: 8px; }
.val-part {
  display: grid;
  grid-template-columns: 76px 1fr 48px;
  gap: 9px;
  align-items: center;
  font-size: 12px;
}
.val-part span { color: var(--text-2); }
.val-track { height: 6px; border-radius: 999px; background: var(--panel-2); overflow: hidden; }
.val-track i { display: block; height: 100%; border-radius: 999px; background: var(--accent); }
.val-part em {
  font-style: normal;
  text-align: right;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.val-flags { display: flex; flex-direction: column; gap: 6px; }
.val-flag {
  font-size: 12px;
  line-height: 1.55;
  color: var(--warn);
  background: rgba(169, 89, 26, .07);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}

/* ---- 反向 DCF ---- */
.dcf {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.dcf-head { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; }
.dcf-sub { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.dcf-rows { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; }
.dcf-rows div { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-3); }
.dcf-rows b { color: var(--text-2); font-weight: 560; font-variant-numeric: tabular-nums; }
.dcf-band { margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.dcf-band .dcf-rows div { font-size: 12.5px; }
.dcf-band .dcf-rows b { font-weight: 600; color: var(--text); }

@media (min-width: 700px) {
  .sheet { align-items: center; }
  .sheet-panel {
    max-width: 680px;
    max-height: 84vh;
    border-radius: 18px;
    box-shadow: 0 18px 60px rgba(8, 12, 18, .32);
  }
  .sheet-head { border-radius: 18px 18px 0 0; }
}
