*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: "Manrope", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(ellipse 58% 48% at 1% 0%, rgba(126,207,255,.16) 0%, transparent 52%),
    radial-gradient(ellipse 48% 44% at 99% 0%, rgba(217,176,113,.12) 0%, transparent 48%),
    radial-gradient(ellipse 42% 36% at 68% 99%, rgba(106,211,159,.08) 0%, transparent 50%),
    linear-gradient(180deg, #040c14 0%, #060f18 42%, #050c15 100%);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px);
  background-size: 76px 76px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.65) 0%, transparent 78%);
}
a { text-decoration: none; color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.10); border-radius: 4px; }

/* ── AstraTrade Command Center 顶级导航（2026-04-26 统一版）──
   设计：
     · 深色 panel + blur，金色 brand kicker，sticky 14px 浮起
     · 标签紧凑胶囊：dim t3 → hover ink + 微底；active = ink + gold border
     · 子页 sub-tabs 紧贴 topbar 下方，金色 underline 指示活动
     · pills / refresh 右侧灰系，OK/run/err/warn 各取语义色
   兼容：保留所有 ID（global-pill-opend / global-pill-env / btn-login /
        auth-area / nav-hamburger / nav-drawer），common.js 不动
*/
.topbar {
  position: sticky;
  top: 14px;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(280px, .9fr) minmax(420px, 1.4fr) auto;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  min-height: 68px;
  border: 1px solid var(--line-md);
  border-radius: var(--r-xl);
  background: rgba(8, 11, 16, .82);
  backdrop-filter: blur(26px);
  box-shadow: var(--sh);
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.brand:hover .brand-kicker { color: var(--gold-2); }
.brand-kicker {
  color: var(--gold);
  font-size: 22px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: .02em;
  text-transform: uppercase;
  font-family: 'Manrope', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  transition: color .14s;
}
.brand-sub {
  font-size: 11px;
  color: var(--t3);
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.brand-context {
  margin-left: 4px;
  color: var(--t2);
  font-weight: 760;
}

.nav-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  overflow-x: auto;
}
.nav-tabs::-webkit-scrollbar { display: none; }
.nav-tab {
  flex: 0 0 auto;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  color: var(--t3);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: .02em;
  white-space: nowrap;
  border: 1px solid transparent;
  text-decoration: none;
  transition: color .14s, background .14s, border-color .14s;
}
.nav-tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, .05);
}
.nav-tab.active {
  color: var(--text);
  background: rgba(255, 255, 255, .07);
  border-color: rgba(217, 176, 113, .26);
  box-shadow: inset 0 0 0 1px rgba(217, 176, 113, .10);
}

.topbar:has(+ .sub-tabs) {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.sub-tabs {
  display: flex;
  gap: 0;
  padding: 0 8px;
  background: rgba(8, 11, 16, .72);
  border: 1px solid var(--line);
  border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  margin-top: -17px;
  position: relative;
  z-index: 99;
  overflow-x: auto;
  align-items: center;
}
.sub-tab-group-label {
  display: inline-flex;
  align-items: center;
  padding: 0 10px 0 14px;
  min-height: 40px;
  color: var(--t3);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: .78;
}
.sub-tabs:not(.sub-tabs-map) .sub-tab-group-label:not(:first-child) {
  margin-left: 10px;
  border-left: 1px solid var(--line);
}
.sub-tabs-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 8px;
  padding: 10px;
  align-items: stretch;
}
.sub-tab-cluster {
  min-width: 0;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(190, 215, 235, .09);
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
}
.sub-tab-cluster[data-active="true"] {
  border-color: rgba(217, 176, 113, .32);
  background:
    linear-gradient(135deg, rgba(217, 176, 113, .10), transparent 62%),
    rgba(255, 255, 255, .035);
  box-shadow: inset 0 0 0 1px rgba(217, 176, 113, .08);
}
.sub-tab-cluster-head {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sub-tab-step {
  flex: 0 0 auto;
  min-width: 26px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid rgba(126, 207, 255, .18);
  color: var(--sky);
  background: rgba(126, 207, 255, .08);
  font-size: 10px;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}
.sub-tabs-map .sub-tab-group-label {
  min-height: 0;
  min-width: 0;
  padding: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
  text-transform: none;
}
.sub-tab-cluster-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.sub-tabs-map .sub-tab {
  min-height: 32px;
  flex: 1 1 auto;
  padding: 6px 10px;
  border: 1px solid rgba(190, 215, 235, .10);
  border-radius: 7px;
  background: rgba(255, 255, 255, .035);
  font-size: 12px;
}
.sub-tabs-map .sub-tab:hover {
  color: var(--text);
  border-color: rgba(126, 207, 255, .26);
  background: rgba(126, 207, 255, .08);
}
.sub-tabs-map .sub-tab.active {
  color: var(--gold-2);
  border-color: rgba(217, 176, 113, .38);
  background: rgba(217, 176, 113, .12);
}
.sub-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px 10px;
  font-size: 13px;
  font-weight: 850;
  color: var(--t3);
  border-bottom: 2px solid transparent;
  text-decoration: none;
  transition: color .18s, border-color .18s;
  white-space: nowrap;
  cursor: pointer;
}
.sub-tab:hover { color: var(--text); }
.sub-tab.active {
  color: var(--gold-2);
  border-bottom-color: var(--gold);
}

.topbar-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}
.pill {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--t2);
  background: rgba(255, 255, 255, .045);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
  white-space: nowrap;
  text-decoration: none;
}
.pill .dot,
.engine-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--t3);
  flex-shrink: 0;
}
.pill.ok,
.engine-badge.active { color: var(--down); background: var(--down-bg); border-color: rgba(106, 211, 159, .28); }
.pill.ok .dot,
.engine-badge.active .dot { background: var(--down); box-shadow: 0 0 12px rgba(106, 211, 159, .42); }
.pill.err  { color: var(--up); background: var(--up-bg); border-color: rgba(255, 140, 137, .28); }
.pill.err .dot { background: var(--up); box-shadow: 0 0 12px rgba(255, 140, 137, .42); }
.pill.warn { color: var(--warn); background: var(--warn-bg); border-color: rgba(245, 194, 106, .28); }
.pill.warn .dot { background: var(--warn); box-shadow: 0 0 12px rgba(245, 194, 106, .42); }
.pill.run  { color: var(--sky); background: var(--sky-bg); border-color: rgba(126, 207, 255, .28); }
.pill.run .dot { background: var(--sky); box-shadow: 0 0 12px rgba(126, 207, 255, .42); }
.pill.danger { color: var(--up); background: var(--up-bg); border-color: rgba(255, 140, 137, .34); }

.btn-refresh,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: var(--r-sm);
  transition: color .14s, background .14s, border-color .14s;
  cursor: pointer;
}
.btn-refresh {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .045);
  color: var(--t2);
  border-radius: var(--r-sm);
}
.btn-refresh:hover {
  background: rgba(255, 255, 255, .07);
  border-color: var(--line-str);
  color: var(--text);
}

/* CN/US 涨跌色切换（与 home_redesign_preview 同款）*/
.color-mode-toggle {
  height: 32px;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
}
.mode-button {
  min-width: 32px;
  border: 0;
  background: transparent;
  color: var(--t3);
  cursor: pointer;
  font-size: 10px;
  font-weight: 950;
  letter-spacing: .08em;
}
.mode-button.active {
  color: var(--text);
  background: var(--sky-bg);
}
.btn {
  padding: 10px 18px;
  border: 1px solid var(--line-md);
  background: rgba(255,255,255,.04);
  color: var(--t2);
  font-size: 13px;
  font-weight: 700;
}
.btn:hover:not(:disabled) { transform: translateY(-1px); border-color: var(--line-str); color: var(--text); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: rgba(255,255,255,.04); }
.btn-sky {
  color: #fff;
  border-color: rgba(126,207,255,.5);
  background: linear-gradient(135deg, rgba(126,207,255,.7), rgba(80,180,240,.9));
  box-shadow: 0 4px 18px rgba(126,207,255,.2);
}
.btn-kill { color: var(--up); background: var(--up-bg); border-color: rgba(255,140,137,.28); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--r-sm); }

.panel,
.cmd-strip,
.detail-panel {
  border-radius: var(--r-xl);
  border: 1px solid var(--line-md);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  box-shadow: var(--sh-sm);
}
.panel { overflow: hidden; position: relative; }
.panel-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.panel-title { font-family: "Noto Serif SC", serif; font-size: 16px; font-weight: 600; letter-spacing: -.03em; }
.panel-note { font-size: 12px; color: var(--t3); }

.cmd-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
}
.cmd-cell {
  min-width: 0;
  padding: 14px 16px 13px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cmd-cell:last-child { border-right: none; }
.cmd-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .09em;
}
.cmd-value {
  font-family: "Noto Serif SC", serif;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: -.04em;
  line-height: 1.15;
}
.cmd-sub { font-size: 12px; color: var(--t3); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-up { color: var(--up); background: var(--up-bg); }
.badge-down { color: var(--down); background: var(--down-bg); }
.badge-muted { color: var(--t2); background: rgba(255,255,255,.06); }
.badge-pending { color: var(--gold); background: var(--gold-bg); }

.field-input {
  width: 100%;
  padding: 10px 13px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-md);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline: none;
}
.field-input:focus { border-color: rgba(126,207,255,.4); box-shadow: 0 0 0 3px rgba(126,207,255,.08); }
.field-select {
  appearance: none;
  color-scheme: dark;
  background-color: #0b1c2c;
  color: #eef5fb;
  background-image: linear-gradient(45deg, transparent 50%, var(--t3) 50%), linear-gradient(135deg, var(--t3) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}
.field-select option {
  background-color: #0b1c2c;
  color: #eef5fb;
}

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--t3); }
.data-table td { font-size: 13px; color: var(--text); }
.data-table .right { text-align: right; }

.empty-state, .empty-cell {
  padding: 24px;
  text-align: center;
  color: var(--t3);
}

.up { color: var(--up) !important; }
.down { color: var(--down) !important; }
.sky { color: var(--sky) !important; }
.violet { color: var(--violet-2) !important; }
.gold { color: var(--gold) !important; }
.hidden { display: none !important; }

.toast-wrap {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid var(--line-md);
  background: rgba(8, 19, 30, .94);
  color: var(--text);
  box-shadow: var(--sh-sm);
  font-size: 12px;
  pointer-events: auto;
}
.toast.success { border-color: rgba(106,211,159,.24); }
.toast.error   { border-color: rgba(255,140,137,.24); }
.toast.warn    { border-color: rgba(245,194,106,.24); }
.toast.info    { border-color: rgba(126,207,255,.24); }

/* ── Auth ── */
.topbar-auth { position: relative; }
.login-dropdown {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  z-index: 200;
  padding: 16px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line-md);
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
  box-shadow: var(--sh);
  backdrop-filter: blur(22px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 220px;
}
.login-dropdown.hidden { display: none; }

/* ── 汉堡菜单 / 抽屉（全局，默认 ≥600px 隐藏） ── */
.nav-hamburger {
  display: none;
  align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: var(--r-sm);
  border: 1px solid var(--line-md); background: rgba(255,255,255,.04);
  color: var(--t2); cursor: pointer; flex-shrink: 0;
}
.nav-hamburger:hover, .nav-hamburger:active { background: rgba(255,255,255,.08); color: var(--text); }
.nav-drawer { display: none; }
.nav-drawer.open { display: flex; }

/* ════════════════════════════════
   MOBILE ADAPTIVE (≤600px, 手机竖屏)
   P1+P2 放一起：汉堡导航 / 触摸目标 / 字体 / :active 反馈
════════════════════════════════ */
@media (max-width: 1100px) {
  /* 中宽屏：把 nav 收起来，只留 brand + hamburger + 右侧状态 */
  .topbar {
    grid-template-columns: 1fr auto auto;
    padding: 11px 14px;
    gap: 12px;
  }
  .topbar > .nav-tabs { display: none; }
  .nav-hamburger { display: inline-flex; }
}
/* Touch / coarse-pointer 设备：hover 永远不生效，所以 hover 弱化的按钮（如自选删除）
   必须在此类设备上强制可见。覆盖范围所有页面（首页 + 子页面）。*/
@media (hover: none), (pointer: coarse) {
  .row-button { opacity: 1 !important; }
}
@media (max-width: 600px) {
  /* 手机：topbar 改两行——row1 brand+hamburger / row2 topbar-right 横向滚动；
     单行 1fr auto auto 在 360px 实测会折行 */
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    min-height: auto;
    padding: 9px 12px;
    gap: 8px 10px;
    top: 10px;
    border-radius: var(--r-lg);
  }
  .brand { grid-column: 1; grid-row: 1; }
  .nav-hamburger { grid-column: 2; grid-row: 1; }
  .topbar > .nav-tabs { display: none; }
  .topbar-right {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding-bottom: 1px;
  }
  .topbar-right::-webkit-scrollbar { display: none; }
  .brand-kicker { font-size: 18px; }
  .brand-sub { display: none; }
  .topbar-right .pill { padding: 0 9px; min-height: 28px; font-size: 11px; flex-shrink: 0; }
  .color-mode-toggle { height: 28px; flex-shrink: 0; }
  .btn-refresh { width: 30px; height: 30px; flex-shrink: 0; }
  .sub-tabs-map {
    grid-template-columns: minmax(0, 1fr);
    margin-top: -10px;
  }
  .nav-drawer {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(4px);
    align-items: flex-start; justify-content: flex-end;
  }
  .nav-drawer-panel {
    width: 240px; height: 100%; padding: 18px 0 24px;
    background: linear-gradient(180deg, var(--panel) 0%, var(--panel-2) 100%);
    border-left: 1px solid var(--line-md);
    display: flex; flex-direction: column; gap: 2px;
    overflow-y: auto;
  }
  .nav-drawer-close {
    align-self: flex-end;
    margin: 0 14px 8px;
    padding: 8px 14px;
    background: rgba(255,255,255,.06);
    border: 1px solid var(--line-md);
    border-radius: 10px;
    color: var(--t2);
    font-size: 13px;
    cursor: pointer;
  }
  .nav-drawer a {
    display: block;
    padding: 14px 22px;
    color: var(--t2); font-size: 15px; text-decoration: none;
    border-left: 3px solid transparent;
    transition: background .14s, color .14s;
  }
  .nav-drawer a:hover, .nav-drawer a:active, .nav-drawer a.active {
    background: rgba(126,207,255,.07);
    color: var(--sky);
    border-left-color: var(--sky);
  }

  /* 触摸目标放大（≥40px）与更大字号 */
  .pill { padding: 9px 14px; min-height: 40px; font-size: 12px; }
  .btn-refresh { width: 42px; height: 42px; }
  .topbar-right { gap: 6px; }
  .nav-tab, .sub-tab { padding: 10px 16px; font-size: 13px; }
  .sub-tab-group-label { padding: 0 8px 0 10px; font-size: 10px; }
  .filter-pill { padding: 9px 14px; min-height: 40px; font-size: 12px; }
  .chip { padding: 9px 14px; min-height: 40px; font-size: 12px; }
  .btn { min-height: 40px; padding: 9px 16px; }

  /* 10px 字体统一提升到 11px */
  .cmd-label, .field-label, .metric-sub, .footer-note,
  .brand-sub, .sum-label { font-size: 11px !important; }

  /* 提供点击反馈（手机无 hover） */
  .pill:active, .nav-tab:active, .sub-tab:active,
  .btn:active, .filter-pill:active, .chip:active {
    background: rgba(255,255,255,.08);
    transform: scale(0.98);
  }

  /* toast 考虑 iOS 安全区 + 留给键盘 */
  .toast-wrap {
    right: 12px;
    left: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
  }
  .toast { min-width: 0; max-width: 100%; }
}

/* 数据来源标识 i-icon（2026-04-27 设计系统 §5.6）
   用法：<span class="info-i" title="数据源 + 计算口径 + 边界条件">i</span>
   原则：native title 属性（桌面 hover / 移动长按都支持），零依赖 */
.info-i {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 14px; height: 14px;
  margin-left: 6px;
  border-radius: 999px;
  border: 1px solid var(--line-md);
  background: rgba(255, 255, 255, .03);
  color: var(--t3);
  font-size: 9px; font-weight: 700; font-style: italic;
  font-family: serif;
  cursor: help;
  vertical-align: middle;
  user-select: none;
  transition: color .15s ease, border-color .15s ease;
}
.info-i:hover {
  color: var(--t2);
  border-color: var(--line-str);
}

/* 2026-04-28 删 .sparkline / .sparkline-mini —— 首页 30d sparkline 已移除（commit 360aa13）。
   /performance → 权益曲线 tab 用 Chart.js canvas，不需要这套 SVG 工具类。
   设计系统 §5.7 Sparkline 组件已 retire，未来若需要再用从 git history 恢复。 */
