/* Hedge Monitor styles — 仿截图视觉 */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --border: #e5e7eb;
  --border-strong: #d1d5db;
  --text: #1f2937;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;

  --primary: #14b8a6;
  --primary-dark: #0d9488;

  --row-hover: #f0fdfa;
  --row-stripe: #fafbfc;

  /* 价差颜色 */
  --spread-color: #ef4444;

  /* 总价颜色梯度（金额从小到大） */
  --total-1: #e0f2fe; /* 浅蓝 <300 */
  --total-2: #bae6fd; /* 蓝   300-800 */
  --total-3: #fde68a; /* 黄   800-2000 */
  --total-4: #fca5a5; /* 浅红 2000-5000 */
  --total-5: #f87171; /* 红   5000-10000 */
  --total-6: #ef4444; /* 深红 >10000 */

  --chip-off-bg: #eef0f2;
  --chip-off-fg: #9ca3af;
  --chip-off-bd: #d1d5db;

  --disclaimer-bg: #fef3c7;
  --disclaimer-text: #92400e;
}

/* ===== 顶栏下沿统一弹窗 ===== */
.toolbar { position: relative; }
.toolbar-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 12px;
  z-index: 900;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  max-height: 70vh;
  overflow: auto;
}
.toolbar-pop.hidden { display: none; }
.pop-filter { width: 620px; max-width: calc(100vw - 24px); }
.pop-fixed { width: 520px; max-width: calc(100vw - 24px); }
.pop-blocked { width: 360px; }
.pop-settings { width: 520px; max-width: calc(100vw - 24px); }
.toolbar-pop .blocked-head {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
/* 固定模式弹窗：买/卖两行 */
.fixed-side-row { align-items: flex-start; }
.fixed-side-label {
  flex-shrink: 0;
  width: 48px;
  padding-top: 4px;
  font-weight: 700;
  color: var(--text-muted);
}
/* 按钮激活态（固定模式启用 / 弹窗打开提示） */
.btn.on { background: #7c3aed; border-color: #6d28d9; color: #fff; }
.btn.on:hover { background: #6d28d9; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
}

.app { padding: 8px 12px 24px; }

/* 顶部提示 */
.disclaimer {
  background: var(--disclaimer-bg);
  color: var(--disclaimer-text);
  text-align: center;
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  font-weight: 500;
}

/* 工具栏 */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  margin-bottom: 6px;
}
.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.toolbar-left { position: relative; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 3px;
  cursor: pointer;
  height: 26px;
  user-select: none;
}
.btn:hover { background: #f3f4f6; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary-dark);
}
.btn-primary:hover { background: var(--primary-dark); }

.search-input, .num-input {
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 4px 8px;
  font-size: 12px;
  height: 26px;
  outline: none;
  font-family: inherit;
}
.search-input { width: 120px; }
.num-input { width: 70px; }
.search-input:focus, .num-input:focus { border-color: var(--primary); }

.select {
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 12px;
  height: 26px;
  background: #fff;
  cursor: pointer;
  outline: none;
  font-family: inherit;
}

.inline-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: 38px;
  height: 18px;
  border-radius: 9px;
  background: #d1d5db;
  cursor: pointer;
  transition: background 0.15s;
  padding: 0 2px;
}
.switch.on { background: var(--primary); }
.switch.warn.on { background: #d97706; } /* 暂停排序：琥珀色，与蓝色"自动刷新"区分 */
.switch.fixed.on { background: #7c3aed; } /* 固定模式：紫色，卖方固定 BITGET/OKX */
.switch-dot {
  display: block;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s;
  transform: translateX(0);
}
.switch.on .switch-dot { transform: translateX(20px); }
.switch-on {
  position: absolute;
  right: 6px;
  font-size: 9px;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.switch:not(.on)::after {
  content: "OFF";
  position: absolute;
  right: 4px;
  font-size: 9px;
  color: #fff;
  font-weight: 700;
}

/* 状态条 */
.statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 2px 4px 6px;
}
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
}
.status-dot.on { background: #10b981; box-shadow: 0 0 4px #10b981; }
.status-dot.off { background: #ef4444; }
.status-sep { color: var(--text-soft); }

/* 表格 */
.table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: auto;
  max-height: calc(100vh - 160px);
  position: relative;
}
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: #f3f4f6;
  color: #374151;
  font-weight: 600;
  text-align: left;
  padding: 6px 8px;
  border-bottom: 2px solid var(--border-strong);
  border-right: 1px solid var(--border);
  white-space: nowrap;
  z-index: 2;
}
.data-table thead th.col-spread { color: var(--spread-color); }
.data-table thead th.col-total { text-align: center; }

.data-table tbody td {
  padding: 8px 8px;
  border-bottom: 1px solid #eef0f3;
  border-right: 1px solid #e5e7eb;
  white-space: nowrap;
  vertical-align: middle;
  height: 38px;
  line-height: 1.5;
}
.data-table tbody tr:nth-child(even) td { background: var(--row-stripe); }
.data-table tbody tr:hover td { background: var(--row-hover); }

.col-star { width: 44px; text-align: center; }
.mute-check { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); margin: 0; }
.col-symbol { width: 80px; }
.col-buy-ex { width: 110px; text-align: left; }
.col-sell-ex { width: 110px; text-align: left; }

/* 币种前的收藏(勾选)按钮 */
.star-btn {
  font-size: 15px;
  line-height: 1;
  color: #d1d5db;
  cursor: pointer;
  user-select: none;
  transition: color 0.12s, transform 0.12s;
}
.star-btn:hover { color: #f59e0b; transform: scale(1.15); }
.star-btn.on { color: #f59e0b; }

.col-spread { width: 110px; text-align: left; }
.col-buy-price, .col-sell-price { width: 1%; white-space: nowrap; text-align: left; }
.col-total { width: 130px; text-align: left; }
.col-net { width: auto; max-width: 420px; vertical-align: top; }
.net-side { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 2px 0; }
.net-side + .net-side { border-top: 1px dashed #eef0f3; }
.net-side.clickable { cursor: pointer; }
.net-side.clickable:hover { background: rgba(37,99,235,0.06); border-radius: 3px; }
.net-more { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 16px; margin-left: 2px; padding: 0 4px; font-size: 10px; font-weight: 700; color: #2563eb; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; }
/* 充提链弹窗 */
.net-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.net-modal { width: 340px; max-width: 92vw; max-height: 80vh; background: #fff; border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); display: flex; flex-direction: column; overflow: hidden; }
.net-modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid #eef0f3; font-size: 13px; font-weight: 600; }
.net-modal-ex { color: #374151; }
.net-modal-x { border: none; background: #f3f4f6; width: 26px; height: 26px; border-radius: 4px; font-size: 18px; line-height: 1; cursor: pointer; color: #6b7280; }
.net-modal-x:hover { background: #e5e7eb; }
.net-modal-bd { padding: 12px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.net-modal-row { display: flex; }
.net-modal-ft { padding: 10px 14px; border-top: 1px solid #eef0f3; font-size: 11px; color: #6b7280; }
.net-role { font-size: 11px; font-weight: 700; flex-shrink: 0; width: 16px; text-align: center; }
.net-role.buy { color: #059669; }
.net-role.sell { color: #dc2626; }
.net-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  line-height: 1.3;
  padding: 1px 5px;
  border-radius: 2px;
  margin: 1px 0;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  color: #374151;
  font-weight: 600;
  white-space: nowrap;
}
.net-chip b { font-weight: 800; font-size: 12px; }
.net-chip .nm { font-style: normal; font-size: 11px; font-weight: 700; }
.net-chip .nm.ok { color: #059669; }
.net-chip .nm.bad { color: #dc2626; }
.net-chip .nm.unk { color: #9ca3af; }
.net-chip .nm-sep { color: #9ca3af; font-size: 9px; }
.net-chip.bad {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fca5a5;
}
/* 回退猜测数据：状态未核验，中性灰 + 虚线边框 */
.net-chip.unk {
  background: #f9fafb;
  border: 1px dashed #d1d5db;
  color: #6b7280;
}
.col-fee { width: 120px; }
.cell-fee {
  font-size: 11px;
  color: #374151;
  font-variant-numeric: tabular-nums;
}
.cell-borrow { font-size: 10px; }
.borrow-tag.warn {
  background: #fef3c7;
  color: #92400e;
}
.col-borrow { width: 90px; }
.col-hide { width: 60px; text-align: center; }
.col-block { width: 60px; text-align: center; }

/* 交易所选择（表头内联 chips） */
.ex-chips-label {
  font-size: 12px;
  color: var(--text-muted);
  align-self: center;
}
.ex-chips {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.ex-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: #eef0f2;
  color: #9ca3af;
  cursor: pointer;
  user-select: none;
  transition: filter 0.12s, opacity 0.12s;
}
.ex-chip:hover { filter: brightness(0.97); }
.ex-chip.on { box-shadow: inset 0 0 0 1px rgba(255,255,255,0.25); }
.ex-chip:not(.on) { opacity: 0.85; }
/* 固定模式：已被另一侧选中的交易所 → 不可重复选择 */
.ex-chip.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(1);
  text-decoration: line-through;
}
.ex-chip.disabled:hover { filter: grayscale(1); }

.badge {
  display: inline-block;
  min-width: 16px;
  padding: 0 5px;
  height: 15px;
  line-height: 15px;
  font-size: 10px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  text-align: center;
  font-weight: 700;
}

/* 表头排序三角标 */
.data-table thead th.sortable { cursor: pointer; user-select: none; }
.data-table thead th.sortable:hover { background: #e9ebee; }
.data-table thead th.sortable.sorted { color: var(--primary-dark); }
.sort-ind {
  display: inline-block;
  margin-left: 3px;
  font-size: 9px;
  color: var(--primary);
}

/* 屏蔽按钮 */
.block-btn {
  border: 1px solid #fca5a5;
  background: #fff;
  color: #dc2626;
  border-radius: 2px;
  padding: 1px 8px;
  font-size: 10px;
  cursor: pointer;
}
.block-btn:hover { background: #fee2e2; }

/* 屏蔽管理面板 */
.blocked-panel {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 320px;
  max-height: 60vh;
  background: #fff;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.blocked-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  background: #f3f4f6;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 12px;
}
.blocked-list { overflow-y: auto; padding: 6px 8px; }
.blocked-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 2px;
  border-bottom: 1px solid #f3f4f6;
  font-size: 11px;
}
.blocked-empty { text-align: center; color: var(--text-soft); padding: 18px 0; font-size: 11px; }
.btn-sm { height: 22px; padding: 1px 8px; font-size: 11px; }
.unblock-btn { border-color: #fca5a5; color: #dc2626; }
/* 最小化：收起列表区，仅留标题栏 */
.blocked-panel.collapsed { max-height: 40px; }
.blocked-panel.collapsed .blocked-list { display: none; }
.blocked-panel.collapsed #clearBlockedBtn,
.blocked-panel.collapsed #closeBlockedBtn { display: none; }

.cell-spread {
  color: var(--spread-color);
  font-weight: 600;
  text-align: left;
  font-variant-numeric: tabular-nums;
}
/* 买价(绿)/卖价(红) 分列着色 */
.cell-price.buy-price { color: #059669; font-weight: 600; }
.cell-price.sell-price { color: #dc2626; font-weight: 600; }
.cell-price {
  text-align: left;
  font-variant-numeric: tabular-nums;
  color: #111827;
}
.cell-total {
  text-align: center;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #111827;
}

.ex-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #111827;
}
.ex-logo {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--ex-color, #ddd);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 14px;
  text-align: center;
  flex-shrink: 0;
}

.symbol-cell {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #14b8a6;
  font-weight: 600;
}
.symbol-cell.empty-star::before { content: "☆"; color: #d1d5db; }

/* 币种下方：推送 / 屏蔽 小按钮 */
.row-actions {
  display: flex;
  gap: 4px;
  margin-top: 3px;
}
.mini-btn {
  font-size: 10px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 3px;
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}
.mini-btn:hover { background: var(--row-stripe); color: var(--text); }
.mini-btn.push-btn { color: #0e7490; border-color: #67e8f9; }
.mini-btn.push-btn:hover { background: #cffafe; color: #155e75; }
.mini-btn.block-btn { color: #b91c1c; border-color: #fca5a5; }
.mini-btn.block-btn:hover { background: #fee2e2; color: #7f1d1d; }
body.dark .mini-btn { border-color: #4a5568; color: #a7b4c4; }
body.dark .mini-btn:hover { background: #3d4a5c; color: #e2e8f0; }
body.dark .mini-btn.push-btn { color: #67e8f9; border-color: #155e75; }
body.dark .mini-btn.push-btn:hover { background: #164e63; color: #cffafe; }
body.dark .mini-btn.block-btn { color: #fca5a5; border-color: #7f1d1d; }
body.dark .mini-btn.block-btn:hover { background: #4a3040; color: #fecaca; }

/* 屏蔽时长选择菜单（跟随行内按钮弹出） */
.block-menu {
  position: fixed;
  z-index: 9999;
  width: 150px;
  padding: 6px;
  border-radius: 6px;
  background: var(--panel, #fff);
  border: 1px solid var(--border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.block-menu.hidden { display: none; }
.block-menu-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 2px 4px 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
  word-break: break-all;
}
.block-menu-item {
  text-align: left;
  font-size: 12px;
  padding: 5px 8px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.block-menu-item:hover { background: var(--row-stripe); }
.block-menu-item.cancel { color: var(--text-soft); border-top: 1px solid var(--border); border-radius: 0; }
body.dark .block-menu { background: #3b4757; }
body.dark .block-menu-item:hover { background: #44516a; }

/* 屏蔽列表里的剩余时长 */
.blocked-left {
  display: block;
  font-size: 10px;
  font-style: normal;
  color: var(--text-soft);
  margin-top: 1px;
}

.net-cell {
  display: inline-flex;
  flex-direction: column;
  font-size: 11px;
  line-height: 1.2;
  color: var(--text-muted);
}
.net-cell .net-up { color: #ef4444; }
.net-cell .net-down { color: #10b981; }

.borrow-tag {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 2px;
  background: #f3f4f6;
  color: var(--text-muted);
}
.borrow-tag.cheap { background: #d1fae5; color: #065f46; }
.borrow-tag.dear  { background: #fee2e2; color: #991b1b; }

.hide-btn {
  border: 1px solid var(--border-strong);
  background: #fff;
  border-radius: 2px;
  padding: 1px 8px;
  font-size: 10px;
  cursor: pointer;
  color: var(--text-muted);
}
.hide-btn:hover { background: #f3f4f6; color: var(--text); }

/* 报警控制 */
.alert-th { width: 54px; }
.switch-label.alert-enable input { accent-color: var(--primary); }
.switch-label.alert-mute input { accent-color: #6b7280; }

/* 收藏行高亮（勾选后持续显示） */
.data-table tbody tr.starred td {
  background: #fffbeb !important;
}
.data-table tbody tr.starred td:first-child {
  box-shadow: inset 4px 0 0 #f59e0b;
}
.data-table tbody tr.starred:hover td { background: #fef3c7 !important; }

/* 差价报警整行高亮（即使静音也保留） */
.data-table tbody tr.alert-row td {
  background: #fee2e2 !important;
  color: #7f1d1d;
  font-weight: 600;
}
.data-table tbody tr.alert-row td.cell-spread { color: #b91c1c; }
.data-table tbody tr.alert-row td.cell-total { color: #7f1d1d !important; }
.data-table tbody tr.alert-row td:first-child {
  box-shadow: inset 4px 0 0 #dc2626;
}
.data-table tbody tr.alert-row:hover td { background: #fecaca !important; }

.empty-tip {
  text-align: center;
  color: var(--text-soft);
  padding: 30px 0;
  font-size: 12px;
}
.empty-tip.hidden { display: none; }

/* 隐藏行 */
.data-table tbody tr.hidden td { opacity: 0.35; }

/* 闪烁高亮（数据更新） */
@keyframes flash {
  0% { background: rgba(20, 184, 166, 0.18); }
  100% { background: transparent; }
}
.data-table tbody tr.flash td { animation: flash 0.6s ease-out; }

/* 无套利机会行（搜索定位用） */
.data-table tbody tr.no-arb td { color: var(--text-soft); }
.data-table tbody tr.no-arb td.cell-spread { color: var(--text-soft); }

/* 顶部轻提示 */
.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 2000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  max-width: 80vw;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 市值列 ===== */
.col-mcap { width: 78px; text-align: left; }
.cell-mcap {
  text-align: left;
  font-variant-numeric: tabular-nums;
  color: #6b7280;
  white-space: nowrap;
}

/* ===== 过滤菜单 ===== */
.filter-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.filter-label { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.filter-label-2 { margin-left: 14px; }
.filter-unit { font-size: 11px; color: var(--text-soft); }
.filter-hint { font-size: 11px; color: var(--text-soft); }
.filter-note { display: block; padding-top: 2px; border-top: 1px dashed #eef0f3; }

/* 过滤弹窗（顶栏「过滤」按钮打开） */
.filter-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.filter-overlay.hidden { display: none; }
.filter-dialog {
  background: #fff;
  border-radius: 10px;
  min-width: 560px;
  max-width: 92vw;
  max-height: 86vh;
  overflow: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.28);
}

/* 盘口金额两行：上行=第一档，下行=前5档总和。
   颜色由 .bt-* / .st-* class 在浅/深模式下分别定义：
   浅色模式：浅底色 + 深字；深色模式：深底色 + 白字（在 body.dark 下覆盖）。
   total-sub 继承对应字色。 */
.cell-total {
  border-radius: 4px;
}
.total-sub {
  display: block;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

/* ===== 深色主题（浅灰蓝底） ===== */
body.dark {
  --bg: #2b3542;
  --panel: #34404f;
  --border: #435060;
  --border-strong: #56637a;
  /* 深色底上的文字整体提亮，保证对比度（原 #e5e9ef/#a8b3c2/#7c8899 偏灰暗看不清） */
  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-soft: #a7b4c4;

  /* 价差色在深底上要提亮，原 #ef4444 发闷 */
  --spread-color: #fda4af;

  --row-hover: #3d4a5c;
  --row-stripe: #384453;

  --chip-off-bg: #414d5e;
  --chip-off-fg: #b6c2d0;
  --chip-off-bd: #56637a;
}

/* ===== 深色模式：语义色提亮（原色都是为浅底设计的深色，压在深底上对比度不足）===== */
body.dark .cell-price.buy-price,
body.dark .net-role.buy,
body.dark .net-chip .nm.ok { color: #34d399; }   /* 买价/充提正常：绿 → 亮绿 */
body.dark .cell-price.sell-price,
body.dark .net-role.sell,
body.dark .net-chip .nm.bad { color: #fca5a5; }  /* 卖价/禁用：红 → 亮红 */
body.dark .cell-spread { color: #fda4af; }
body.dark .data-table thead th.col-spread { color: #fda4af; }
body.dark .symbol-cell { color: #2dd4bf; }       /* 币种：青 → 亮青 */
body.dark .net-cell .net-up { color: #fca5a5; }
body.dark .net-cell .net-down { color: #34d399; }
body.dark .sort-ind { color: #2dd4bf; }
body.dark .block-btn { color: #fca5a5; }
body.dark .mute-check { accent-color: #2dd4bf; }
body.dark .net-chip .nm.unk,
body.dark .net-chip .nm-sep { color: #9fb0c0; }
/* 次要信息/弱化行：用提亮后的 muted，别再用最暗的 soft */
body.dark .empty-tip,
body.dark .blocked-empty { color: var(--text-muted); }
body.dark .data-table tbody tr.no-arb td,
body.dark .data-table tbody tr.no-arb td.cell-spread { color: var(--text-muted); }
body.dark .data-table tbody tr.hidden td { opacity: 0.55; }   /* 原 0.35 在深底几乎看不见 */
body.dark .disclaimer { filter: brightness(0.92); }
body.dark .btn { background: #3d4a5c; }
body.dark .btn:hover { background: #47556a; }
body.dark .search-input, body.dark .num-input, body.dark .select {
  background: #3d4a5c;
  color: var(--text);
  border-color: var(--border-strong);
}
body.dark .switch { background: #56637a; }
body.dark .data-table thead th {
  background: #3b4757;
  color: #dde5ee;
  border-bottom-color: var(--border-strong);
  border-right-color: var(--border);
}
body.dark .data-table thead th.sortable:hover { background: #44516a; }
body.dark .data-table tbody td {
  border-bottom-color: #404c5c;
  border-right-color: #3d4959;
}
body.dark .cell-price, body.dark .ex-tag { color: var(--text); }
/* .cell-total 不加这行：金额格由 .bt-*/.st-* class 直接控色（深色模式覆盖为深底+白字，强对比）*/

/* ===== 深色模式金额档：深底色 + 白字，让金额格在深色行底上一眼可见 =====
   app.js 注入的 .bt-* / .st-* 在浅色模式下用浅底深字；这里在 body.dark 下完全反转配色。
   阶梯：st-1 最浅 → st-6 最深；bt 同理。文字一律用白，bt-5/bt-6 因底色更亮用深字保证对比度。 */
body.dark .bt-1 { background: #14532d; color: #ffffff; }
body.dark .bt-2 { background: #166534; color: #ffffff; }
body.dark .bt-3 { background: #16a34a; color: #ffffff; }
body.dark .bt-4 { background: #4ade80; color: #052e16; }
body.dark .bt-5 { background: #86efac; color: #052e16; }
body.dark .bt-6 { background: #bbf7d0; color: #052e16; }
body.dark .st-1 { background: #7f1d1d; color: #ffffff; }
body.dark .st-2 { background: #991b1b; color: #ffffff; }
body.dark .st-3 { background: #b91c1c; color: #ffffff; }
body.dark .st-4 { background: #dc2626; color: #ffffff; }
body.dark .st-5 { background: #ef4444; color: #ffffff; }
body.dark .st-6 { background: #fca5a5; color: #450a0a; }
/* total-sub（下行小字）跟随单元格的字色 */
body.dark .bt-1 .total-sub, body.dark .bt-2 .total-sub, body.dark .bt-3 .total-sub { color: #ffffff; }
body.dark .bt-4 .total-sub, body.dark .bt-5 .total-sub, body.dark .bt-6 .total-sub { color: #052e16; }
body.dark .st-1 .total-sub, body.dark .st-2 .total-sub, body.dark .st-3 .total-sub,
body.dark .st-4 .total-sub, body.dark .st-5 .total-sub { color: #ffffff; }
body.dark .st-6 .total-sub { color: #450a0a; }
body.dark .cell-fee { color: var(--text-muted); }
body.dark .cell-mcap { color: var(--text-muted); }   /* 市值也是数据列，别用最暗的 soft */
body.dark .blocked-head { background: #3b4757; }
body.dark .blocked-item { border-bottom-color: #404c5c; }
body.dark .net-side + .net-side { border-top-color: #404c5c; }
body.dark .filter-note { border-top-color: #404c5c; }
body.dark .net-modal { background: var(--panel); }
body.dark .net-modal-hd, body.dark .net-modal-ft { border-color: var(--border); }
body.dark .net-modal-ex { color: var(--text); }
body.dark .net-modal-x { background: #3d4a5c; color: var(--text-muted); }
body.dark .net-modal-x:hover { background: #47556a; }
body.dark .net-chip { background: #3d4a5c; border-color: var(--border); color: var(--text); }
body.dark .net-chip.unk { background: #384453; border-color: var(--border-strong); color: var(--text-muted); }
body.dark .block-btn { background: #3d4a5c; }
body.dark .block-btn:hover { background: #4a3040; }
body.dark .borrow-tag { background: #3d4a5c; color: var(--text-muted); }
body.dark .borrow-tag.cheap { background: #1f3d33; color: #6ee7b7; }
body.dark .borrow-tag.dear { background: #45262b; color: #fca5a5; }
body.dark .hide-btn { background: #3d4a5c; }
body.dark .hide-btn:hover { background: #47556a; color: var(--text); }
body.dark .toolbar-pop { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
body.dark .statusbar { color: var(--text-muted); }

/* ===== 登录门 ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}
.login-overlay.hidden { display: none; }
.login-card {
  width: 320px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 22px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.login-title { font-size: 18px; font-weight: 800; text-align: center; letter-spacing: 1px; }
.login-sub { font-size: 11px; color: var(--text-muted); text-align: center; margin-bottom: 6px; font-weight: 500; }
.login-label { font-size: 11px; color: var(--text-muted); }
.login-input { width: 100%; height: 30px; }
.login-tip { min-height: 15px; font-size: 11px; color: #dc2626; text-align: center; }
.login-btn { width: 100%; height: 32px; margin-top: 2px; }
.login-foot { font-size: 10px; color: var(--text-soft); text-align: center; margin-top: 4px; font-weight: 500; }

/* ===== 账号/设置弹窗 ===== */
.settings-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
/* 二级菜单面板切换（hidden 类按组件单独定义，这里不能漏） */
.settings-pane.hidden { display: none; }

/* 设置二级菜单 tabs */
.settings-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 14px 0;
  border-bottom: 1px solid var(--border);
}
.settings-tab {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
}
.settings-tab:hover { color: var(--text); }
.settings-tab.on {
  background: var(--row-stripe);
  border-color: var(--border);
  color: var(--text);
}
body.dark .settings-tab.on { background: #3b4757; color: #e2e8f0; }

/* 推送条件表单 */
.push-label {
  flex: 0 0 76px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.account-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  cursor: pointer;
}
.account-item.current { border-color: var(--primary); background: var(--row-hover); }
.account-item:hover { background: var(--row-hover); }
.account-name { font-size: 13px; font-weight: 700; }
.account-current-tag { font-size: 10px; color: var(--primary); font-weight: 700; }
.account-actions { display: flex; gap: 4px; }
.account-add { display: flex; gap: 6px; }
.account-add .search-input { flex: 1; width: auto; }

/* 管理员密码 / 账号管理 */
.account-admin-tag {
  font-size: 10px;
  color: #7c3aed;
  font-weight: 700;
  margin-left: 4px;
  padding: 1px 5px;
  border: 1px solid #ddd6fe;
  border-radius: 3px;
  background: #f5f3ff;
}
.admin-auth {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  background: var(--row-stripe);
}
.admin-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.admin-row .search-input { flex: 1; min-width: 0; }
/* 非管理员提示 */
.admin-notice {
  font-size: 11px;
  font-weight: 600;
  color: var(--disclaimer-text);
  background: var(--disclaimer-bg);
  border-radius: 4px;
  padding: 6px 8px;
  line-height: 1.5;
}
body.dark .account-admin-tag { background: #3d2d63; border-color: #6d28d9; }
body.dark .admin-auth { background: #384453; }

/* ===== Astro 推送设置 ===== */
.push-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
  padding: 8px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 4px;
  background: var(--row-stripe);
}
.push-title {
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.push-state {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
}
.push-state.ok { color: #059669; }
body.dark .push-state.ok { color: #34d399; }
.push-row { margin: 0; }
.push-prefix { flex: 0 0 90px !important; }
.push-tip {
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
  word-break: break-all;
}
