/* ==================================================================
   币涨  |  EarnHub 暖色风格
   设计语言：温暖、圆润、轻质感的 C 端产品
   - 主色 #E8541A（暖橙），点缀暖棕
   - 布局底色 #FDF6F0（奶油），白色卡片 + 14px 圆角 + 暖色浅边框
   - 文本暖棕灰阶（#1C1410 / #6B5A4F / #9A8478）
   - 涨跌遵循国内习惯：涨红 #E8541A 系，跌绿 #2F9E63
   ================================================================== */

/* 本地化 Inter 字体（仅 latin 子集，供数字/英文渲染） */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("./fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ---- 主色（EarnHub 暖橙） ---- */
  --brand: #E8541A;
  --brand-hover: #D04A12;
  --brand-active: #B83E0E;
  --brand-bg: #FEF0EA;          /* 选中/强调的浅橙底 */
  --brand-bg-hover: #FBE0D2;

  /* ---- 语义色 ---- */
  --success: #2F9E63;
  --warning: #E0A23C;
  --error: #D9482B;

  /* ---- 涨跌：国内习惯 涨红跌绿（红用暖橙红，绿用暖绿） ---- */
  --up: #E8541A;
  --down: #2F9E63;
  --warn: #E0A23C;
  --up-bg: #FEF0EA;
  --down-bg: #EAF6F0;
  --warn-bg: #FBF3E0;
  --up-lt: #E8541A;
  --down-lt: #2F9E63;
  --warn-lt: #E0A23C;

  /* ---- 文本暖棕灰阶 ---- */
  --text: #1C1410;
  --text-2: #6B5A4F;
  --text-3: #9A8478;
  --text-4: #C4B4A9;

  /* ---- 边框与填充 ---- */
  --line: #E3D8CE;
  --line-2: #F0E8E0;
  --fill: rgba(28, 20, 16, .045);
  --fill-2: rgba(28, 20, 16, .08);

  /* ---- 表面 ---- */
  --bg: #FDF6F0;
  --card: #FFFFFF;
  --tint: #FBF4EC;

  /* ---- 圆角（更圆润） ---- */
  --r-lg: 14px;
  --r: 14px;
  --r-sm: 10px;

  /* ---- 阴影（暖色柔和投影） ---- */
  --sh-1: 0 1px 2px 0 rgba(28, 20, 16, .04), 0 2px 8px -2px rgba(28, 20, 16, .05);
  --sh-2: 0 8px 24px -6px rgba(28, 20, 16, .14), 0 3px 8px -4px rgba(28, 20, 16, .10);
  --sh-brand: 0 2px 0 rgba(232, 84, 26, .12);

  --sidebar-w: 216px;
  --topbar-h: 60px;
}

/* ============================ 暗夜模式 ============================ */
/* 通过 <html data-theme="dark"> 切换，顶部角标控制。
   暗色配色 = 深蓝灰底 + 柔和琥珀金强调：低饱和、低眩光，长时间盯盘不累眼。
   （旧版为暖棕黑 + 高饱和暖橙，对比过强，久看疲劳） */
[data-theme="dark"] {
  /* 主色：柔和琥珀金（替代高饱和暖橙，保留暖意但降低眩光） */
  --brand: #E0B45F;
  --brand-hover: #F2C87C;
  --brand-active: #C79A45;
  --brand-bg: rgba(224, 180, 95, .14);
  --brand-bg-hover: rgba(224, 180, 95, .22);

  /* 涨跌：国内习惯涨红跌绿；暗底用中低饱和的珊瑚红/青绿，辨识度高又不刺眼 */
  --up: #E8735E;
  --down: #4FBF8B;
  --warn: #E0B45F;
  --up-bg: rgba(232, 115, 94, .16);
  --down-bg: rgba(79, 191, 139, .16);
  --warn-bg: rgba(224, 180, 95, .16);
  --up-lt: #E8735E;
  --down-lt: #4FBF8B;
  --warn-lt: #E0B45F;

  /* 文本冷灰阶（不用纯白，减轻眩光与光晕） */
  --text: #E6EDF1;
  --text-2: #9FAFB9;
  --text-3: #74848F;
  --text-4: #56646D;

  /* 边框与填充：冷调半透明，弱化硬边 */
  --line: rgba(180, 202, 211, .17);
  --line-2: rgba(180, 202, 211, .10);
  --fill: rgba(255, 255, 255, .05);
  --fill-2: rgba(255, 255, 255, .09);

  /* 表面：深蓝灰（比纯黑柔和，长时看不累） */
  --bg: #10171F;
  --card: #18232D;
  --tint: #1D2A35;

  /* 阴影：冷色、更扩散，避免硬黑块 */
  --sh-1: 0 1px 2px 0 rgba(3, 10, 15, .40), 0 2px 8px -2px rgba(3, 10, 15, .28);
  --sh-2: 0 14px 40px -8px rgba(3, 10, 15, .46), 0 3px 8px -4px rgba(3, 10, 15, .36);
  --sh-brand: 0 8px 22px rgba(224, 180, 95, .16);

  /* 顶栏毛玻璃底色（暗色半透明） */
  --topbar-bg: rgba(16, 23, 31, .82);
  /* 输入框/卡片纯白底在暗色下统一走 card */
}

/* 暗夜模式：登录页光晕/网格改为冷调（否则太亮刺眼） */
[data-theme="dark"] .login-glow-a { background: radial-gradient(circle, rgba(224, 180, 95, .13) 0%, transparent 70%); }
[data-theme="dark"] .login-glow-b { background: radial-gradient(circle, rgba(91, 155, 184, .12) 0%, transparent 70%); }
[data-theme="dark"] .login-grid {
  background-image:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
}
/* 暗夜模式下 notice 边框与 login-err 边框统一暗色 */
[data-theme="dark"] .notice { border-color: rgba(224, 180, 95, .32); }
[data-theme="dark"] .login-err { border-color: rgba(232, 115, 94, .35); }
[data-theme="dark"] .btn.danger { background: transparent; border-color: rgba(232, 115, 94, .4); }
/* 遮罩在暗夜模式下更黑 */
[data-theme="dark"] .scrim { background: rgba(4, 9, 14, .62); }

/* 暗夜模式：价格跳动闪烁改用暗色涨跌色（原动画硬编码了浅色暖橙/暖绿） */
[data-theme="dark"] .coin-card.flash-up { animation: flashUpDark .6s ease-out; }
[data-theme="dark"] .coin-card.flash-down { animation: flashDownDark .6s ease-out; }
@keyframes flashUpDark {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 115, 94, 0); background: var(--card); }
  20% { box-shadow: 0 0 0 4px rgba(232, 115, 94, .30); background: rgba(232, 115, 94, .10); }
}
@keyframes flashDownDark {
  0%, 100% { box-shadow: 0 0 0 0 rgba(79, 191, 139, 0); background: var(--card); }
  20% { box-shadow: 0 0 0 4px rgba(79, 191, 139, .30); background: rgba(79, 191, 139, .10); }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

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

/* 金融数字统一等宽，避免跳动 */
.num, .coin-price, .hero-score b, .hero-stats b, .quote-price .val,
.rank-table td, .reso-cell, .calc-cell b, .signal-item .px,
.level-row .px, .metric b, .ft-score, .coin-change, .strategy-score strong,
.rank-badge, .mini-track {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-2); }
.warn { color: var(--warn); }
.up-lt { color: var(--up-lt); }
.down-lt { color: var(--down-lt); }

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

.layout { min-height: 100vh; }

/* ---- 品牌标识 ---- */
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand .brand-img { height: 28px; width: auto; display: block; }
/* 后台 .brand 容器下的 LOGO 双图切换：特异度 ≥ 0,3,0 覆盖上面 */
.brand .brand-img-light { display: block; }
.brand .brand-img-dark { display: none; }
.brand [data-theme="dark"] .brand-img-light,
html[data-theme="dark"] .brand .brand-img-light { display: none; }
.brand [data-theme="dark"] .brand-img-dark,
html[data-theme="dark"] .brand .brand-img-dark { display: block; }
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), var(--brand-active));
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px;
  box-shadow: 0 4px 10px -2px rgba(232, 84, 26, .45);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text b { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.brand-text span { font-size: 11px; color: var(--text-3); letter-spacing: .3px; }
.brand-logo { width: 20px; height: 20px; display: block; }

/* ---- 侧边栏（暖色：奶油底 + 右侧浅边框） ---- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-w);
  z-index: 70;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--card);
  border-right: 1px solid var(--line-2);
  transition: transform .3s cubic-bezier(.2, .7, .3, 1);
}

.sb-brand {
  display: flex; align-items: center; justify-content: center;
  height: var(--topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--line-2);
}
.sb-brand .brand-img { height: 28px; width: auto; display: block; }
/* LOGO 双图切换：浅色主题用 light 图，深色主题用 dark 图。
   关键：必须用三段选择器（特异度 ≥ 0,3,0）才能覆盖上面 .sb-brand .brand-img 的 display:block */
.brand-img-light { display: block; }
.brand-img-dark { display: none; }
.sb-brand .brand-img-light,
.topbar-logo.brand-img-light { display: block; }
.sb-brand .brand-img-dark,
.topbar-logo.brand-img-dark { display: none; }
.sb-brand [data-theme="dark"] .brand-img-light,
.topbar [data-theme="dark"] .brand-img-light,
html[data-theme="dark"] .sb-brand .brand-img-light,
html[data-theme="dark"] .topbar-logo.brand-img-light { display: none; }
.sb-brand [data-theme="dark"] .brand-img-dark,
.topbar [data-theme="dark"] .brand-img-dark,
html[data-theme="dark"] .sb-brand .brand-img-dark,
html[data-theme="dark"] .topbar-logo.brand-img-dark { display: block; }
.sb-brand .brand-mark { width: 32px; height: 32px; border-radius: 9px; font-size: 15px; }
.sb-brand .brand-text b { font-size: 14px; }
.sb-brand .brand-text span { font-size: 10.5px; }

/* 侧边栏垂直导航 */
.sidebar .nav { display: flex; flex-direction: column; align-items: stretch; gap: 4px; margin: 0; padding: 14px 12px; overflow-y: auto; flex: 1; }
.sidebar .nav button[hidden] { display: none !important; }   /* hidden 属性比 display:flex 优先级低，必须 !important 覆盖 */
.sidebar .nav button {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 10px 14px; border-radius: 10px;
  color: var(--text-2);
  font-size: 14px; font-weight: 500;
  background: transparent; box-shadow: none; border: 0;
  transition: background .2s, color .2s;
}
.sidebar .nav button svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar .nav button:hover { background: var(--fill); color: var(--text); }
.sidebar .nav button.active {
  background: var(--brand-bg);
  color: var(--brand);
  font-weight: 600;
  box-shadow: none;
}

/* ---- 右侧内容 ---- */
.content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ---- 顶栏（奶油底 + 底部浅边框，60px） ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  background: var(--topbar-bg, rgba(253, 246, 240, .86));
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--line-2);
  transition: box-shadow .25s, border-color .25s;
}
.topbar.scrolled {
  box-shadow: 0 2px 12px -4px rgba(28, 20, 16, .12);
  border-bottom-color: transparent;
}

.menu-toggle { display: none; }

/* 顶栏 LOGO：只在移动端显示（PC 端侧边栏已有 LOGO） */
.topbar-logo { display: none; height: 26px; width: auto; }

.crumb {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--text-3); white-space: nowrap;
}
.crumb em { font-style: normal; color: var(--text-4); }
.crumb b { font-weight: 600; color: var(--text); }

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

/* ---- 移动端抽屉遮罩 ---- */
.scrim {
  position: fixed; inset: 0; z-index: 65;
  background: rgba(28, 20, 16, .45);
  opacity: 0; visibility: hidden;
  transition: opacity .28s, visibility .28s;
}
.scrim.show { opacity: 1; visibility: visible; }
/* 宽屏（>900px）侧栏常驻：隐藏汉堡按钮并彻底禁用遮罩，
   否则点击汉堡只会弹出一层全屏黑色遮罩（视觉上等于「黑屏」） */
@media (min-width: 901px) {
  #menuToggle { display: none; }
  .scrim { display: none; }
}

/* ============================ 按钮 ============================ */

.btn {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 5px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  line-height: 22px;
  transition: all .2s cubic-bezier(.4, 0, .2, 1);
  white-space: nowrap;
}
.btn:hover { color: var(--brand-hover); border-color: var(--brand-hover); }
.btn.primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 4px 12px -3px rgba(232, 84, 26, .5);
}
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn.primary:active { background: var(--brand-active); border-color: var(--brand-active); }
.btn:disabled { color: var(--text-4); border-color: var(--line-2); background: var(--fill); cursor: not-allowed; box-shadow: none; }
.btn.small { padding: 2px 10px; font-size: 13px; line-height: 22px; }
.btn.danger { color: var(--error); border-color: #F0B9A9; background: var(--card); }
.btn.danger:hover { color: var(--error); border-color: var(--error); background: #FDF0EB; }
.btn.block { display: block; width: 100%; }

.icon-btn {
  position: relative;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border: 0; background: transparent; border-radius: 10px;
  color: var(--text-2); transition: all .2s;
}
.icon-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* 主题切换角标：白天显示月亮（点击切到黑夜），黑夜显示太阳（点击切回白天） */
.theme-toggle svg { width: 19px; height: 19px; }
.theme-toggle .icon-moon { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.icon-btn .badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--error); color: #fff;
  border-radius: 999px; font-size: 10px; font-style: normal; font-weight: 700;
  display: flex; align-items: center; justify-content: center; line-height: 1;
  box-sizing: content-box; box-shadow: 0 0 0 2px #fff;
}

/* 状态徽标 */
.src-badge, .rt-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 11px; border-radius: 999px;
  background: var(--fill); color: var(--text-2);
  font-size: 12px; white-space: nowrap;
  border: 1px solid transparent;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--down); flex-shrink: 0; }
.dot.busy { background: var(--warning); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.rt-badge .dot { background: var(--text-4); }
.rt-badge.live { color: var(--down); background: var(--down-bg); }
.rt-badge.live .dot { background: var(--down); }
.rt-badge.connecting { color: var(--warn); background: var(--warn-bg); }
.rt-badge.connecting .dot { background: var(--warn); animation: pulse 1s infinite; }
.rt-badge.error { color: var(--up); background: var(--up-bg); }
.rt-badge.error .dot { background: var(--up); }

/* ============================ 主体 ============================ */

.main {
  flex: 1;
  width: 100%;
  padding: 24px;
}
/* 带鱼屏/超宽屏：不再限制最大宽度，内容铺满可用空间，消除两侧留白 */
@media (min-width: 1600px) {
  .main { max-width: none; margin: 0; padding: 28px 32px; }
}

.page { display: none; }
.page.active { display: block; animation: rise .28s cubic-bezier(.2, .7, .3, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.panel {
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  box-shadow: var(--sh-1);
  padding: 20px 24px;
  margin-bottom: 16px;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 16px;
}
.panel-head h2, .panel-head h3 {
  margin: 0; font-size: 16px; font-weight: 700; line-height: 24px;
  color: var(--text);
}
.panel-head h3 { font-size: 14px; }
.panel-head p { margin: 4px 0 0; font-size: 13px; color: var(--text-3); }
.panel-head .sub { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ============================ 市场情绪 Hero ============================ */

.hero {
  position: relative;
  background: linear-gradient(135deg, #FFF7F0, #FFFBF6);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--sh-1);
  display: grid;
  grid-template-columns: minmax(240px, 1.25fr) minmax(260px, 1fr);
  gap: 28px;
  align-items: center;
}

.hero-main { min-width: 0; }
.hero-label { font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.hero-score { display: flex; align-items: baseline; gap: 8px; }
.hero-score b { font-size: 22px; font-weight: 700; }
.hero-score span { font-size: 38px; font-weight: 800; letter-spacing: -1px; line-height: 1; color: var(--brand); }
.hero-score em { font-style: normal; font-size: 13px; color: var(--text-3); }

.hero-bar {
  display: flex; height: 8px; border-radius: 999px; overflow: hidden;
  margin: 16px 0 9px; background: var(--fill);
}
.hero-bar i { display: block; height: 100%; transition: width .6s cubic-bezier(.22,.61,.36,1); }
.hero-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); }
.hero-legend span { display: inline-flex; align-items: center; gap: 6px; }
.hero-legend i { width: 8px; height: 8px; border-radius: 2px; }

.hero-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.hero-stats div {
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--sh-1);
}
.hero-stats span { display: block; font-size: 12px; color: var(--text-3); }
.hero-stats b {
  display: block; font-size: 20px; font-weight: 700; margin-top: 4px;
  letter-spacing: -.2px; font-variant-numeric: tabular-nums;
}

/* ============================ 工具条 ============================ */

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.search {
  flex: 1; min-width: 190px;
  display: flex; align-items: center; gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 14px;
  transition: all .2s;
}
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232, 84, 26, .12); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 14px; line-height: 22px; }
.search svg { flex-shrink: 0; opacity: .45; }

.seg { display: inline-flex; background: var(--fill); border-radius: 999px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--text-2);
  padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  line-height: 20px; transition: all .2s; white-space: nowrap;
}
.seg button:hover { color: var(--text); }
.seg button.active {
  background: var(--card); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 3px rgba(28, 20, 16, .12);
}

/* ============================ 币种卡片 ============================ */

.market-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(246px, 1fr)); gap: 14px; }

/* 带鱼屏/超宽屏：行情卡片自适应加宽，充分利用横向空间 */
@media (min-width: 1600px) {
  .market-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
}
@media (min-width: 2200px) {
  .market-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
}

.coin-card {
  position: relative;
  overflow: hidden;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 16px 18px 12px;
  box-shadow: var(--sh-1);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.coin-card:hover {
  border-color: var(--brand);
  box-shadow: var(--sh-2);
  transform: translateY(-2px);
}
/* 实时价格变动高亮（涨红跌绿，国内习惯） */
.coin-card.flash-up { animation: flashUp .6s ease-out; }
.coin-card.flash-down { animation: flashDown .6s ease-out; }
@keyframes flashUp {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 84, 26, 0); background: var(--card); }
  20% { box-shadow: 0 0 0 4px rgba(232, 84, 26, .35); background: rgba(232, 84, 26, .10); }
}
@keyframes flashDown {
  0%, 100% { box-shadow: 0 0 0 0 rgba(47, 158, 99, 0); background: var(--card); }
  20% { box-shadow: 0 0 0 4px rgba(47, 158, 99, .35); background: rgba(47, 158, 99, .10); }
}

/* ---- 币种置顶：卡片右上角图钉（置顶后固定排在最前） ---- */
.coin-cell { position: relative; display: flex; }
.coin-cell > .coin-card { flex: 1 1 auto; width: 100%; }

/* 给右上角图钉留出空间，避免遮挡涨跌幅数字 */
.coin-card .coin-top { padding-right: 26px; }

.coin-pin {
  position: absolute;
  top: 10px; right: 11px;
  z-index: 2;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  color: var(--text-3);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  opacity: 0;                 /* 默认隐藏，指针悬停卡片时才显现，不干扰阅读 */
  transition: opacity .18s ease, color .18s ease, background .18s ease, border-color .18s ease;
}
.coin-cell:hover .coin-pin { opacity: .55; }
.coin-pin:hover { opacity: 1; color: var(--brand); background: var(--brand-bg); border-color: var(--brand); }
/* 已置顶：常显 + 主色高亮 */
.coin-pin.on { opacity: 1; color: var(--brand); background: var(--brand-bg); border-color: var(--brand); }
.coin-pin.on:hover { color: var(--brand-hover); background: var(--brand-bg-hover); }
/* 触屏无 hover，图钉保持半透明常显，否则无法点击 */
@media (hover: none) {
  .coin-pin { opacity: .45; }
  .coin-pin.on { opacity: 1; }
}

/* 置顶卡片：左侧主色竖条 + 边框高亮，一眼能认出 */
.coin-card.pinned {
  border-color: var(--brand);
  box-shadow: var(--sh-1), inset 3px 0 0 var(--brand);
}
.coin-card.pinned:hover {
  border-color: var(--brand);
  box-shadow: var(--sh-2), inset 3px 0 0 var(--brand);
}

/* 头部「取消置顶」按钮：hidden 兜底（防止 display 类覆盖 UA 默认） */
#clearPins[hidden] { display: none !important; }

.coin-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.coin-sym { font-weight: 700; font-size: 15px; letter-spacing: .3px; display: inline-flex; align-items: center; gap: 8px; min-width: 0; flex: 1 1 auto; }
.coin-sym .coin-sym-name { display: inline-flex; align-items: baseline; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.coin-sym small { color: var(--text-3); font-weight: 500; font-size: 11.5px; }
.coin-change {
  font-size: 12.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  font-variant-numeric: tabular-nums;
  flex: none; white-space: nowrap;
}
.coin-change.up { background: var(--up-bg); color: var(--up); }
.coin-change.down { background: var(--down-bg); color: var(--down); }

/* 币种 LOGO 图标 */
.coin-icon {
  width: 26px; height: 26px; flex: none;
  border-radius: 50%; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fill);
  vertical-align: middle;
}
.coin-icon img { width: 100%; height: 100%; object-fit: contain; display: block; }
.coin-icon .coin-icon-fallback {
  display: none; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  font-style: normal; font-weight: 700; font-size: 12px;
  color: var(--brand);
  background: var(--brand-bg);
}
.coin-icon.noimg .coin-icon-fallback { display: flex; }

.coin-price { font-size: 24px; font-weight: 700; margin-top: 8px; letter-spacing: -.5px; }

.spark { display: block; width: 100%; height: 36px; margin: 7px 0 3px; overflow: visible; }

.prob-bar { display: flex; height: 5px; border-radius: 999px; overflow: hidden; margin: 8px 0 10px; background: var(--fill); }
.prob-bar i { display: block; height: 100%; transition: width .5s; }

.coin-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); }

.coin-rec {
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-2);
  font-size: 12px; color: var(--text-2); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ============================ 标签 ============================ */

.tag {
  display: inline-flex; align-items: center;
  padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 21px;
  background: var(--fill); color: var(--text-2);
  border: 1px solid transparent;
}
.tag.up { background: var(--up-bg); color: var(--up); }
.tag.down { background: var(--down-bg); color: var(--down); }
.tag.warn { background: var(--warn-bg); color: #B9801C; }
.tag.brand { background: var(--brand-bg); color: var(--brand); }
.tag.ok { background: var(--down-bg); color: var(--down); }
.tag.off { background: var(--fill); color: var(--text-3); }

/* ============================ 信号流 ============================ */

.signal-feed { display: flex; flex-direction: column; gap: 8px; max-height: 340px; overflow-y: auto; }
.signal-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 12px;
  background: var(--tint); border: 1px solid var(--line-2);
  font-size: 13px; transition: all .2s;
}
.signal-item:hover { background: var(--card); box-shadow: var(--sh-1); }
.signal-item .sym { font-weight: 700; min-width: 74px; }
.signal-item .txt { flex: 1; color: var(--text-2); }
.signal-item .px { color: var(--text); font-weight: 600; }
.signal-item .tm { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.signal-item .go {
  border: 0; background: var(--brand-bg); color: var(--brand);
  padding: 3px 13px; border-radius: 999px; font-size: 12px; font-weight: 600;
  line-height: 20px; white-space: nowrap; transition: all .2s;
}
.signal-item .go:hover { background: var(--brand); color: #fff; }

/* ============================ 研判页 ============================ */

.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; border: 1px solid var(--line); background: var(--card); color: var(--text-2);
  padding: 5px 16px; border-radius: 999px; font-size: 13px; font-weight: 500;
  line-height: 22px; transition: all .2s;
}
.chip:hover { color: var(--brand-hover); border-color: var(--brand-hover); }
.chip.active {
  background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600;
  box-shadow: 0 4px 12px -3px rgba(232, 84, 26, .5);
}

.quote-panel { background: var(--card); }

.quote-head {
  display: grid;
  grid-template-columns: minmax(200px, 1.05fr) minmax(190px, 1fr) minmax(200px, 1.1fr);
  gap: 26px;
  align-items: center;
}
.quote-price .sym { font-size: 12px; color: var(--text-3); letter-spacing: .4px; display: flex; align-items: center; gap: 8px; }
.quote-price .sym .coin-icon { width: 30px; height: 30px; }
.quote-price .val { font-size: 38px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; margin: 2px 0 4px; }
.quote-price .chg { font-size: 14px; font-weight: 600; }

.score-box { display: flex; align-items: center; gap: 16px; }
.score-ring { width: 80px; height: 80px; flex-shrink: 0; }
.score-info b { display: block; font-size: 20px; font-weight: 700; }
.score-info span { font-size: 12px; color: var(--text-3); }

.plan-box { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.plan-item { background: var(--tint); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px 14px; }
.plan-item span { display: block; font-size: 12px; color: var(--text-3); }
.plan-item b { font-size: 16px; font-weight: 700; }
.plan-item em { font-style: normal; font-size: 12px; color: var(--text-2); }
.plan-item .go {
  border: 0; background: var(--brand); color: #fff;
  padding: 3px 13px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 20px;
}
.plan-item .go:hover { background: var(--brand-hover); }

.frame-tabs { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.frame-tab {
  flex: 1; min-width: 150px; text-align: left;
  border: 1px solid var(--line-2); background: var(--card); border-radius: 12px;
  padding: 12px 16px; transition: all .2s;
}
.frame-tab:hover { border-color: var(--brand); }
.frame-tab.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(232, 84, 26, .12);
}
.frame-tab .ft-name { font-size: 12px; color: var(--text-3); display: flex; justify-content: space-between; gap: 8px; }
.frame-tab .ft-score { font-size: 18px; font-weight: 700; margin-top: 3px; letter-spacing: -.3px; }
.frame-tab .ft-sub { font-size: 12px; color: var(--text-3); }

/* K 线 */
.chart-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.chart-bar .seg button { padding: 4px 13px; font-size: 12px; }
.chart-toggle { display: flex; gap: 14px; margin-left: auto; flex-wrap: wrap; }
.chart-toggle label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-2); cursor: pointer; user-select: none;
}
.chart-toggle input { accent-color: var(--brand); width: 14px; height: 14px; }

.kline-box {
  position: relative; width: 100%;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 4px;
}
.kline-box canvas { display: block; width: 100%; border-radius: 10px; touch-action: none; }
.kline-tip {
  position: absolute; pointer-events: none;
  background: rgba(28, 20, 16, .88); color: #fff;
  padding: 6px 10px; border-radius: 8px; font-size: 12px; line-height: 1.6;
  white-space: nowrap; z-index: 5; display: none;
  box-shadow: var(--sh-2);
}
.kline-tip.show { display: block; }
.kline-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-3); margin-top: 10px; flex-wrap: wrap; }
.kline-legend i { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 5px; border-radius: 2px; }

/* 指标网格 */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 10px; }
.metric {
  border: 1px solid var(--line-2); border-radius: 12px;
  padding: 10px 14px; background: var(--tint);
  transition: all .2s;
}
.metric:hover { background: var(--card); box-shadow: var(--sh-1); }
.metric span { display: block; font-size: 12px; color: var(--text-3); }
.metric b { display: block; font-size: 14px; font-weight: 600; margin-top: 3px; word-break: break-all; }
.metric em { display: block; font-style: normal; font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* 支撑阻力 */
.level-list { display: flex; flex-direction: column; gap: 6px; }
.level-row {
  display: grid; grid-template-columns: 1fr auto auto;
  gap: 12px; align-items: center;
  padding: 9px 14px; border-radius: 12px;
  background: var(--tint); border: 1px solid var(--line-2);
  font-size: 13px;
}
.level-row.r { border-left: 3px solid var(--up); }
.level-row.s { border-left: 3px solid var(--down); }
.level-row.now { border-left: 3px solid var(--brand); background: var(--brand-bg); font-weight: 600; }
.level-row.fib { border-left: 3px solid var(--warn); }
.level-row .lbl { color: var(--text-2); font-size: 12px; }
.level-row .px { font-weight: 600; }
.level-row .pct { font-size: 12px; color: var(--text-3); min-width: 74px; text-align: right; }
.level-row .pct .act {
  border: 0; background: transparent; font-size: 14px; padding: 0 3px;
  line-height: 1; vertical-align: middle; transition: transform .15s;
}
.level-row .pct .act:hover { transform: scale(1.25); }

/* 理由列表 */
.reason-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.reason-list li {
  display: flex; gap: 10px; align-items: flex-start;
  font-size: 13px; color: var(--text-2);
  padding: 8px 13px; background: var(--tint); border-radius: 12px;
  border: 1px solid var(--line-2);
}
.reason-list li i { font-style: normal; flex-shrink: 0; width: 16px; text-align: center; }

/* ============================ 策略页 ============================ */

.strategy-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr)); gap: 14px; }
.strategy-card {
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 16px; box-shadow: var(--sh-1); transition: all .2s;
}
.strategy-card:hover { border-color: var(--brand); box-shadow: var(--sh-2); transform: translateY(-2px); }
.strategy-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.strategy-head b { font-size: 15px; font-weight: 700; }
.strategy-score { text-align: right; }
.strategy-score strong { font-size: 24px; font-weight: 800; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.strategy-score span { display: block; font-size: 12px; color: var(--text-3); margin-top: -4px; }
.strategy-desc { font-size: 12px; color: var(--text-3); margin: 8px 0 11px; line-height: 1.55; }
.score-track { height: 7px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.score-track i { display: block; height: 100%; border-radius: 999px; transition: width .6s cubic-bezier(.22,.61,.36,1); }
.strategy-tip {
  margin-top: 12px; padding: 10px 13px; border-radius: 12px;
  background: var(--brand-bg); font-size: 12px; color: var(--brand-active); line-height: 1.55;
}

.rank-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rank-table th {
  text-align: left; font-weight: 600; font-size: 12px; color: var(--text-2);
  letter-spacing: .3px; padding: 10px 12px; border-bottom: 1px solid var(--line-2);
  background: var(--tint); white-space: nowrap;
}
.rank-table td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.rank-table tbody tr { transition: background .2s; }
.rank-table tbody tr:hover { background: var(--tint); }
.rank-badge {
  display: inline-block; min-width: 44px; text-align: center;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.rank-badge.bullish { background: var(--up-bg); color: var(--up); }
.rank-badge.bearish { background: var(--down-bg); color: var(--down); }
.rank-badge.neutral { background: var(--fill); color: var(--text-2); }

.mini-track { width: 80px; height: 6px; border-radius: 999px; background: var(--fill); overflow: hidden; display: inline-block; vertical-align: middle; }
.mini-track i { display: block; height: 100%; border-radius: 999px; }

/* 共振矩阵 */
.reso-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.reso-table th {
  text-align: center; font-weight: 600; font-size: 12px; color: var(--text-2);
  letter-spacing: .3px; padding: 10px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
}
.reso-table th:first-child, .reso-table td:first-child { text-align: left; }
.reso-table td { padding: 10px; border-bottom: 1px solid var(--line-2); text-align: center; white-space: nowrap; }
.reso-table tbody tr { transition: background .2s; }
.reso-table tbody tr:hover { background: var(--tint); }
.reso-cell {
  display: inline-block; min-width: 56px; padding: 2px 11px;
  border-radius: 999px; font-weight: 600;
}
.reso-cell.bullish { background: var(--up-bg); color: var(--up); }
.reso-cell.bearish { background: var(--down-bg); color: var(--down); }
.reso-cell.neutral { background: var(--fill); color: var(--text-2); }
.reso-tag {
  display: inline-block; padding: 2px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.reso-tag.syn-long { background: var(--up); color: #fff; }
.reso-tag.syn-short { background: var(--down); color: #fff; }
.reso-tag.diverge { background: var(--warn-bg); color: #B9801C; }

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

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field span { font-size: 13px; color: var(--text-2); font-weight: 500; }
.field input, .field select {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 5px 12px; font-size: 14px; line-height: 22px; outline: 0; background: var(--card);
  transition: all .2s; width: 100%;
}
.field input:hover, .field select:hover { border-color: var(--brand-hover); }
.field input:focus, .field select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(232, 84, 26, .12);
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---- 实时监控 ---- */
.rt-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.switch-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--tint);
  font-size: 13px; color: var(--text);
  cursor: pointer;
}
.switch-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
.panel-sub { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.panel-sub h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--text); }
.event-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.event-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--card); font-size: 12.5px;
}
.event-item .sym { font-weight: 700; color: var(--text); flex-shrink: 0; }
.event-item .tag { flex-shrink: 0; padding: 0 9px; border-radius: 999px; font-size: 12px; background: var(--fill); color: var(--text-2); }
.event-item.dir .tag { background: var(--up-bg); color: var(--up); }
.event-item.signal .tag { background: var(--brand-bg); color: var(--brand); }
.event-item.rapid .tag { background: var(--warn-bg); color: #B9801C; }
.event-item .txt { flex: 1; color: var(--text-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-item .tm { flex-shrink: 0; color: var(--text-3); font-size: 12px; }
.hint { margin: 12px 0 0; font-size: 12px; color: var(--text-3); }

/* ============================ 计算结果 ============================ */

.calc-result {
  border-top: 1px solid var(--line-2); padding-top: 16px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.calc-cell { background: var(--tint); border: 1px solid var(--line-2); border-radius: 12px; padding: 11px 14px; }
.calc-cell span { display: block; font-size: 12px; color: var(--text-3); }
.calc-cell b { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.calc-cell em { display: block; font-style: normal; font-size: 12px; color: var(--text-2); margin-top: 1px; }
.calc-cell.hi { background: var(--brand-bg); border-color: transparent; }
.calc-cell.hi span { color: var(--brand); }
.calc-cell.hi b { color: var(--brand); }
.calc-cell.hi em { color: var(--brand-hover); }
.calc-warn { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.calc-warn p { margin: 0; padding: 8px 12px; border-radius: 10px; font-size: 12px; line-height: 1.55; }
.calc-warn p.warn { background: var(--warn-bg); border: 1px solid #F0D89A; color: #B9801C; }
.calc-warn p.bad { background: var(--up-bg); border: 1px solid #F0B9A9; color: var(--up); }
.calc-warn p.good { background: var(--down-bg); border: 1px solid #A9DCC0; color: var(--down); }

/* ============================ 预警 / 自选 ============================ */

.alert-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--tint); margin-bottom: 8px;
  transition: all .2s;
}
.alert-item:hover { background: var(--card); box-shadow: var(--sh-1); }
.alert-item.hit { background: var(--down-bg); border-color: #A9DCC0; }
.alert-item.off { opacity: .55; }
.alert-main { flex: 1; min-width: 0; }
.alert-main b { font-size: 13.5px; }
.alert-main span { display: block; font-size: 12px; color: var(--text-3); margin-top: 1px; }
.alert-item .act {
  border: 0; background: transparent; color: var(--text-3);
  font-size: 13px; padding: 4px 8px; border-radius: 999px; white-space: nowrap; transition: all .2s;
}
.alert-item .act:hover { background: var(--brand-bg); color: var(--brand); }
.alert-item .act.del:hover { background: var(--up-bg); color: var(--up); }

.watch-list { display: flex; flex-wrap: wrap; gap: 8px; }
.watch-item {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 11px 5px 15px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--card); font-size: 13px;
  transition: all .2s;
}
.watch-item:hover { border-color: var(--brand); }
.watch-item b { font-weight: 600; }
.watch-item button { border: 0; background: transparent; color: var(--text-4); font-size: 16px; line-height: 1; padding: 0 2px; }
.watch-item button:hover { color: var(--error); }

/* ============================ 状态 ============================ */

.empty { text-align: center; padding: 48px 20px; color: var(--text-3); font-size: 13px; }
.empty.sm { padding: 24px 16px; font-size: 12.5px; }
.spinner {
  width: 24px; height: 24px; margin: 0 auto 14px;
  border: 2px solid var(--fill-2); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.notice {
  background: var(--brand-bg); color: var(--brand-active);
  border: 1px solid #F7C8AF;
  padding: 9px 15px; border-radius: 12px; font-size: 13px;
  margin-top: 14px; margin-bottom: 0; line-height: 1.55;
}

.foot-note { text-align: center; font-size: 12px; color: var(--text-4); padding: 10px 0 0; line-height: 1.75; }

.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translate(-50%, 22px);
  background: rgba(28, 20, 16, .88); color: #fff;
  padding: 9px 20px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .28s cubic-bezier(.2, .7, .3, 1); z-index: 200;
  max-width: 86vw; text-align: center;
  box-shadow: var(--sh-2);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ==================================================================
   用户系统 · 登录页 / 用户菜单 / 弹窗 / 后台管理
   ================================================================== */

/* ---------- 登录页（分栏式：左品牌 / 右登录卡） ---------- */
.login-body {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  overflow-x: hidden;
  background: var(--bg);
}

/* 背景装饰层：双光晕 + 网格纹理（均不响应点击） */
.login-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.login-glow { position: absolute; border-radius: 50%; filter: blur(90px); }
.login-glow-a {
  width: 640px; height: 640px; top: -230px; right: -150px;
  background: radial-gradient(circle, rgba(232, 84, 26, .15) 0%, transparent 70%);
}
.login-glow-b {
  width: 540px; height: 540px; bottom: -210px; left: -130px;
  background: radial-gradient(circle, rgba(47, 158, 99, .13) 0%, transparent 70%);
}
.login-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(28, 20, 16, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 20, 16, .05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse 78% 62% at 50% 42%, #000 15%, transparent 76%);
  mask-image: radial-gradient(ellipse 78% 62% at 50% 42%, #000 15%, transparent 76%);
}

.login-shell {
  position: relative; z-index: 1;
  width: 100%; max-width: 452px;
  display: flex; align-items: center; justify-content: center;
  padding: 44px 20px;
  margin: 0 auto;
}

/* ---- 登录卡（页面唯一内容，不展示任何系统介绍） ---- */
.login-main { position: relative; display: flex; justify-content: center; width: 100%; min-width: 0; }
.login-card {
  position: relative;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 22px;
  padding: 40px 36px 36px;
  box-shadow: var(--sh-2);
  animation: loginRise .75s cubic-bezier(.2, .7, .3, 1) both;
}
/* 卡片顶部一道渐变高光，提升精致感 */
.login-card::before {
  content: ''; position: absolute; top: 0; left: 26px; right: 26px; height: 1px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
  opacity: .6;
}

/* 抽象几何标识：纯装饰图形，无文字、无品牌含义 */
.login-mark {
  width: 58px; height: 58px; margin: 0 auto 22px;
  border-radius: 17px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-active));
  box-shadow: var(--sh-brand);
}
.login-mark svg { width: 30px; height: 30px; }

.login-head { margin-bottom: 26px; text-align: center; }
.login-head h2 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: .06em; color: var(--text); }

/* 输入框：左侧图标 + 聚焦光晕 */
.login-form .field { margin-bottom: 18px; }
.login-form .input-wrap {
  position: relative; display: block;
  font-size: 14px; font-weight: 400; color: var(--text-2);   /* 抵消 .field span 的继承 */
}
.login-form .input-wrap .input-ico {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-3); pointer-events: none;
  transition: color .2s ease;
}
.login-form .input-wrap input {
  height: 46px; padding: 0 44px 0 40px; border-radius: 12px;
  background: var(--tint); border-color: var(--line-2);
}
.login-form .input-wrap input:focus { box-shadow: 0 0 0 3px var(--brand-bg); }
.login-form .input-wrap input:focus + .pw-eye,
.login-form .input-wrap:focus-within .input-ico { color: var(--brand); }
.login-form .input-wrap input::placeholder { color: var(--text-4); }

/* 密码明文切换 */
.pw-eye {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); background: transparent; border: 0; border-radius: 8px;
  transition: color .18s ease, background .18s ease;
}
.pw-eye:hover { color: var(--brand); background: var(--brand-bg); }
.pw-eye svg { width: 16px; height: 16px; }
.pw-eye .eye-off { display: none; }
.pw-eye.on .eye-open { display: none; }
.pw-eye.on .eye-off { display: block; }

/* 登录按钮：渐变 + 悬浮微抬 */
.login-submit {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; margin-top: 10px; border: 0; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-active));
  color: #fff; font-size: 15px; font-weight: 650; letter-spacing: .12em;
  box-shadow: var(--sh-brand);
  transition: transform .18s ease, box-shadow .18s ease, filter .18s ease;
}
.login-submit:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: var(--sh-2); }
.login-submit:active { transform: translateY(0); }
.login-submit svg { width: 17px; height: 17px; transition: transform .18s ease; }
.login-submit:hover svg { transform: translateX(3px); }

.login-err {
  background: var(--up-bg); color: var(--up); border: 1px solid var(--up);
  border-radius: 12px; padding: 10px 13px; font-size: 13px; margin-bottom: 18px;
}
.login-tip { margin: 18px 0 0; text-align: center; font-size: 12px; color: var(--text-3); }

/* 主题切换：固定在视口右上角 */
.login-theme { position: fixed; top: 16px; right: 16px; z-index: 20; }

@keyframes loginRise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- 顶栏用户区 ---------- */
.user-box { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px;
  background: transparent; border: 1px solid transparent;
  border-radius: 999px; padding: 4px 10px 4px 4px;
  cursor: pointer; color: var(--text); font-size: 14px;
  transition: background .2s;
}
.user-btn:hover { background: var(--fill); }
.user-btn .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-active)); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex: none;
}
.user-btn .user-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .caret { width: 12px; height: 12px; color: var(--text-3); flex: none; }
.user-drop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60;
  background: var(--card); border: 1px solid var(--line-2);
  border-radius: 12px; box-shadow: var(--sh-2);
  padding: 4px; min-width: 160px;
}
.user-drop button {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; padding: 9px 12px;
  border-radius: 10px; font-size: 14px; color: var(--text); cursor: pointer;
}
.user-drop button:hover { background: var(--fill); color: var(--brand); }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(28, 20, 16, .45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 18px 30px; overflow-y: auto;
}
.modal-box {
  background: var(--card); border-radius: var(--r);
  width: 100%; max-width: 560px;
  box-shadow: var(--sh-2);
  animation: modalIn .18s ease-out;
}
@keyframes modalIn { from { transform: translateY(-10px); opacity: 0; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line-2);
}
.modal-head b { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-x {
  background: none; border: 0; font-size: 20px; line-height: 1;
  color: var(--text-3); cursor: pointer; padding: 0 4px;
}
.modal-x:hover { color: var(--text); }
.modal-body { padding: 18px 20px 22px; max-height: 74vh; overflow-y: auto; }
.set-sec { margin-bottom: 8px; }
.set-sec h4 {
  font-size: 13px; color: var(--text); margin: 0 0 10px; font-weight: 700;
  padding-bottom: 7px; border-bottom: 1px solid var(--line-2);
}
.set-sec .field, .set-sec .switch-row { margin-bottom: 12px; }
.sep { border: 0; border-top: 1px solid var(--line-2); margin: 16px 0; }

/* ---------- 后台 ---------- */
.admin-body { background: var(--bg); }
.admin-main { max-width: 1180px; margin: 0 auto; padding: 24px; }
.admin-tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.admin-tabs button {
  background: var(--card); border: 1px solid var(--line-2);
  border-radius: 999px; padding: 6px 16px; font-size: 14px; line-height: 22px;
  color: var(--text-2); cursor: pointer; transition: all .2s;
}
.admin-tabs button:hover { color: var(--brand); border-color: var(--brand); }
.admin-tabs button.active {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 4px 12px -3px rgba(232, 84, 26, .5);
}
.admin-pane { display: block; }
.admin-pane[hidden] { display: none; }
.admin-iframe {
  display: block;
  width: 100%;
  height: calc(100vh - var(--topbar-h) - 100px);
  min-height: 600px;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--card);
}
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.tbl th, .tbl td {
  padding: 12px; text-align: left;
  border-bottom: 1px solid var(--line-2); vertical-align: middle;
}
.tbl th { color: var(--text-2); font-weight: 600; font-size: 13px; background: var(--tint); }
.tbl td .sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tbl td.ops { white-space: nowrap; }
.tbl td.ops .btn { padding: 2px 10px; font-size: 13px; margin-right: 2px; }
.tbl tr:hover td { background: var(--tint); }
code {
  background: var(--fill); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 2px 7px; font-size: 12px;
  color: var(--brand-active); word-break: break-all;
}

/* ---------- 币种管理 ---------- */
.sym-manager { margin-bottom: 14px; }
.sym-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.sym-search {
  flex: 1; max-width: 340px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 14px; font-size: 14px; line-height: 20px;
  background: var(--card); color: var(--text);
}
.sym-search:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-bg); }
.sym-count { font-size: 13px; color: var(--text-3); white-space: nowrap; }
.sym-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  max-height: 320px; overflow-y: auto;
  padding: 4px; margin: 0 -4px;
}
.sym-item {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line-2); border-radius: 999px;
  padding: 5px 6px 5px 12px; background: var(--card);
  cursor: pointer; user-select: none; transition: all .15s;
}
.sym-item:hover { border-color: var(--brand); }
.sym-item input { display: none; }
.sym-item .coin-icon { width: 20px; height: 20px; }
.sym-item .coin-icon .coin-icon-fallback { font-size: 10px; }
.sym-item .sym-label { font-size: 13px; font-weight: 600; color: var(--text); }
.sym-item .sym-name { font-size: 12px; color: var(--text-3); }
.sym-item .sym-x {
  width: 18px; height: 18px; border: 0; border-radius: 50%;
  background: var(--fill); color: var(--text-3); font-size: 13px; line-height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
.sym-item .sym-x:hover { background: var(--error); color: #fff; }
.sym-item.on {
  background: var(--brand-bg); border-color: var(--brand);
}
.sym-item.on .sym-label { color: var(--brand); }
.sym-item.off { opacity: .55; }
.sym-add { display: flex; gap: 8px; align-items: center; }
.sym-add .sym-search { max-width: 420px; }
.sym-empty { width: 100%; padding: 18px; text-align: center; color: var(--text-3); font-size: 13px; }

/* ============================ 响应式 ============================ */

@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; gap: 20px; }
  .hero-stats { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1000px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .quote-head { grid-template-columns: 1fr; gap: 18px; }
}

/* ---- 平板 / 手机：侧边栏收成抽屉 ---- */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 0 0 44px rgba(28, 20, 16, .2);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .sidebar.open { transform: translateX(0); }
  .content { margin-left: 0; }
  .menu-toggle { display: flex; }
  .topbar { padding: 0 15px; }
  .topbar-logo { display: block; }
}

@media (max-width: 720px) {
  .topbar { gap: 8px; }
  .crumb span, .crumb em { display: none; }
  .main { padding: 16px; }
  .panel { padding: 16px; border-radius: 12px; }
  .market-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
  .coin-card { padding: 14px 15px 11px; }
  .coin-price { font-size: 21px; }
  .spark { height: 34px; }
  .quote-price .val { font-size: 32px; }
  .metric-grid { grid-template-columns: repeat(auto-fill, minmax(155px, 1fr)); }
  .frame-tab { min-width: calc(50% - 6px); }
  .strategy-grid { grid-template-columns: 1fr; }
  .toast { bottom: calc(env(safe-area-inset-bottom, 0px) + 18px); }
  .rank-table { font-size: 12px; }
  .rank-table th, .rank-table td { padding: 9px 8px; }
  .src-badge span.long { display: none; }
  .rt-badge span.long { display: none; }
  .rt-controls { grid-template-columns: 1fr; }
  .toolbar { gap: 8px; }
  .user-btn .user-name { display: none; }

  .hero { padding: 16px; margin-bottom: 12px; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .hero-score span { font-size: 32px; }
  .hero-score b { font-size: 20px; }

  .form-grid { grid-template-columns: 1fr; }
  .calc-result { grid-template-columns: 1fr 1fr; }
  .signal-feed { max-height: 300px; }
  .signal-item { flex-wrap: wrap; gap: 6px 12px; }
  .signal-item .txt { flex: 1 1 100%; order: 3; }
  .signal-item .tm { order: 4; margin-left: auto; }
  .chart-toggle { margin-left: 0; width: 100%; }
  .chart-bar .seg { flex: 1; overflow-x: auto; }
  .reso-table { font-size: 12px; }
  .reso-table th, .reso-table td { padding: 9px 5px; }
  .reso-cell { min-width: 44px; padding: 2px 7px; }
  .alert-item { flex-wrap: wrap; }
  .alert-main { flex: 1 1 100%; }
}

@media (max-width: 420px) {
  .market-grid { grid-template-columns: 1fr 1fr; }
  .plan-box { grid-template-columns: 1fr; }
  .score-box { gap: 12px; }
  .calc-result { grid-template-columns: 1fr; }
  .seg button { padding: 4px 11px; font-size: 12px; }
  .form-grid { gap: 12px; }
  .hero-stats { grid-template-columns: 1fr 1fr; }
  .frame-tab { min-width: 100%; }
}

@media (max-width: 720px) {
  .login-card { padding: 26px 20px 22px; }
  .modal-box { max-width: 100%; }
  .modal-mask { padding: 3vh 10px 20px; }
  .admin-tabs button { padding: 5px 14px; font-size: 13px; }
  .admin-main { padding: 16px; }
}

/* ==================================================================
   v16 改造 —— 侧栏底部用户区 + 设置主题卡片 + 内联表单
   ================================================================== */

/* ---- 侧栏底部（账号信息 + 退出登录） ---- */
.sb-foot {
  border-top: 1px solid var(--line-2);
  padding: 12px 12px 16px;
  background: var(--card);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--fill);
}
.sb-user .avatar.sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-active));
  color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex: none;
}
.sb-user-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sb-user-meta b {
  font-size: 14px; color: var(--text); font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-user-meta .sub {
  font-size: 11px; color: var(--text-3);
}
.sb-logout {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 9px 12px;
  background: transparent; border: 1px solid var(--line-2);
  border-radius: 12px;
  color: var(--text-2); font-size: 14px;
  cursor: pointer; transition: all .2s;
}
.sb-logout:hover {
  background: var(--brand-bg);
  border-color: var(--brand);
  color: var(--brand);
}
.sb-logout svg { width: 16px; height: 16px; flex: none; }
.sb-logout:disabled { opacity: .5; cursor: not-allowed; }

/* ---- 设置页主题卡片 ---- */
.theme-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 6px;
}
.theme-card {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: var(--card);
  cursor: pointer;
  transition: all .2s;
}
.theme-card:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: var(--sh-1);
}
.theme-card input { position: absolute; opacity: 0; pointer-events: none; }
.theme-card:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-bg);
  box-shadow: 0 0 0 3px var(--brand-bg);
}
.theme-card-preview {
  display: block; width: 100%; height: 64px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,.06);
  position: relative;
  overflow: hidden;
}
.theme-card-preview.light {
  background: linear-gradient(135deg, #FDF6F0 0%, #FEF0EA 100%);
}
.theme-card-preview.light::after {
  content: '☀ Aa';
  position: absolute; right: 10px; top: 8px;
  color: #E8541A; font-weight: 700; font-size: 12px;
}
.theme-card-preview.dark {
  background: linear-gradient(135deg, #10171F 0%, #1D2A35 100%);
}
.theme-card-preview.dark::after {
  content: '☾ Aa';
  position: absolute; right: 10px; top: 8px;
  color: #E0B45F; font-weight: 700; font-size: 12px;
}
.theme-card-preview.auto {
  background: linear-gradient(90deg, #FDF6F0 50%, #10171F 50%);
}
.theme-card-preview.auto::after {
  content: 'AUTO';
  position: absolute; right: 10px; top: 8px;
  color: #E8541A; font-weight: 700; font-size: 12px;
  mix-blend-mode: difference;
}
.theme-card-meta { display: flex; flex-direction: column; gap: 2px; }
.theme-card-meta b { font-size: 14px; color: var(--text); }
.theme-card-meta em { font-size: 12px; color: var(--text-3); font-style: normal; }

/* ---- 内联展开表单（替代弹窗） ---- */
#inlineCreateWrap { margin-bottom: 16px; }
.inline-form {
  background: var(--tint);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  padding: 16px 18px 18px;
  margin-bottom: 16px;
  animation: rise .22s cubic-bezier(.2, .7, .3, 1);
}
.inline-form-head {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line-2);
  flex-wrap: wrap;
}
.inline-form-head b { font-size: 15px; color: var(--text); }
.inline-form-head .sub { font-size: 12px; color: var(--text-3); }
.inline-form .field { margin-bottom: 12px; }
.inline-form .switch-row { margin-bottom: 8px; }
.inline-form .sep { margin: 14px 0; }
.inline-form .actions {
  margin-top: 14px;
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* 用户表中编辑行 / 重置密码行的展开容器 */
.tbl td.edit-cell, .tbl td.pwd-cell { padding: 0 !important; background: var(--tint); }
.tbl td.edit-cell .inline-form,
.tbl td.pwd-cell .inline-form {
  margin: 8px;
  border-left-width: 3px;
}

/* ---- 顶栏：手机端隐藏 LOGO 旁的“币涨 / 标题” ---- */
@media (max-width: 900px) {
  .crumb { font-size: 13px; }
  .crumb > span { display: none; } /* 隐藏「币涨」前缀，只保留当前页标题 */
  .topbar-logo { height: 26px; }
  .sidebar { box-shadow: var(--sh-2); }
}

/* ---- 表格操作按钮：手机端折行 ---- */
@media (max-width: 720px) {
  .tbl td.ops { white-space: normal; }
  .tbl td.ops .btn { margin-bottom: 4px; }
  .theme-card-preview { height: 52px; }
}

/* ---- 隐藏已废弃的 admin-iframe 样式占位 ---- */
.admin-iframe { display: none; }

/* ============================================================
 * v17 — 持仓视图（portfolio）
 *  - 数据源切换卡片（src-card）
 *  - API 凭据状态条
 *  - 4 KPI 网格（kpi-grid）
 *  - Canvas 曲线图容器
 *  - 持仓明细表（移动端横向滚动）
 *  - 余额浮层
 * ============================================================ */

/* === 数据源切换卡片 === */
.src-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.src-card {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  cursor: pointer;
  transition: all .15s;
  position: relative;
}
.src-card:hover { border-color: var(--brand-bg-hover); background: var(--tint); }
.src-card input[type="radio"] { margin-top: 3px; flex: 0 0 auto; accent-color: var(--brand); }
.src-card.on {
  border-color: var(--brand);
  background: var(--brand-bg);
  box-shadow: var(--sh-brand);
}
.src-card.on::after {
  content: "✓";
  position: absolute;
  top: 8px; right: 12px;
  color: var(--brand);
  font-size: 14px;
  font-weight: 700;
}
.src-card-meta { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.src-card-meta b { font-size: 14px; color: var(--text); font-weight: 600; }
.src-card-meta em {
  font-style: normal;
  font-size: 12px;
  color: var(--text-3);
  line-height: 1.45;
}

/* === API 状态条 === */
.api-status-wrap { margin-top: 4px; }
.api-status {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 14px 16px;
  background: var(--tint);
  border: 1px dashed var(--line);
  border-radius: var(--r);
}
.api-status > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.api-status .sub { font-size: 11px; color: var(--text-3); }
.api-status b { font-size: 13px; color: var(--text); font-weight: 600; word-break: break-all; }

/* === KPI 网格 === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 4px;
}
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.kpi label { font-size: 12px; color: var(--text-3); }
.kpi b {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  word-break: break-all;
  line-height: 1.2;
}
.kpi em {
  font-style: normal;
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.kpi b.up    { color: var(--up); }
.kpi b.down  { color: var(--down); }
.kpi b.flat  { color: var(--text-2); }
.kpi-pnl.up   { color: var(--up) !important; }
.kpi-pnl.down { color: var(--down) !important; }
.kpi-pnl.flat { color: var(--text-2) !important; }

/* === 汇率输入 === */
.cnx-row {
  display: flex;
  justify-content: flex-end;
  margin: 4px 0 12px;
}
.cnx-row .field { max-width: 220px; width: 100%; }
.cnx-row .field span { font-size: 12px; color: var(--text-3); }
.cnx-row .field input {
  height: 32px;
  padding: 4px 10px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* === 曲线图容器 === */
.chart-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  padding: 8px 4px 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.chart-wrap canvas { width: 100%; height: 220px; display: block; }

/* === 持仓明细表（响应式横向滚动） === */
.tbl-port { min-width: 880px; }
.tbl-port td.up    b { color: var(--up); }
.tbl-port td.down  b { color: var(--down); }
.tbl-port td.flat  b { color: var(--text-2); }
.tbl-port td .sub { font-variant-numeric: tabular-nums; }
.tbl-port td.up    .sub { color: var(--up); }
.tbl-port td.down  .sub { color: var(--down); }

/* === 余额浮层 === */
.balance-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 16px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 2px;
}
.balance-list .kv {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 8px 12px;
  background: var(--tint);
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
}
.balance-list .kv span { font-size: 13px; color: var(--text-2); font-weight: 600; }
.balance-list .kv b {
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* === 空状态 CTA（持仓明细为空时） === */
.empty-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 56px 24px 48px;
  background: var(--tint);
  border: 1px dashed var(--line);
  border-radius: var(--r);
  text-align: center;
  margin: 4px 0;
}
.empty-cta-icon { color: var(--brand); opacity: .9; }
.empty-cta-text { display: flex; flex-direction: column; gap: 4px; }
.empty-cta-text b { font-size: 15px; color: var(--text); font-weight: 600; }
.empty-cta-text em { font-style: normal; font-size: 13px; color: var(--text-3); }
.empty-cta-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }
.empty-cta-actions .btn { min-width: 130px; }

/* === 面板头部右侧动作区 === */
.panel-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.panel-head-actions #portAddBtnTop {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  font-size: 13px;
  line-height: 22px;
}
.panel-head-actions #portAddBtnTop svg { display: inline-block; vertical-align: middle; }

/* === 持仓视图响应式：手机端折行 === */
@media (max-width: 900px) {
  .src-cards { grid-template-columns: 1fr; }
  .api-status { grid-template-columns: 1fr; gap: 10px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .kpi b { font-size: 17px; }
  .balance-list { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .chart-wrap, .chart-wrap canvas { height: 180px; }
  /* 持仓明细横向滚动 */
  .tbl-port-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl-port { min-width: 760px; }
  .kpi-grid { gap: 8px; }
  .kpi { padding: 10px 12px; }
  .kpi b { font-size: 15px; }
  .kpi label { font-size: 11px; }
  .kpi em { font-size: 11px; }
  .cnx-row .field { max-width: 100%; }
  .panel-head-actions { gap: 8px; }
  .panel-head-actions #portAddBtnTop { padding: 5px 10px; font-size: 12.5px; }
  .empty-cta { padding: 36px 16px 32px; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi { padding: 10px; }
  .kpi b { font-size: 14px; }
}

/* ============================================================
 * v18 — 量化交易系统（quant）
 *  - alert / tag 徽章
 *  - tbl-quant 移动端横向滚动
 *  - 量化 KPI 网格
 *  - 顶部模式切换 + 实盘警告条
 * ============================================================ */

.alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--r);
  margin: 12px 0;
  border: 1px solid;
  font-size: 13px;
}
/* hidden 属性保护：display:flex 会覆盖 UA 的 [hidden]{display:none}，必须显式兜底 */
.alert[hidden] { display: none !important; }
.alert b { font-weight: 700; }
.alert em { font-style: normal; flex: 1; opacity: .85; }
.alert.alert-warn {
  background: rgba(224, 162, 60, .12);
  border-color: var(--warn);
  color: var(--warn);
}
.alert.alert-warn b { color: var(--warn); }
.alert.alert-warn .btn { margin-left: auto; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 99px;
  font-size: 11px;
  line-height: 18px;
  font-weight: 600;
  vertical-align: middle;
}
.tag-danger { background: rgba(217, 72, 43, .14); color: var(--error); border: 1px solid rgba(217, 72, 43, .3); }
.tag-warn   { background: rgba(224, 162, 60, .14); color: var(--warn); border: 1px solid rgba(224, 162, 60, .3); }
.tag-success { background: rgba(47, 158, 99, .14); color: var(--success); border: 1px solid rgba(47, 158, 99, .3); }

/* 量化 tab 风格：复用 .admin-tabs */
#qTabs { margin-bottom: 14px; }

/* 量化 KPI 网格：8 卡片（4+4） */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 4px;
}

/* 策略表移动端横向滚动 */
.tbl-quant-wrap, #qOrdersTable { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl-quant { min-width: 960px; }

/* 模式切换 select 紧凑 */
.panel-head-actions select { height: 30px; padding: 2px 8px; font-size: 13px; }

/* 量化面板响应式 */
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .kpi-grid { gap: 8px; }
  .panel-head-actions { flex-wrap: wrap; gap: 6px; }
  .alert { flex-wrap: wrap; }
  .alert em { flex: 1 1 100%; order: 3; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}

/* 量化面板与持仓面板共享 .panel/.kpi 样式；这里只追加专有样式 */

/* =====================================================================
 * v19 — 量化重构：自动交易控制台 + 回测详情
 * ===================================================================== */

/* 自动交易控制台：panel-head 下方的一条状态栏 */
.auto-trade-box {
  margin: 12px 0 4px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--fill);
  border: 1px solid var(--line);
}
.auto-trade-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.auto-trade-info { display: flex; flex-direction: column; gap: 4px; min-width: 220px; flex: 1; }
.auto-trade-info b { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.auto-trade-ops { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* toggle 开关基础类：label.switch > input[hidden] + span(轨道) */
.switch { position: relative; display: inline-flex; align-items: center; cursor: pointer; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  display: inline-block; width: 42px; height: 24px; border-radius: 999px;
  background: var(--line-2); transition: background .18s; position: relative;
}
.switch span::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .18s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }

@media (max-width: 720px) {
  .auto-trade-main { gap: 8px; }
  .auto-trade-info { min-width: 100%; }
}

/* ================= 登录页：窄屏适配 ================= */
@media (max-width: 560px) {
  .login-shell { padding: 76px 16px 40px; }
  .login-card { padding: 32px 22px 28px; border-radius: 18px; }
  .login-mark { width: 52px; height: 52px; border-radius: 15px; margin-bottom: 18px; }
  .login-mark svg { width: 27px; height: 27px; }
  .login-head h2 { font-size: 19px; }
}
