/* Futures purple fusion theme. Style-only overrides; data and indicator scripts stay untouched. */
:root {
  --fx-bg: #080B10;
  --fx-shell: rgba(13, 17, 23, .96);
  --fx-panel: rgba(13, 17, 23, .92);
  --fx-panel-2: rgba(8, 11, 16, .97);
  --fx-line: rgba(201, 214, 227, .12);
  --fx-line-strong: rgba(201, 214, 227, .22);
  --fx-text: #C9D6E3;
  --fx-muted: rgba(201, 214, 227, .66);
  --fx-faint: rgba(201, 214, 227, .42);
  --fx-violet: #00D4FF;
  --fx-violet-2: #00D4FF;
  --fx-rose: #F0A500;
  --fx-red: #FF3D5A;
  --fx-green: #00C97A;
  --fx-aqua: #00D4FF;
  --fx-font: "MiSans", "HarmonyOS Sans SC", "Alibaba PuHuiTi 3.0", "Alibaba PuHuiTi", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --fx-number: "DIN Alternate", "SF Pro Display", Inter, "PingFang SC", sans-serif;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 214, 227, .22) transparent;
}

*::-webkit-scrollbar { width: 5px; height: 5px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: rgba(201, 214, 227, .22); border-radius: 999px; }

html,
body {
  min-height: 100%;
  color: var(--fx-text) !important;
  font-family: var(--fx-font) !important;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  background:
    radial-gradient(circle at 84% 8%, rgba(0, 212, 255, .30), transparent 26rem),
    radial-gradient(circle at 16% 88%, rgba(240, 165, 0, .18), transparent 30rem),
    linear-gradient(145deg, #080B10 0%, #0D1117 54%, #0D1117 100%) !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, .50), transparent 30%, rgba(0, 0, 0, .60)),
    linear-gradient(rgba(255,255,255,.016) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.012) 1px, transparent 1px);
  background-size: auto, 88px 88px, 88px 88px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}

input,
button,
select,
textarea {
  font-family: var(--fx-font) !important;
}

#app,
.topbar,
.main-layout {
  position: relative;
  z-index: 1;
}

body:has(#left) #app {
  height: 100vh !important;
  padding: 12px !important;
  gap: 0 !important;
  background: transparent !important;
  overflow: hidden !important;
  align-items: stretch !important;
}

body:has(#left) #app::before,
.main-layout::before {
  content: "";
  position: absolute;
  inset: 6px;
  z-index: -1;
  pointer-events: none;
  border-radius: 24px;
  border: 1px solid rgba(201, 214, 227, .10);
  background:
    radial-gradient(circle at 82% 8%, rgba(0, 212, 255, .16), transparent 18rem),
    linear-gradient(145deg, rgba(13, 17, 23, .86), rgba(8, 11, 16, .92));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 22px 68px rgba(0,0,0,.36);
}

#left,
#tv_chart,
.topbar,
.sidebar,
.content,
.chart-shell,
#chart-area,
.pipe-stage,
.gate-card,
.combo-filter,
.combo-help,
.sector-card,
.combo-summary-card,
.matrix-wrap,
.fire-list,
.trans-list,
#signal-box,
.asset-card,
.order-box,
#ms-builder,
#ms-list,
#ms-result,
.entry-log {
  background:
    radial-gradient(circle at 88% 0%, rgba(0, 212, 255, .12), transparent 14rem),
    linear-gradient(145deg, rgba(13, 17, 23, .92), rgba(8, 11, 16, .96)) !important;
  border: 1px solid var(--fx-line) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.075), 0 16px 42px rgba(0,0,0,.24) !important;
}

#left {
  width: 236px !important;
  flex: 0 0 236px !important;
  border-radius: 18px 0 0 18px !important;
  overflow: hidden !important;
  border-right: 0 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), inset -1px 0 0 rgba(201,214,227,.09), 8px 0 24px rgba(0,0,0,.18) !important;
}

#tv_chart {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
  border-radius: 0 18px 18px 0 !important;
  overflow: hidden !important;
  border-left-color: rgba(201, 214, 227, .10) !important;
}

#tv_chart iframe {
  width: 100% !important;
  min-width: 0 !important;
  background: var(--fx-bg) !important;
}

#nav-btns {
  padding: 10px 10px 8px !important;
  gap: 6px !important;
  border-bottom: 1px solid var(--fx-line) !important;
  background: transparent !important;
}

#nav-btns a,
.topbar-right a,
.back-link,
#btn-refresh,
.combo-btn,
.chart-freq-btn,
.ff-btn,
.inline-help-btn,
.fire-preview-btn,
.fire-open-chart,
button {
  border-radius: 999px !important;
  background: rgba(255,255,255,.052) !important;
  border: 1px solid rgba(201, 214, 227, .10) !important;
  color: rgba(201, 214, 227, .76) !important;
  font-family: var(--fx-font) !important;
  font-weight: 850 !important;
}

#nav-btns a:hover,
.topbar-right a:hover,
.back-link:hover,
#btn-refresh:hover,
.combo-btn:hover,
.chart-freq-btn:hover,
.ff-btn:hover,
.fire-open-chart:hover {
  color: #fff !important;
  border-color: rgba(201, 214, 227, .28) !important;
  background: rgba(0, 212, 255, .16) !important;
}

.combo-btn.active,
.chart-freq-btn.active,
.ff-btn.active,
.tab.active {
  color: #fff !important;
  background: linear-gradient(135deg, rgba(0, 212, 255, .54), rgba(240, 165, 0, .24)) !important;
  border-color: rgba(201, 214, 227, .30) !important;
  box-shadow: 0 10px 22px rgba(0, 212, 255, .16) !important;
}

#jinmen-display-controls {
  padding: 8px 10px !important;
  border-bottom: 1px solid var(--fx-line) !important;
  background: rgba(255,255,255,.028) !important;
}

#jinmen-display-controls label {
  color: rgba(201, 214, 227, .72) !important;
  font-weight: 850 !important;
}

.contract-search {
  flex: 0 0 auto;
  margin: 6px 7px 4px;
}

.contract-search input {
  width: 100%;
  box-sizing: border-box;
  height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(201, 214, 227, .14);
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  color: rgba(201, 214, 227, .86);
  font-size: 12px;
  outline: none;
}

.contract-search input:focus {
  border-color: rgba(201, 214, 227, .38);
  background: rgba(255, 255, 255, .06);
}

.contract-search input::placeholder {
  color: rgba(201, 214, 227, .34);
}

#contract-list {
  background: linear-gradient(180deg, rgba(8, 11, 16, .24), transparent 28%) !important;
}

.contract-watchlist {
  flex: 0 0 auto;
  margin: 8px 7px 6px;
  overflow: hidden;
  border: 1px solid rgba(201, 214, 227, .14);
  border-radius: 9px;
  background: rgba(255, 255, 255, .025);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .12);
}

.contract-watchlist__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 28px;
  padding: 0 8px;
  color: rgba(201, 214, 227, .82);
  font-size: 12px;
  font-weight: 900;
  border-bottom: 1px solid rgba(201, 214, 227, .08);
}

.contract-watchlist__count {
  min-width: 18px;
  text-align: right;
  color: rgba(201, 214, 227, .54);
  font-variant-numeric: tabular-nums;
}

.contract-watchlist__empty {
  padding: 9px 8px;
  color: rgba(201, 214, 227, .42);
  font-size: 11px;
}

.contract-watchlist .cl-row {
  margin: 2px 3px !important;
}

.cl-watchlist-toggle {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  color: rgba(201, 214, 227, .38);
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  line-height: 24px;
}

.cl-watchlist-toggle:hover,
.cl-watchlist-toggle.is-active {
  color: #F0A500;
}

#contract-list > div,
.cl-sector {
  color: rgba(201, 214, 227, .62) !important;
  font-weight: 900 !important;
}

.cl-row {
  min-height: 34px !important;
  margin: 2px 7px !important;
  border-radius: 9px !important;
  color: rgba(201, 214, 227, .82) !important;
  font-weight: 760 !important;
}

.cl-row:hover {
  background: rgba(0, 212, 255, .13) !important;
}

.cl-row.active,
.cl-row[style*="background"] {
  background: linear-gradient(90deg, rgba(0, 212, 255, .26), rgba(240, 165, 0, .08)) !important;
  border-color: rgba(201, 214, 227, .23) !important;
  box-shadow: inset 2px 0 0 var(--fx-violet), 0 8px 20px rgba(0,0,0,.13) !important;
}

#signal-box {
  height: 184px !important;
  margin: 8px !important;
  border-radius: 14px !important;
  color: rgba(201, 214, 227, .78) !important;
}

#signal-box [style] {
  background: transparent !important;
  border-color: rgba(201, 214, 227, .09) !important;
  color: rgba(201, 214, 227, .78) !important;
}

.topbar {
  height: 70px !important;
  margin: 14px 18px 0 !important;
  padding: 0 22px !important;
  border-radius: 18px !important;
  display: flex !important;
  align-items: center !important;
}

.topbar .title {
  color: var(--fx-text) !important;
  font-size: 23px !important;
  font-weight: 900 !important;
  line-height: 1.1 !important;
}

.topbar .title::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 24px;
  margin-right: 10px;
  border-radius: 999px;
  vertical-align: -5px;
  background: linear-gradient(180deg, var(--fx-violet), var(--fx-rose));
  box-shadow: 0 0 16px rgba(0, 212, 255, .30);
}

.topbar-right,
#update-time,
.auto-refresh-toggle {
  color: var(--fx-muted) !important;
  font-weight: 720 !important;
}

.main-layout {
  height: calc(100vh - 98px) !important;
  gap: 16px !important;
  padding: 18px !important;
  overflow: hidden !important;
}

.content,
.sidebar {
  min-width: 0;
  border-radius: 22px !important;
}

.content {
  padding: 20px !important;
}

.sidebar {
  padding: 14px !important;
}

.main-layout:not(:has(#left)) .sidebar {
  width: 320px !important;
  flex: 0 0 320px !important;
  order: 0;
}

.main-layout:not(:has(#left)) .content {
  order: 1;
  flex: 1 1 auto;
}

.section-header,
.section-label,
.sidebar-header,
.stage-header,
.sb-title,
.combo-summary-head {
  color: var(--fx-text) !important;
  font-size: 18px !important;
  font-weight: 900 !important;
  letter-spacing: 0 !important;
  border-color: var(--fx-line) !important;
}

.section-header::before,
.sidebar-header::before,
.stage-header::before,
.sb-title::before,
.combo-summary-head::before {
  content: "";
  width: 5px;
  height: 22px;
  flex: 0 0 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--fx-violet), var(--fx-rose));
  box-shadow: 0 0 16px rgba(0, 212, 255, .30);
}

.matrix th,
.pool-table th {
  color: var(--fx-faint) !important;
  background: rgba(8, 11, 16, .78) !important;
  border-color: var(--fx-line) !important;
  font-weight: 850 !important;
}

.matrix td,
.pool-table td {
  border-color: rgba(201, 214, 227, .07) !important;
}

.matrix tbody tr td,
.matrix .sector-group {
  background: rgba(16, 11, 32, .62) !important;
}

.matrix tbody tr:hover td {
  background: rgba(0, 212, 255, .10) !important;
}

.combo-summary-code,
.combo-level-label,
.combo-help b,
.gc-freq,
.signal-strat {
  color: var(--fx-aqua) !important;
}

.val.neg,
.sector-card .sector-label.bear {
  color: var(--fx-green) !important;
}

.val.pos,
.sector-card .sector-label.bull,
.signal-price {
  color: var(--fx-red) !important;
}

.amount,
.price,
.asset-price,
.cl-last,
.cl-pct,
.pool-table,
.matrix {
  font-variant-numeric: tabular-nums;
}

.amount,
.price,
.asset-price {
  font-family: var(--fx-number);
  font-weight: 850;
}

@media (max-width: 980px) {
  .main-layout:not(:has(#left)) {
    height: auto !important;
    min-height: 100vh;
    flex-direction: column;
  }

  .main-layout:not(:has(#left)) .sidebar {
    width: auto !important;
    flex: 0 0 auto !important;
    max-height: 42vh;
  }

  #left {
    width: 236px !important;
    flex-basis: 236px !important;
  }

  #tv_chart {
    min-width: 0 !important;
  }
}

/* Heatmap layout correction: title is page chrome; matrix stays left, signals stay right. */
body:has(#matrix-body) .topbar {
  height: 60px !important;
  margin: 8px 18px 0 !important;
  padding: 0 2px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

body:has(#matrix-body) .topbar .title {
  font-size: 24px !important;
  font-weight: 900 !important;
}

body:has(#matrix-body) .main-layout {
  height: calc(100vh - 68px) !important;
  padding: 12px 18px 18px !important;
  gap: 14px !important;
}

body:has(#matrix-body) .main-layout::before {
  display: none !important;
}

body:has(#matrix-body) .main-layout:not(:has(#left)) .content {
  order: 0 !important;
  flex: 1 1 auto !important;
}

body:has(#matrix-body) .main-layout:not(:has(#left)) .sidebar {
  order: 1 !important;
  width: 318px !important;
  flex: 0 0 318px !important;
}

body:has(#matrix-body) .content,
body:has(#matrix-body) .sidebar,
body:has(#matrix-body) .matrix-wrap,
body:has(#matrix-body) .combo-filter,
body:has(#matrix-body) .combo-help,
body:has(#matrix-body) .sector-card,
body:has(#matrix-body) .combo-summary-card,
body:has(#matrix-body) .fire-list,
body:has(#matrix-body) .trans-list {
  border-radius: 10px !important;
}

body:has(#matrix-body) .content,
body:has(#matrix-body) .sidebar {
  background:
    radial-gradient(circle at 86% 0%, rgba(0, 212, 255, .10), transparent 18rem),
    linear-gradient(145deg, rgba(13, 17, 23, .88), rgba(8, 11, 16, .94)) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), 0 16px 34px rgba(0,0,0,.20) !important;
}

body:has(#matrix-body) .combo-summary-card:hover,
body:has(#matrix-body) .sector-card:hover {
  transform: none !important;
}

@media (max-width: 980px) {
  body:has(#matrix-body) .main-layout:not(:has(#left)) .sidebar {
    order: 1 !important;
    width: auto !important;
    flex: 0 0 auto !important;
  }
}

/* Terminal grid alignment pass: keep shell, heatmap, chart, and strategy panels on one grid. */
body:has(#left) #app {
  box-sizing: border-box;
  align-items: stretch !important;
}

body:has(#left) #left,
body:has(#left) #tv_chart {
  height: 100% !important;
  margin: 0 !important;
  box-sizing: border-box;
}

body:has(#matrix-body) .main-layout {
  align-items: stretch !important;
  box-sizing: border-box;
}

body:has(#matrix-body) .content,
body:has(#matrix-body) .sidebar {
  margin: 0 !important;
  box-sizing: border-box;
  min-height: 0;
}

body:has(#matrix-body) .content {
  min-width: 0;
}

body:has(#matrix-body) .sidebar {
  align-self: stretch !important;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
}

body:has(#matrix-body) .matrix-wrap,
body:has(#matrix-body) .fire-list,
body:has(#matrix-body) .trans-list {
  box-sizing: border-box;
}

#content-tabs,
#strat-view,
#custom-view,
#fav-section {
  box-sizing: border-box;
  min-width: 0;
}

#strat-view .strat-body {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 14px !important;
  align-items: start !important;
  padding: 16px !important;
  box-sizing: border-box;
}

#strat-view:not(:has(.strat-body)) {
  padding: 0 16px 16px !important;
  box-sizing: border-box;
}

#strat-view:not(:has(.strat-body)) #strat-header {
  margin: 0 -16px 16px !important;
}

#strat-view #pipeline {
  display: flex !important;
  align-items: flex-start !important;
  gap: 12px !important;
  padding: 0 !important;
  margin: 0 !important;
  min-width: 0 !important;
  overflow-x: auto;
  box-sizing: border-box;
  scrollbar-gutter: stable;
}

#strat-view .pipe-stage {
  flex: 0 0 300px !important;
  width: 300px !important;
  min-width: 300px !important;
  margin: 0 !important;
  box-sizing: border-box;
  border-radius: 10px !important;
}

#strat-view .gate-card {
  width: 100%;
  min-width: 0 !important;
  box-sizing: border-box;
}

#strat-view .entry-log {
  width: auto !important;
  flex: none !important;
  margin: 0 !important;
  align-self: start !important;
  box-sizing: border-box;
  min-width: 0;
  max-height: calc(100vh - 310px) !important;
  border-radius: 10px !important;
}

#strat-view .stage-header,
#strat-view .el-title {
  min-height: 32px;
  display: flex;
  align-items: center;
  box-sizing: border-box;
}

@media (max-width: 1400px) {
  #strat-view .strat-body {
    grid-template-columns: minmax(0, 1fr);
  }

  #strat-view .entry-log {
    width: 100% !important;
  }
}

/* Chart workspace: TV owns the K-line, MACD, and RSI panes so the time axis stays native. */
body:has(#left) #chart-stack {
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  flex: 1 1 auto !important;
  display: flex !important;
  flex-direction: column !important;
  margin: 0 !important;
  box-sizing: border-box;
}

body:has(#left) #chart-stack #tv_chart {
  height: 100% !important;
  flex: 1 1 100% !important;
  min-height: 360px !important;
  border-radius: 0 18px 18px 0 !important;
}

.green-runtime-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 14px;
  border-bottom: 1px solid #1E2D3D;
  background: #131B24;
  color: #C9D6E3;
}

.green-runtime-status[hidden] {
  display: none;
}

.green-runtime-status__copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.green-runtime-status__copy small {
  color: #5A7A96;
}

.green-runtime-status button {
  flex: none;
  min-height: 34px;
  border: 1px solid #334D63;
  border-radius: 8px;
  background: #131B24;
  color: #C9D6E3;
  padding: 0 12px;
  cursor: pointer;
}

body:has(.green-runtime-status:not([hidden])) #app {
  height: calc(100vh - 94px);
}

/* ── 健康体检面板 (看板页, 只读, 不唤起指纹) ───────────────────────────────── */
.health-check-btn {
  margin-left: auto;
  padding: 2px 10px;
  font-size: 12px;
  color: #C9D6E3;
  background: #1E2D3D;
  border: 1px solid #334D63;
  border-radius: 3px;
  cursor: pointer;
}
.health-check-btn:hover { background: #1A2535; }
.health-check-btn[data-state="bad"] { color: #FF3D5A; border-color: #FF3D5A; }
.health-check-btn[data-state="warn"] { color: #F0A500; border-color: #F0A500; }
.health-check-btn[data-state="ok"] { color: #00C97A; border-color: #00C97A; }

.health-panel {
  position: fixed;
  top: 48px;
  left: 12px;
  z-index: 40;
  width: 460px;
  max-height: 74vh;
  overflow: auto;
  background: #131B24;
  border: 1px solid #334D63;
  border-radius: 4px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .55);
  font-size: 12px;
  color: #C9D6E3;
}
.health-panel__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #1E2D3D;
  position: sticky;
  top: 0;
  background: #131B24;
}
.health-panel__status { color: #5A7A96; }
.health-panel__close {
  margin-left: auto;
  background: none;
  border: none;
  color: #5A7A96;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
}
.health-panel__body { padding: 6px 10px 10px; }
.health-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid #142030;
}
.health-row:last-child { border-bottom: none; }
.health-row__name { flex: 0 0 118px; color: #5A7A96; }
.health-row__value { flex: 1; word-break: break-all; }
.health-row__badge {
  flex: 0 0 auto;
  padding: 0 6px;
  border-radius: 2px;
  font-size: 11px;
}
.health-row__badge[data-state="ok"] { color: #00C97A; background: rgba(0, 201, 122, .12); }
.health-row__badge[data-state="warn"] { color: #F0A500; background: rgba(240, 165, 0, .12); }
.health-row__badge[data-state="bad"] { color: #FF3D5A; background: rgba(255, 61, 90, .12); }
.health-section {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid #1E2D3D;
  color: #5A7A96;
  letter-spacing: .04em;
}


/* ============================================================
   Figma 专业看板（/tv）布局覆盖 —— 全局主题色之外，仅对看板页生效
   ============================================================ */
body:has(#left) #app { padding: 0 !important; gap: 0 !important; border-radius: 0 !important; }
body:has(#left) #app::before { display: none !important; }
body:has(#left) .topbar {
  position: static !important;
  box-sizing: border-box !important;
  height: 42px !important;
  flex: 0 0 42px !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 16px !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: var(--fx-panel) !important;
}
body:has(#left) .topbar::before { display: none !important; }
body:has(#left) #left { width: 208px !important; flex: 0 0 208px !important; min-width: 208px !important; border-radius: 0 !important; border-right: 1px solid var(--fx-line) !important; box-shadow: none !important; }
body:has(#left) #chart-stack #tv_chart { border-radius: 0 !important; box-shadow: none !important; }
body:has(#left) #chart-right { width: 252px !important; min-width: 252px !important; flex: 0 0 252px !important; }
@media (max-width:1180px){
  body:has(#left) #chart-right { position: fixed; top: 42px; right: 0; bottom: 0; display: none; z-index: 45; width: 252px !important; box-shadow: -18px 0 48px rgba(0,0,0,.45); }
  body:has(#left) #chart-right.open { display: flex; }
}
