/* ==========================================================================
   ChartsBTC · 5m 盘口归档与单侧盈亏测算
   视觉体系参照 BTC5Mins/public/styles.css（同源 token、卡片、面板、标签页、
   开关、按钮与表单控件），仅调整布局以适配「图表 + 测算器」的归档分析页。
   ========================================================================== */

:root {
  --bg: #101010;
  --bg2: #121212;
  --border: rgba(255, 255, 255, 0.13);
  --text: #f2f2f2;
  --muted: #8a8f98;
  --cyan: #22d3ee;
  --cyan-dim: rgba(34, 211, 238, 0.15);
  --green: #4ade80;
  --red: #f87171;
  --amber: #fbbf24;
  --blue: #3b82f6;
  --font: "Inter", system-ui, -apple-system, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  background-image: radial-gradient(
      ellipse 120% 80% at 50% -20%,
      rgba(34, 211, 238, 0.08),
      transparent 50%
    ),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px, 24px 24px;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
}

.hidden,
[hidden] {
  display: none !important;
}

.app {
  max-width: 1380px;
  margin: 0 auto;
  padding: 16px 20px 36px;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.muted {
  color: var(--muted);
}

/* ── 顶部标题带（BTC5Mins .card-body / .event-title 体系） ─────────────── */

.card-body {
  padding: 12px 22px;
  border-radius: 14px;
  border: 0.5px solid var(--border);
  background: linear-gradient(145deg, #463939 0%, #0c0c0c 100%);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.06), 0 20px 50px rgba(0, 0, 0, 0.45);
}

/* 页头行：左侧标题卡 + 右侧「盘归档 / 实时盘口」两个独立卡片（BTC5Mins .card-header 结构） */
.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 16px;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: center;
  flex: 1 1 360px;
  min-width: 0;
  padding: 12px 22px;
}

.page-head__titles {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

/* 页头右侧：实时盘口（靠右排列，随宽度自动换行） */
.page-head__panels {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
}

.page-head__panels > .card {
  flex: 0 1 auto;
  min-width: 0;
  border-radius: 12px;
  /* 与下方图表卡（.blue-card / .chart-card）同一半透明白色渐变 */
  background: linear-gradient(145deg, #6464642b 0%, #0c0c0c0a 100%);
  box-shadow: none;
}

.page-head__panels .panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  padding: 10px 12px;
  /* 半透明底：内嵌在卡片里，形成层次并透出页面网格 */
  margin: 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border-top: none;
  border-bottom: none;
}

/* 盘归档：图表标题行右侧的裸切换器（无卡片、无边框、无文案） */
.chart-card__head {
  align-items: center;
  gap: 6px 16px;
}

.chart-card__market {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex;
  align-items: stretch;
  gap: 4px;
  min-width: 0;
}

.chart-card__market .btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 1.15rem;
}

.chart-card__market select {
  min-width: 210px;
  height: 40px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chart-card__market select:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}

.chart-card__market select option {
  background: var(--bg2);
  color: var(--text);
}

.event-title-wrap {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-width: 0;
}

.event-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.event-title-link {
  color: inherit;
  align-self: flex-start;
  max-width: 100%;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.event-title-date {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-all;
}

.event-title-date .mono {
  color: #a5f3fc;
  font-weight: 600;
}

.live-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-width: 0;
  flex-wrap: wrap;
}

.live-dot i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
  animation: pulse 2s ease-in-out infinite;
  flex: 0 0 auto;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.45;
  }
}

/* ── 主栅格：图表 + 实时盘口 ─────────────────────────────────────────── */

/* ── 卡片 / 面板 ─────────────────────────────────────────────────────── */

.card {
  position: relative;
  border-radius: 14px;
  border: 0.5px solid var(--border);
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.06), 0 20px 50px rgba(0, 0, 0, 0.45);
}

.yellow-card,
.green-card,
.blue-card {
  background: linear-gradient(145deg, #6464642b 0%, #0c0c0c0a 100%);
}

.market-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-right: 12px;
}

.market-title-row .market-title {
  padding: 12px;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.panel {
  padding: 12px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border);
}

.card > .panel:last-child {
  border-bottom: none;
}

/* ── 主图表 ──────────────────────────────────────────────────────────── */

.chart-card {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.btc-updown-tick-chart {
  /* 左右不留边距、无边框、无圆角（贴卡片两侧） */
  margin: 0 0 8px;
  padding: 4px;
  border: none;
  border-radius: 0;
  /* 半透明黑底放在这一层，内层画布区只负责裁切 */
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.btc-updown-tick-chart__legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px 16px;
  min-width: 0;
  padding: 0 12px 12px;
  font-size: 10px;
  line-height: 1.2;
  color: var(--muted);
}

.btc-updown-tick-chart__legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.12s ease, opacity 0.12s ease;
}

.btc-updown-tick-chart__legend-item:hover {
  color: var(--text);
}

.btc-updown-tick-chart__legend-item.is-hidden {
  opacity: 0.42;
}

.btc-updown-tick-chart__legend-item.is-hidden > span:last-child {
  text-decoration: line-through;
}

.btc-updown-tick-chart__swatch {
  display: inline-block;
  flex: 0 0 auto;
  width: 10px;
  height: 3px;
  border-radius: 1px;
}

.btc-updown-tick-chart__wrap {
  position: relative;
  width: 100%;
  flex: 1 1 0;
  min-height: 320px;
  border-radius: 8px;
  overflow: hidden;
  background: transparent;
}

.btc-updown-tick-chart__wrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.btc-updown-tick-chart__wrap--main {
  height: calc(clamp(300px, 42vh, 460px) + 50px);
  flex: 1 1 auto;
}

/* ── 实时盘口：纯文字五栏（Up / Down / 开盘 / Chainlink / TWAP） ─────── */

.live-card {
  display: flex;
  flex-direction: column;
}

.live-card > .panel {
  display: flex;
  align-items: center;
  height: 100%;
}

.market-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 10px;
}

.market-board__card {
  appearance: none;
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--line, rgba(255, 255, 255, 0.08));
  background: rgba(15, 23, 42, 0.55);
  color: inherit;
  border-radius: 10px;
  padding: 8px 10px;
  min-width: 0;
}

.market-board__card.is-focus {
  border-color: var(--cyan, #22d3ee);
  box-shadow: inset 0 0 0 1px var(--cyan, #22d3ee);
}

.page-head-row,
.chart-card,
#pair-calculator {
  position: relative;
}

.page-head-row.is-market-loading::after,
.chart-card.is-market-loading::after,
#pair-calculator.is-market-loading::after {
  content: "加载中…";
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: var(--muted, #94a3b8);
  font-size: 13px;
  letter-spacing: 0.08em;
  pointer-events: none;
}

.market-board__name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.market-board__row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
}

.market-board__row span:last-child {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 980px) {
  .market-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.live-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px 26px;
  width: 100%;
}

.live-stat {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.live-stat__label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
}

.live-stat--up .live-stat__label,
.live-stat--down .live-stat__label {
  text-transform: uppercase;
}

.live-stat--up .live-stat__label {
  color: var(--cyan);
}

.live-stat--down .live-stat__label {
  color: var(--red);
}

.live-stat__value {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--text);
  word-break: break-all;
}

.live-stat--up .live-stat__value {
  color: #e0fbff;
}

.live-stat--down .live-stat__value {
  color: #fecaca;
}

.live-stat__value--amber {
  color: var(--amber);
}

/* ── 通用表单控件（BTC5Mins .pair-strategy-* / .field） ───────────────── */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  min-width: 0;
}

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
}

.field input[type="text"]:focus,
.field input[type="number"]:focus,
.field select:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}

.field select {
  cursor: pointer;
}

.field select option {
  background: var(--bg2);
  color: var(--text);
}

.calc-select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  min-width: 5.5rem;
}

.calc-select:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}

/* 下拉框：统一自绘箭头，箭头与右边缘留出间距（避免原生箭头贴边） */
.chart-card__market select,
.field select,
.calc-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.75 4.75 6 8l3.25-3.25' fill='none' stroke='%238a8f98' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 12px 12px;
  padding-right: 30px;
}

.calc-input {
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.calc-input--tight {
  width: 84px;
  min-height: 36px;
  padding: 6px 8px;
  text-align: center;
  -moz-appearance: textfield;
}

.calc-input--tight::-webkit-outer-spin-button,
.calc-input--tight::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calc-input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}

/* ── 按钮（BTC5Mins .btn / .pair-strategy-save / .limit-buy-submit） ──── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.25;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease,
    filter 0.12s ease, transform 0.12s ease;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.btn:active {
  transform: scale(0.99);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.btn--icon {
  flex: 0 0 auto;
  width: 34px;
  padding: 8px 0;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.35);
}

.btn--icon:hover {
  background: rgba(34, 211, 238, 0.2);
  border-color: rgba(34, 211, 238, 0.55);
}

.btn--icon:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  box-shadow: none;
}

.btn--ghost:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
}

.pair-strategy-save {
  background: rgba(99, 102, 241, 0.35);
  border-color: rgba(129, 140, 248, 0.4);
  color: #eef2ff;
}

.pair-strategy-save:hover {
  background: rgba(99, 102, 241, 0.5);
  border-color: rgba(129, 140, 248, 0.65);
}

.pair-strategy-delete {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fee2e2;
}

.pair-strategy-delete:hover {
  background: rgba(239, 68, 68, 0.34);
  border-color: rgba(248, 113, 113, 0.55);
}

/* ── 测算器卡片 ──────────────────────────────────────────────────────── */

.pair-calculator {
  margin-top: 0;
  display: flex;
  flex-direction: column;
}

.pair-calculator__head {
  border-bottom: 0.5px solid var(--border);
  gap: 10px 18px;
  padding: 8px 12px 8px 0;
}

/* 执行工具行（确认计算下方）：计算全量 / 时间跨度 / 保存 */
.pair-strategy-bar__row.pair-strategy-bar__row--tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 10px;
}

/* 覆盖 .pair-strategy-bar__row > * 的 100% 宽，让三个控件并排 */
.pair-strategy-bar__row.pair-strategy-bar__row--tools > * {
  width: auto;
  min-width: 0;
  flex: 0 1 auto;
}

.pair-strategy-bar__row--tools .field--limit {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  width: auto;
}

.pair-strategy-bar__row--tools .field--limit .calc-control {
  width: 92px;
  min-height: 34px;
}

.pair-strategy-bar__row--tools .pair-calculator__refresh {
  padding: 8px 14px;
}

/* 锁开关位于「方案」标题右侧 */
.pair-calculator__block-title .calc-strategy-lock {
  font-size: 11px;
}

.pair-calculator__title {
  font-size: 17px !important;
  font-weight: 700;
}

.pair-limit-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.pair-calculator__body {
  border-top: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px 16px;
}

/* 左右布局：左 24% 参数（列内滚动），右 76% 计算结果与图表（BTC5Mins 双列结构） */
.pair-calculator__layout {
  display: grid;
  grid-template-columns: minmax(0, 24fr) minmax(0, 76fr);
  gap: 16px;
  align-items: stretch;
  min-width: 0;
}

/* 左列高度跟随右列（结果区完整展开不内滚），参数在列内滚动 */
.pair-calculator__params-col {
  position: relative;
  min-width: 0;
  min-height: 0;
}

.pair-calculator__params {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.pair-calculator__params::-webkit-scrollbar {
  width: 8px;
}

.pair-calculator__params::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.pair-calculator__params .pair-calculator__block:last-of-type {
  margin-bottom: 0;
}

/* 双列布局下左列较窄：策略栏、买入模型与卖出一律单列堆叠；窄屏回到单列时恢复原布局 */
@media (min-width: 1181px) {
  .pair-calculator__params .pair-strategy-bar__row,
  .pair-calculator__params .pair-calculator__adv-cols--models {
    grid-template-columns: minmax(0, 1fr);
  }

  .pair-calculator__params .pair-calculator__adv-col--sell {
    grid-column: 1;
    grid-row: auto;
  }

}

.pair-calculator__results {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* 右列：两张图 + 买入明细均为固定高度，整块完整显示（不内滚） */
.pair-calculator__results .chart-wrap--batch {
  flex: 0 0 auto;
  height: 400px;
}

.pair-calculator__results .pair-calculator__detail {
  flex: 0 0 auto;
  height: 400px;
  max-height: none;
}

.pair-calculator__block {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.pair-calculator__block:last-of-type {
  border-bottom: none;
  margin-bottom: 4px;
  padding-bottom: 0;
}

/* 进阶块：下边框去掉，「方案名称（保存）」上方不再画分隔线 */
.pair-calculator__block--adv {
  border-bottom: none;
}

/* 方案块：底部边框交给折叠分割线 */
.pair-calculator__block--plan {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 10px;
}

/* 基础块：加边框与底色，做成独立卡片 */
.pair-calculator__block.pair-calculator__block--basic {
  padding: 10px 12px 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
}

/* 折叠 / 展开分割线：确认计算下方，居中文字，两侧细线 */
.pair-calculator__collapse {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 6px;
}

.pair-calculator__collapse-line {
  flex: 1 1 auto;
  height: 1px;
  background: var(--border);
}

.pair-calculator__collapse-btn {
  flex: 0 0 auto;
  padding: 2px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.pair-calculator__collapse-btn:hover {
  color: var(--text);
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(34, 211, 238, 0.1);
}

.pair-calculator__collapse-btn:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.55);
  outline-offset: 2px;
}

/* ── 缓存区（折叠条下方，常驻可见） ───────────────────────────── */

/* 缓存区与「方案 / 基础 / 进阶」同级：无边框、无底色，仅跟随区块标题 */
.pair-calculator__cache {
  margin-top: 8px;
}

/* 缓存块位于配置下方：与上方内容留出正常块间距 */
.pair-calculator__block--cache {
  margin-top: 16px;
}

/* 展开配置后：缓存与上方配置之间加一条分隔线（折叠态不画，避免与展开条双线） */
.pair-calculator--config-open .pair-calculator__block--cache {
  border-top: 1px solid var(--border);
  padding-top: 45px;
}

/* 标题行：左侧「方案缓存」，右侧「提示 + 保存缓存」，保持单行 */
.pair-calculator__block--cache .pair-calculator__block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}

/* 标题文字不参与收缩 */
.pair-calculator__block--cache .pair-calculator__block-title > span:first-child {
  flex: 0 0 auto;
  white-space: nowrap;
}

.pair-calculator__cache-head-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

.pair-calculator__cache-head-right .pair-calculator__refresh {
  flex: 0 0 auto;
}

.pair-calculator__cache-msg {
  margin: 0;
  font-size: 10px;
  min-height: 0;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.pair-calculator__cache-msg--warn {
  color: var(--amber);
}

.pair-calculator__cache-msg--ok {
  color: var(--green);
}

.pair-calculator__cache-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  /* 不限制高度：卡片全部展开，交给外层参数列统一滚动 */
  max-height: none;
  overflow: visible;
}

.pair-calculator__cache-item {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.28);
  cursor: pointer;
}

.pair-calculator__cache-item:focus-visible {
  outline: 2px solid rgba(34, 211, 238, 0.5);
  outline-offset: 1px;
}

.pair-calculator__cache-item--active {
  border-color: rgba(34, 211, 238, 0.6);
  background: rgba(34, 211, 238, 0.08);
}

.pair-calculator__cache-item-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.pair-calculator__cache-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pair-calculator__cache-total {
  flex: 0 0 auto;
  font-size: 16px;
  font-weight: 600;
}

.pair-calculator__cache-total--pos {
  color: var(--green);
}

.pair-calculator__cache-total--neg {
  color: var(--red);
}

.pair-calculator__cache-meta {
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.45;
  color: var(--muted);
}

.pair-calculator__cache-meta--foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pair-calculator__cache-del {
  flex: 0 0 auto;
  padding: 0 2px;
  border: none;
  background: none;
  color: var(--red);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.pair-calculator__cache-del:hover {
  color: #fca5a5;
  text-decoration: underline;
}

.pair-calculator__cache-badge {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: var(--amber);
  font-size: 9px;
}

.pair-calculator__cache-empty {
  margin: 8px 0 0;
  font-size: 10px;
}

/* 折叠内容区：工具行 + 基础 + 进阶 */
.pair-calculator__config {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 区块标题右侧：状态提示 + 控件（与「方案缓存」右侧同款排布） */
.pair-calculator__title-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
}

/* 区块标题左侧图标 */
.pair-calculator__title-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 16px;
}

.pair-calculator__title-icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  opacity: 0.85;
}

.pair-calculator__block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}

.pair-calculator__block-lead {
  margin: -2px 0 12px;
  font-size: 11px;
  line-height: 1.5;
  max-width: 78rem;
}

/* 方案：策略栏（BTC5Mins .pair-strategy-bar） */

.pair-strategy-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.pair-strategy-bar__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 340px));
  justify-content: start;
  gap: 10px;
  width: 100%;
  align-items: stretch;
}

.pair-strategy-bar__row--actions {
  grid-template-columns: repeat(2, minmax(0, 190px));
}

/* 确认计算：独占一行，100% 宽 */
.pair-strategy-bar__row--submit {
  grid-template-columns: minmax(0, 1fr);
}

.pair-strategy-bar__row--submit .pair-calculator__submit {
  width: 100%;
}

.pair-strategy-bar__row > * {
  min-width: 0;
  width: 100%;
}

.pair-strategy-bar__row .btn {
  padding: 10px 12px;
}

/* 已存方案下拉、方案名称输入：统一 40px 高 */
.pair-strategy-bar__row .field input,
.pair-strategy-bar__row .field select {
  height: 40px;
  min-height: 40px;
  padding-top: 0;
  padding-bottom: 0;
}

.field--preset-select select {
  min-width: 0;
}

/* 「已存」标题 + 右侧加载/错误提示 */
.field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.pair-calculator__title-right .pair-calculator__preset-msg {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
}

.pair-calculator__preset-msg {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  min-height: 0;
  /* 超长方案名统一省略号裁剪（不换行、不撑破标题行） */
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pair-calculator__preset-msg--warn {
  color: var(--amber);
}

.pair-calculator__preset-msg--ok {
  color: var(--green);
}

/* 基础：字段网格 */

.pair-calculator__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 12px 14px;
  align-items: end;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.calc-field__label {
  color: var(--muted);
  line-height: 1.35;
}

.calc-field--inline {
  flex: 0 0 auto;
  align-self: center;
}

.calc-control {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.calc-control:focus-within {
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}

.calc-control--tight {
  min-height: 36px;
  width: 84px;
  flex: 0 0 auto;
}

.calc-control--tight input {
  text-align: center;
}

.calc-control__input {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  padding: 9px 0;
  border: none;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  -moz-appearance: textfield;
}

.calc-control__input:focus {
  outline: none;
}

/* 位于 .field 内的 calc-control（如「时间跨度」）：去掉输入框自身的边框与底色，避免双层边框 */
.field .calc-control input {
  width: 100%;
  padding: 9px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
}

.field .calc-control input:focus {
  outline: none;
  box-shadow: none;
}

.calc-control__input::-webkit-outer-spin-button,
.calc-control__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.calc-control__unit {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}

/* 进阶：标签页（BTC5Mins .orders-tabs） */

.pair-calculator__tabs {
  display: flex;
  gap: 6px;
  max-width: 440px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
}

.pair-calculator__tab {
  flex: 1;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.pair-calculator__tab:hover {
  color: var(--text);
}

.pair-calculator__tab--active {
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
}

.pair-calculator__tab:disabled {
  opacity: 0.72;
  cursor: not-allowed;
}

.pair-calculator__tab:disabled:hover {
  color: var(--muted);
}

/* 进阶：两列（买入模型 / 卖出） */

.pair-calculator__adv-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.pair-calculator__adv-cols--models {
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
}

.pair-calculator__model-panel {
  grid-column: 1;
}

.pair-calculator__adv-col {
  min-width: 0;
}

.pair-calculator__adv-col--sell {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 执行栏：贴在卖出列底部（对应 BTC5Mins 侧栏表单 + 提交按钮的结构） */
.pair-calculator__adv-col--sell .calc-full-batch {
  align-self: flex-start;
}

.calc-box {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pair-calculator__col-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* 买入限价行 */

.pair-calculator__buy-limit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
}

.pair-calculator__buy-limit-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.pair-calculator__buy-limit-sep {
  color: var(--muted);
  user-select: none;
}

/* 字段组 */

.pair-calculator__fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px 14px;
  align-items: end;
}

/* 分组框：相关字段（如「允许买时 |BTC 差价| ≥ / <」）用一个边框包起来 */
.pair-calculator__fields--group {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
}

.calc-fields--angles {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.pair-calculator__fields-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
}

/* 分组内的字段网格（如 TWAP 弦线偏离率组里的角度参数）占满整行 */
.pair-calculator__fields-inline > .pair-calculator__fields {
  flex: 1 1 100%;
  width: 100%;
}

.pair-calculator__inline-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

/* 滑点行：仅勾选项，无分组边框、无输入框 */
.pair-calculator__slip-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

/* 勾选项（BTC5Mins .pair-buy-limit-gtc-label 体系） */

.pair-calculator__check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 2px 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  min-width: 0;
}

.pair-calculator__fields-inline .pair-calculator__check {
  flex: 1 1 260px;
  min-width: 0;
}

/* 配置勾选框：自绘样式，禁用态仍保留青色，避免变成灰块看不清 */
.pair-calculator__check input {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin: 2px 0 0;
  flex: 0 0 auto;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(0, 0, 0, 0.35);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px 11px;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.pair-calculator__check input:hover:not(:disabled) {
  border-color: rgba(34, 211, 238, 0.6);
}

.pair-calculator__check input:checked {
  border-color: rgba(34, 211, 238, 0.8);
  background-color: rgba(34, 211, 238, 0.22);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.4 6.3 4.8 8.7 9.6 3.5' fill='none' stroke='%2322d3ee' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* 锁定（disabled）时保持颜色可辨，只轻微降亮 */
.pair-calculator input[type="checkbox"]:disabled {
  opacity: 1;
  cursor: not-allowed;
}

.pair-calculator__check input:disabled {
  border-color: rgba(255, 255, 255, 0.18);
  background-color: rgba(255, 255, 255, 0.04);
}

.pair-calculator__check input:checked:disabled {
  border-color: rgba(34, 211, 238, 0.5);
  background-color: rgba(34, 211, 238, 0.16);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.4 6.3 4.8 8.7 9.6 3.5' fill='none' stroke='%2367e8f9' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.pair-calculator__check:hover > span {
  color: var(--text);
}

.limit-buy-submit {
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 10px;
}

.limit-buy-submit:hover {
  background: #4a8ff7;
  border-color: #4a8ff7;
  filter: brightness(1.02);
}

.limit-buy-submit:active {
  transform: scale(0.99);
}

.field--limit {
  width: 140px;
}

.pair-calculator__refresh {
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.35);
}

.pair-calculator__refresh:hover {
  background: rgba(34, 211, 238, 0.2);
  border-color: rgba(34, 211, 238, 0.55);
}

/* 开关：策略锁 / 计算全量（BTC5Mins .pair-limit-switch 体系） */

.calc-strategy-lock,
.calc-full-batch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  white-space: nowrap;
}

.calc-strategy-lock input,
.calc-full-batch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.calc-strategy-lock__ui,
.calc-full-batch__ui {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid var(--border);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.calc-strategy-lock__ui::after,
.calc-full-batch__ui::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 2px;
  width: 16px;
  height: 16px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease;
}

.calc-strategy-lock input:checked + .calc-strategy-lock__ui,
.calc-full-batch input:checked + .calc-full-batch__ui {
  background: rgba(59, 130, 246, 0.45);
  border-color: rgba(59, 130, 246, 0.65);
}

.calc-strategy-lock input:checked + .calc-strategy-lock__ui::after,
.calc-full-batch input:checked + .calc-full-batch__ui::after {
  transform: translateX(18px);
}

.calc-strategy-lock input:focus-visible + .calc-strategy-lock__ui,
.calc-full-batch input:focus-visible + .calc-full-batch__ui {
  outline: 2px solid rgba(59, 130, 246, 0.75);
  outline-offset: 2px;
}

.calc-strategy-lock__label,
.calc-full-batch__label {
  color: var(--muted);
  line-height: 1.2;
}

.calc-strategy-lock:hover .calc-strategy-lock__label,
.calc-full-batch:hover .calc-full-batch__label {
  color: var(--text);
}

/* 锁定态（参数只读） */

.pair-calculator :disabled {
  cursor: not-allowed;
}

.pair-calculator input:disabled,
.pair-calculator select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* 批量提示 / 结论 / 结果 */

.pair-calculator__batch-hint {
  margin: 8px 0 4px;
  font-size: 11px;
  line-height: 1.55;
  max-width: 82rem;
}

.pair-calculator__verdict {
  margin: 0;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.35;
  min-height: 3em;
  display: flex;
  align-items: center;
}

.pair-calculator__verdict:empty {
  display: none;
}

.pair-calculator__verdict--profit {
  color: var(--green);
  background: rgba(74, 222, 128, 0.1);
  border-color: rgba(74, 222, 128, 0.35);
}

.pair-calculator__verdict--loss {
  color: var(--red);
  background: rgba(248, 113, 113, 0.08);
  border-color: rgba(248, 113, 113, 0.35);
}

.pair-calculator__verdict--neutral {
  color: var(--muted);
  background: rgba(0, 0, 0, 0.35);
}

.pair-calculator__verdict--warn {
  color: var(--amber);
  background: rgba(251, 191, 36, 0.08);
  border-color: rgba(251, 191, 36, 0.35);
}

.pair-calculator__batch-chart-title {
  margin: 12px 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.pair-calculator__batch-chart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin: 8px 0;
}

.pair-calculator__batch-chart-head .pair-calculator__batch-chart-title {
  margin: 0;
}

.chart-wrap {
  position: relative;
}

.chart-wrap--batch {
  height: clamp(280px, 38vh, 420px);
  padding: 8px;
  border-radius: 12px;
  border: 0.5px solid var(--border);
  /* 与下方「买入明细」日志同款半透明黑底 */
  background: rgba(0, 0, 0, 0.35);
}

.chart-wrap--batch canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.pair-calculator__float-buy-toggles {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  /* 无边框、无底色，仅保留勾选项本身 */
  padding: 0;
}

.pair-calculator__float-buy-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  user-select: none;
}

.pair-calculator__float-buy-toggle:hover {
  color: var(--text);
}

.pair-calculator__float-buy-toggle input {
  appearance: none;
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin: 0;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background-color: rgba(0, 0, 0, 0.35);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 11px 11px;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.pair-calculator__float-buy-toggle input:checked {
  border-color: rgba(34, 211, 238, 0.8);
  background-color: rgba(34, 211, 238, 0.22);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.4 6.3 4.8 8.7 9.6 3.5' fill='none' stroke='%2322d3ee' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.pair-calculator__batch-summary {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.3);
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.pair-calculator__detail {
  margin: 10px 0 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: min(60vh, 26rem);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* 买入明细：正数绿 / 负数红（其余列保持 muted） */
.pair-calculator__detail-num {
  color: var(--text);
  font-weight: 600;
}

.pair-calculator__detail-num--pos {
  color: var(--green);
}

.pair-calculator__detail-num--neg {
  color: var(--red);
}

.pair-calculator__detail:empty {
  display: none;
}

/* ── 页脚 ────────────────────────────────────────────────────────────── */

.footer-note {
  margin-top: 20px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--muted);
}

/* ── 登录 / CLOB 凭证页（与主页面同一 token 体系） ────────────────────── */

.login-app {
  min-height: 100dvh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 48px;
}

.login-wrap {
  width: 100%;
  max-width: 440px;
}

.poly-creds-wrap {
  max-width: 560px;
}

.login-card {
  margin-top: 0;
}

.ids-panel {
  padding: 18px 20px 20px;
  border-radius: 14px;
  border: 0.5px solid var(--border);
  background: linear-gradient(145deg, #6464642b 0%, #0c0c0c0a 100%);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.06), 0 20px 50px rgba(0, 0, 0, 0.45);
}

.ids-panel__head {
  margin-bottom: 14px;
}

.ids-panel__title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.ids-panel__desc {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.ids-panel__desc code {
  color: #a5f3fc;
}

.ids-panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

.ids-panel__btn {
  cursor: pointer;
  padding: 11px 20px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: #fff;
  background: var(--blue);
  border: 1px solid var(--blue);
  border-radius: 10px;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.ids-panel__btn:hover {
  background: #4a8ff7;
  border-color: #4a8ff7;
}

.ids-panel__btn:active {
  transform: scale(0.99);
}

.ids-panel__hint {
  font-size: 12px;
  color: var(--green);
}

.ids-panel__hint--err {
  color: var(--red);
}

.login-form {
  margin-top: 4px;
}

.login-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}

.login-label--spaced {
  margin-top: 14px;
}

.login-input {
  display: block;
  width: 100%;
  margin: 0;
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.45;
  font-family: inherit;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.login-input:hover {
  border-color: rgba(255, 255, 255, 0.22);
}

.login-input:focus {
  outline: none;
  border-color: rgba(34, 211, 238, 0.55);
  box-shadow: 0 0 0 3px var(--cyan-dim);
}

.poly-creds-back {
  margin: 0 0 10px;
  font-size: 12px;
}

.poly-creds-back a {
  color: var(--cyan);
  text-decoration: none;
}

.poly-creds-back a:hover {
  text-decoration: underline;
}

.poly-creds-result {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.poly-creds-result__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.poly-creds-result__title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.poly-creds-result__pre {
  margin: 0;
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.5;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--text);
}

.poly-creds-result__meta {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--muted);
}

.poly-creds-warn {
  margin: 12px 0 0;
  line-height: 1.5;
}

/* ── 响应式 ──────────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .pair-calculator__adv-cols--models {
    grid-template-columns: minmax(0, 1fr);
  }

  .pair-calculator__adv-col--sell {
    grid-column: 1;
    grid-row: auto;
  }

}

@media (max-width: 1180px) {
  .pair-calculator__layout {
    grid-template-columns: minmax(0, 1fr);
    height: auto;
  }

  .pair-calculator__params-col {
    position: static;
  }

  .pair-calculator__params {
    position: static;
    overflow: visible;
    padding-right: 0;
  }

  /* 窄屏单列：方案保存块下方不再单独画线（改由缓存块上边框分隔，避免两条） */
  .pair-calculator__block.pair-calculator__block--preset-save {
    padding-bottom: 16px;
    margin-bottom: 0;
  }

  /* 窄屏单列：缓存区底部与下方图表之间留出间距（+30px，不画分割线） */
  .pair-calculator__block.pair-calculator__block--cache {
    padding-bottom: 46px;
    margin-bottom: 0;
  }

  .pair-calculator__results .chart-wrap--batch {
    height: clamp(240px, 34vh, 340px);
  }

  .pair-calculator__results .pair-calculator__detail {
    height: calc(clamp(180px, 26vh, 300px) + 100px);
  }

  .page-head__panels {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .page-head__panels > .card {
    flex: 1 1 100%;
    width: 100%;
  }
}

@media (max-width: 960px) {
  .pair-calculator__adv-cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .pair-calculator__adv-col--sell {
    grid-column: 1;
    grid-row: auto;
  }
}

@media (max-width: 640px) {
  .app {
    padding: 12px 12px 28px;
  }

  .card-header.page-head-row {
    flex-direction: column;
  }

  .page-head {
    flex: 0 0 auto;
    padding: 12px 14px;
  }

  .page-head__panels {
    flex-direction: column;
  }

  .page-head__panels > .card {
    width: 100%;
  }

  /* 盘归档切换器：窄屏仍与「盘口时序」标题同排（右侧自适应） */
  .chart-card__head {
    flex-wrap: nowrap;
    gap: 6px 8px;
    row-gap: 6px;
  }

  .chart-card__head .market-title {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .chart-card__market {
    flex: 1 1 auto;
    margin-left: 8px;
  }

  .chart-card__market select {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 11px;
  }

  .event-title-link {
    font-size: 20px;
  }


  .pair-calculator__body {
    padding: 12px 10px 14px;
  }

  .pair-strategy-bar__row {
    grid-template-columns: 1fr;
  }

  .pair-calculator__grid {
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  }

  .pair-calculator__fields {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }

  /* 执行项并入标题行：标题右侧依次是 计算全量 / 时间跨度 / 保存 / 确认计算，随宽度逐行排 */
  .pair-calculator__head {
    justify-content: flex-start;
    align-items: center;
    gap: 8px 10px;
    padding: 6px 12px 6px 0;
  }

  .pair-calculator__head .pair-calculator__title {
    padding: 6px 0 6px 12px;
    width: auto;
  }

  .pair-strategy-bar__row--tools .field--limit .calc-control {
    width: 80px;
  }
}

/* ── ChartsBTC 专有：信号推送行 / 推送日志 ───────────────────────────── */

.pair-calculator__signal-push-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
}

.pair-calculator__signal-push-row .field {
  flex: 1 1 160px;
  min-width: 0;
}

/* 接口/密钥输入框：与其它参数同样的 calc-control 样式，撑满所在列 */
.pair-calculator__signal-push-row .field .calc-control {
  width: 100%;
  min-height: 40px;
}

/* 推送日志块：与「买入明细」同款边框 + 半透明黑底 */
.pair-calculator__signal-push-logs {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.35);
}

.pair-calculator__signal-push-logs .pair-calculator__col-title {
  margin: 0 0 6px;
  font-size: 13px;
}

.pair-calculator__signal-push-logs-hint {
  margin: 0 0 8px;
  font-size: 10px;
}

.pair-calculator__signal-push-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

/* 成功/失败：左侧色条 + 标签颜色（沿用改动前的标识） */
.pair-calculator__signal-push-log-list li {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left-width: 3px;
  border-left-color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  overflow-wrap: anywhere;
}

.pair-calculator__signal-push-log-list li.pair-calculator__signal-push-log--ok {
  border-left-color: #3dd68c;
}

.pair-calculator__signal-push-log-list li.pair-calculator__signal-push-log--fail {
  border-left-color: #f07178;
}

/* 成功「成功」绿、失败「失败」红 */
.pair-calculator__signal-push-log-list li.pair-calculator__signal-push-log--ok .signal-push-log__tag {
  color: #3dd68c;
}

.pair-calculator__signal-push-log-list li.pair-calculator__signal-push-log--fail .signal-push-log__tag {
  color: #f07178;
}

.pair-calculator__signal-push-log-list .signal-push-log__tag {
  font-weight: 700;
  margin-right: 6px;
}

.pair-calculator__signal-push-log-list .signal-push-log__time {
  color: var(--muted);
  margin-right: 6px;
}

.pair-calculator__signal-push-log-list .signal-push-log__err {
  display: block;
  margin-top: 2px;
  color: #f07178;
  word-break: break-word;
}

/* 单模型面板（ChartsBTC 没有低价买入面板）：宽屏时面板占满左列 + 右侧卖列 */
@media (min-width: 1101px) {
  .pair-calculator__adv-cols--models {
    grid-template-columns: minmax(0, 1fr) minmax(0, 260px);
  }
}

/* 图例为空时不占位（ChartsBTC 暂用 Chart.js 内置图例） */
#chart-legend:empty {
  display: none;
}

/* 「更新全部缓存」图标按钮（与保存缓存同排） */
/* 方案缓存底部按钮行：靠右 */
.pair-calculator__cache-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.pair-calculator__cache-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  color: var(--muted);
}

.pair-calculator__cache-refresh:hover {
  color: var(--cyan);
  border-color: rgba(34, 211, 238, 0.55);
}

.pair-calculator__cache-refresh:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.pair-calculator__cache-refresh-icon {
  width: 15px;
  height: 15px;
}

.pair-calculator__cache-refresh--busy .pair-calculator__cache-refresh-icon {
  animation: calc-cache-spin 0.9s linear infinite;
}

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

/* 触屏：输入控件字号 ≥16px，避免 iOS 聚焦输入框时自动放大页面 */
@media (pointer: coarse) {
  input,
  select,
  textarea {
    font-size: 13px !important;
  }
}

/* 缓存加载中：右侧每个结果区域各自的 loading 遮罩 */
.chart-wrap--batch {
  position: relative;
}

.chart-wrap--batch--loading::after,
.pair-calculator__detail--loading::after {
  content: "加载中…";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  animation: calc-cache-loading-pulse 1.1s ease-in-out infinite;
  pointer-events: none;
}

.pair-calculator__detail {
  position: relative;
}

@keyframes calc-cache-loading-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* 确认计算：计算中 loading 动画 */
.pair-calculator__submit--loading {
  position: relative;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.86);
  cursor: progress;
}

.pair-calculator__submit--loading::after {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 8px;
  vertical-align: -2px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  animation: calc-submit-spin 0.8s linear infinite;
}

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