:root {
  --bg: #131722;
  --panel: #1a1f2b;
  --border: #2a2f3c;
  --text: #d1d4dc;
  --muted: #8a8f9c;
  --accent: #2962ff;
  --ok: #26a69a;
  --err: #ef5350;
  /* 寮鸿皟鏂囧瓧 / 鎮仠鑳屾櫙 / 閫変腑鑳屾櫙 / 娆¤鏂囧瓧 / 鏇存繁鐨勫簳鑹?/ 鎻愮ず妗嗭紙鐧藉ぉ妯″紡涓嬫崲鎴愭祬鑹茬殑鍊硷級 */
  --strong: #ffffff;
  --hover: #2a2e39;
  --sel: #1e2a4a;
  --soft: #b2b5be;
  --deep: #161a25;
  --tab-idle: #252d3c;
  --tab-edge: #48546b;
  --tab-active: #293856;
  --closed-bg: #3e301a;
  --closed-text: #ffd38a;
  --open-bg: #173931;
  --open-text: #81e6c4;
  --tip-bg: #363a45;
  --tip-text: #e6e8ee;
  --warn: #ffb74d;
  --legend-hover: rgba(19, 23, 34, 0.88);
  --swatch-border: rgba(255, 255, 255, 0.22);
  --shadow-pop: 0 8px 26px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei UI', 'Roboto', system-ui, sans-serif;
  font-size: 13px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}

body {
  display: flex;
  flex-direction: column;
}

#toolbar,
#statusbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  background: var(--panel);
  border-color: var(--border);
  flex: none;
}

#toolbar {
  height: 40px;
  border-bottom: 1px solid var(--border);
  gap: 4px;
}

#toolbar-scroll {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

#toolbar #market {
  flex: none;
  max-width: 240px;
}

#toolbar #market[hidden] { display: none; }

#toolbar-content {
  display: flex;
  align-items: center;
  width: max-content;
  min-width: 100%;
  gap: 8px;
}

.draw-history {
  width: 28px;
  padding: 0;
  display: grid;
  place-items: center;
}

.draw-history:disabled {
  opacity: 0.38;
  cursor: default;
  background: transparent;
}

#statusbar {
  height: 26px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.spacer {
  flex: 1;
}

.brand {
  font-weight: bold;
  color: var(--strong);
  margin-right: 6px;
}

#workspace {
  flex: 1;
  min-height: 0;
  display: flex;
}

.chart {
  flex: 1;
  min-height: 0;
}

/* 宸︿晶鐢荤嚎宸ュ叿鏍忥紙浠?TradingView锛?*/
#draw-toolbar {
  width: 44px;
  flex: none;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
  gap: 2px;
}

#draw-toolbar button {
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  background: none;
  color: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

#draw-toolbar button:hover {
  background: var(--hover);
  color: var(--strong);
}

#draw-toolbar button.active {
  color: var(--accent);
  background: var(--sel);
}

#draw-toolbar .sep {
  width: 28px;
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

/* 閫変腑鐢荤嚎鍚庣殑娴姩宸ュ叿鏍?*/
.draw-float {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.draw-float[hidden] {
  display: none;
}

.df-kind {
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}

.ctx-menu {
  position: fixed;
  z-index: 100;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 0;
  min-width: 140px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.ctx-menu[hidden] {
  display: none;
}

.ctx-menu button {
  border: none;
  background: none;
  text-align: left;
  border-radius: 0;
  padding: 0 14px;
}

.ctx-menu button:hover {
  background: var(--hover);
}

#draw-edit textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 8px;
  resize: vertical;
  margin-bottom: 8px;
}

.row-ctl {
  display: flex;
  align-items: center;
  gap: 8px;
}

.row-ctl input[type='range'] {
  width: 100px;
  padding: 0;
}

.row-ctl input[type='checkbox'] {
  height: auto;
}

select,
input,
button {
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  height: 28px;
  padding: 0 8px;
}

button {
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* 鍛ㄦ湡涓庡叾浠栧伐鍏峰叡鐢ㄦ爣棰樻爮鐨勬í鍚戞粴鍔ㄣ€?*/
#tfs {
  display: flex;
  gap: 1px;
  flex: none;
}

#tfs button {
  flex: none;
}

#tfs button {
  border-color: transparent;
  background: transparent;
  padding: 0 7px;
}

#tfs button.active {
  background: var(--accent);
  color: #fff;
}

#tf-input {
  width: 64px;
  flex: none;
}

#tf-input.bad {
  border-color: var(--err);
}

#status-text.ok {
  color: var(--ok);
}

#status-text.error {
  color: var(--err);
}

#status-source::before {
  content: '· ';
}

#status-source:empty::before {
  content: '';
}

dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 640px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  padding: 18px 22px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

dialog h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

dialog h3 {
  margin: 16px 0 8px;
  font-size: 14px;
  color: var(--strong);
}

dialog label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

dialog label.check {
  margin-top: 10px;
}

dialog label.check input {
  height: auto;
}

dialog label.inline {
  display: inline-flex;
  margin: 0;
}

dialog .row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  flex-wrap: wrap;
}

dialog .row .name {
  width: 70px;
}

dialog .net-proxy {
  flex: 1;
  min-width: 200px;
}

dialog input[type='number'] {
  width: 100px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  margin: 2px 0 6px;
  line-height: 1.5;
}

.buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

/* 鎸囨爣搴?*/
#ind-lib .ind-row {
  display: grid;
  grid-template-columns: 170px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}

#ind-lib .ind-name {
  margin: 0;
}

#ind-lib .ind-name input {
  height: auto;
}

/* 鍧囩嚎璁剧疆锛氫竴鏉＄嚎涓€琛?*/
.line-head,
.line-row {
  display: grid;
  grid-template-columns: 40px 80px 50px 150px 90px 80px;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
}

.line-head span {
  color: var(--muted);
  font-size: 12px;
}

.line-row input[type='checkbox'] {
  height: auto;
}

.line-row input[type='number'] {
  width: 80px;
}

input[type='color'] {
  padding: 0 2px;
  width: 44px;
  cursor: pointer;
}

.line-row .op {
  display: flex;
  align-items: center;
  gap: 6px;
}

.line-row .op input {
  width: 100px;
  padding: 0;
}

.op-text {
  font-size: 12px;
  color: var(--muted);
  width: 36px;
}

/* 鎸囨爣璁剧疆锛氱収 TradingView 鍒嗐€岃緭鍏ャ€嶃€屾牱寮忋€嶄袱椤?*/
.tabs {
  display: flex;
  gap: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0 2px;
  height: 32px;
  color: var(--muted);
}

.tab.active {
  color: var(--strong);
  border-bottom-color: var(--accent);
}

#ind-edit-body {
  min-height: 220px;
  max-height: 60vh;
  overflow-y: auto;
}

#ind-edit h4 {
  margin: 12px 0 4px;
  font-size: 13px;
  color: var(--strong);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-row {
  display: grid !important;
  grid-template-columns: minmax(100px, 150px) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.style-row {
  display: grid;
  grid-template-columns: 24px minmax(88px, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin: 5px 0;
}

.style-row input[type='checkbox'] {
  height: auto;
}

.style-row .op {
  display: flex;
  align-items: center;
  gap: 6px;
}

.style-row .op input {
  width: 90px;
  padding: 0;
}

#ind-edit .buttons .spacer {
  flex: 1;
}

.alert-text {
  white-space: pre-line;
  line-height: 1.7;
}

/* 鍥句緥锛堜豢 TradingView锛夛細鐢诲湪姣忎釜绐楁牸宸︿笂瑙掞紝涓嶆尅浣忓浘琛ㄧ殑榧犳爣鎿嶄綔 */
.chart {
  position: relative;
}

.input-row {
  margin: 6px 0;
}

.legend-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

.legend {
  position: absolute;
  left: 6px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  font-size: 12px;
  max-width: calc(100% - 76px);
}

.legend-inds {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  max-width: 100%;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 20px;
}

/* 主图及副图左上角开高低收与指标行：紧凑单行 + 可在「设置 → 图表」自由调节背景颜色和透明度 */
.legend-layer .legend-row {
  width: max-content;
  max-width: 100%;
  flex-wrap: nowrap;
  padding: 1px 7px;
  border-radius: 5px;
  background: var(--legend-bg, rgba(19, 23, 34, 0.13));
  backdrop-filter: var(--legend-bg-blur, blur(0.7px));
  -webkit-backdrop-filter: var(--legend-bg-blur, blur(0.7px));
  border: 1px solid var(--legend-bg-border, rgba(255, 255, 255, 0.018));
  box-shadow: var(--legend-bg-shadow, 0 1px 4px rgba(0, 0, 0, 0.09));
  text-shadow: var(--legend-text-shadow, 0 1px 2px rgba(0, 0, 0, 0.65));
}

.legend-layer .legend-ind {
  margin-left: 0;
  padding: 1px 7px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.legend-layer .legend-ind .legend-name,
.legend-layer .legend-ind .legend-tools,
.legend-layer .legend-ind .legend-vals {
  flex: none;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.legend-title {
  color: var(--text);
  font-size: 13px;
}

.legend-heading {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-detail {
  color: var(--soft);
}

.legend-session {
  background: var(--closed-bg);
  color: var(--closed-text);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
}

.legend-session.is-open {
  background: var(--open-bg);
  color: var(--open-text);
}

.legend-label {
  color: var(--muted);
}

.legend-val {
  font-variant-numeric: tabular-nums;
}

.legend-ind {
  pointer-events: auto;
  padding: 0 4px;
  margin-left: -4px;
  border-radius: 4px;
  border: 1px solid transparent;
  width: max-content;
}

.legend-ind:hover {
  border-color: var(--border);
  background: var(--legend-hover);
}

.legend-name {
  color: var(--text);
  cursor: default;
}

.legend-ind.is-hidden .legend-name {
  color: var(--muted);
}

.legend-tools {
  display: none;
  gap: 2px;
}

.legend-ind:hover .legend-tools {
  display: inline-flex;
}

.legend-btn {
  height: 20px;
  width: 22px;
  padding: 0;
  border: none;
  background: none;
  color: var(--soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.legend-btn:hover {
  background: var(--hover);
  color: var(--strong);
}

/* ---------- 棰滆壊閫夋嫨鍣紙浠?TradingView锛?---------- */
.cp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 6px;
}

.cp-swatch {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  border: 1px solid var(--swatch-border);
  background-image: none;
}

.cp-line-sample {
  width: 26px;
  height: 0;
  border-top: 1px solid var(--strong);
}

.cp-popup {
  position: fixed;
  z-index: 10000;
  width: 260px;
  max-height: calc(100dvh - 16px);
  overflow-y: auto;
  background: var(--deep);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  box-shadow: var(--shadow-pop);
}

.cp-grid,
.cp-custom {
  display: grid;
  grid-template-columns: repeat(10, 20px);
  gap: 4px;
}

.cp-custom {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.cp-cell {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 3px;
  border: 1px solid var(--swatch-border);
}

.cp-cell.on {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.cp-plus {
  width: 20px;
  height: 20px;
  border: 1px dashed var(--muted);
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  color: var(--muted);
  margin: 0 !important;
}

.cp-plus input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.cp-op {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.cp-op input {
  flex: 1;
  padding: 0;
  height: auto;
}

.cp-op-text {
  width: 36px;
  text-align: right;
}

.cp-seg {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}

.cp-seg-label {
  font-size: 12px;
  color: var(--muted);
  width: 36px;
}

.cp-seg-btn {
  width: 40px;
  height: 26px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cp-seg-btn.on {
  border-color: var(--accent);
  background: var(--sel);
}

.cp-seg-line {
  width: 24px;
  height: 0;
  border-top: 1px solid var(--text);
}

/* ---------- 鐢荤嚎璁剧疆 ---------- */
.text-tools {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.tog {
  width: 32px;
  padding: 0;
}

.tog.on {
  border-color: var(--accent);
  background: var(--sel);
}

.tog-b {
  font-weight: bold;
}

.tog-i {
  font-style: italic;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
  margin: 10px 0 !important;
}

.check-row input {
  height: auto;
}

.vis-row {
  display: grid;
  grid-template-columns: 90px 70px 14px 70px;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}

.vis-row label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
}

.vis-row input[type='checkbox'] {
  height: auto;
}

.vis-row input[type='number'] {
  width: 70px;
}

#draw-edit .buttons {
  position: relative;
}

#draw-tpl-menu {
  position: absolute;
  left: 0;
  bottom: 34px;
  top: auto !important;
}

.draw-float button {
  height: 28px;
}

.legend-vals {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* 鍛ㄦ湡鎸夐挳锛氬悓涓€鍗曚綅涓€缁勶紝鍗曚綅鍙啓涓€娆?*/
.tf-group {
  display: inline-flex;
  align-items: center;
  flex: none;
  padding-right: 8px;
  margin-right: 4px;
  border-right: 1px solid var(--border);
}

.tf-group:last-child {
  border-right: none;
}

#tfs .tf-group button {
  min-width: 24px;
  padding: 0 5px;
}

.tf-unit {
  color: var(--muted);
  font-size: 12px;
  margin-left: 2px;
}

.strip-arrow {
  flex: none;
  width: 22px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.strip-arrow[hidden] {
  display: none;
}

.strip-arrow:disabled { visibility: hidden; }

#titlebar .strip-arrow { align-self: center; }

/* ---------- 澶氬浘甯冨眬锛堢収 TradingView锛?---------- */
#grid {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
  background: var(--border);
}

#grid.layout-1 {
  grid-template: 1fr / 1fr;
}

#grid.layout-2h {
  grid-template: 1fr / 1fr 1fr;
}

#grid.layout-2v {
  grid-template: 1fr 1fr / 1fr;
}

#grid.layout-3 {
  grid-template: 1fr 1fr / 1fr 1fr;
}

#grid.layout-3 .cell:first-child {
  grid-row: 1 / 3;
}

#grid.layout-4 {
  grid-template: 1fr 1fr / 1fr 1fr;
}

.cell {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
  outline: 1px solid transparent;
  outline-offset: -1px;
}

.cell.active {
  outline-color: var(--accent);
}

.cell .chart {
  flex: 1;
  min-width: 0;
  min-height: 0;
}

#refresh-notice {
  position: fixed;
  top: 80px;
  left: 12px;
  z-index: 25;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  color: var(--strong);
  box-shadow: 0 3px 12px #0004;
  pointer-events: none;
}

.chart-readout {
  position: absolute;
  z-index: 15;
  max-width: min(360px, calc(100% - 8px));
  box-sizing: border-box;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 2px 10px #0004;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  pointer-events: none;
}


/* 模仿 TradingView：点击/轻点警报线后，在警报线正中弹出紧凑的预警信息 + 编辑/删除快捷条 */
.chart-alert-bar {
  position: absolute;
  transform: translate(-50%, -50%);
  z-index: 24;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 16px);
  padding: 2px 5px 2px 7px;
  border: 1.5px solid var(--alert-color, #FF9800);
  border-radius: 5px;
  background: var(--panel);
  color: var(--strong);
  font-size: 11px;
  line-height: 1.15;
  white-space: nowrap;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45);
}
.chart-alert-bar[hidden] { display: none; }
.chart-alert-bar .cab-drag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 2px 2px 2px 0;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.chart-alert-bar .cab-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  color: var(--alert-color, #FF9800);
}
.chart-alert-bar .cab-text {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
  font-weight: 500;
  color: var(--strong);
}
.chart-alert-bar .cab-sep {
  width: 1px;
  height: 12px;
  background: var(--border);
  flex: none;
}
.chart-alert-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: 20px;
  padding: 0 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  flex: none;
}
.chart-alert-bar button:hover {
  background: var(--hover);
  color: var(--strong);
}
.chart-alert-bar .cab-del {
  color: #ff6b6b;
}
.chart-alert-bar .cab-del:hover,
.chart-alert-bar .cab-del:active {
  background: #ef5350;
  border-color: #ef5350;
  color: #fff;
}
body.mobile .chart-alert-bar {
  padding: 2px 4px 2px 7px;
  gap: 4px;
  font-size: 11.5px;
}
body.mobile .chart-alert-bar .cab-text {
  max-width: min(160px, 40vw);
}
body.mobile .chart-alert-bar button {
  height: 22px;
  padding: 0 7px;
  font-size: 11.5px;
}

.chart-readout[hidden],
#al-style-row[hidden] {
  display: none;
}

.layout-menu {
  padding: 8px 12px;
  min-width: 260px;
}

.menu-title {
  color: var(--muted);
  font-size: 12px;
  margin: 8px 0 6px;
}

.layout-choices {
  display: flex;
  gap: 6px;
}

.layout-choices button {
  width: 40px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--soft);
  border: 1px solid var(--border) !important;
  border-radius: 4px !important;
}

.layout-choices button.on {
  color: var(--accent);
  border-color: var(--accent) !important;
}

.link-groups {
  display: flex;
  gap: 8px;
  padding-bottom: 6px;
}

.link-btn {
  width: 26px;
  height: 26px;
  padding: 0 !important;
  border-radius: 50% !important;
  border: 1px solid var(--border) !important;
  font-size: 11px;
}

.link-btn.on {
  outline: 2px solid var(--strong);
  outline-offset: 1px;
}

.link-badge {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}

.link-badge[hidden] {
  display: none;
}

/* ---------- 鑷繁鐢荤殑鏍囬鏍?+ 鏍囩椤碉紙鐓?TradingView 妗岄潰鐗堬級 ---------- */
#titlebar {
  height: 34px;
  flex: none;
  display: flex;
  align-items: flex-end;
  background: var(--deep);
  padding-left: 8px;
  user-select: none;
}

.app-icon {
  width: 18px;
  height: 18px;
  align-self: center;
  margin-right: 8px;
}

#tabs {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  gap: 5px;
}

.win-tab {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  flex: 0 0 auto;
  min-width: 100px;
  max-width: 330px;
  padding: 0 4px 0 8px;
  background: var(--tab-idle);
  border-radius: 6px 6px 0 0;
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--tab-edge);
  cursor: default;
}

.win-tab.active {
  background: var(--accent);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px var(--accent);
  font-weight: 600;
}

.win-tab.active .win-tab-name {
  color: #ffffff;
}

.win-tab.active .win-tab-layout {
  color: rgba(255, 255, 255, 0.86);
}

.win-tab.active .win-tab-chg {
  background: rgba(15, 23, 42, 0.34);
  padding: 1px 4px;
  border-radius: 3px;
}

.win-tab.active .win-tab-x {
  color: rgba(255, 255, 255, 0.88);
}

.win-tab.active .win-tab-x:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  color: #ffffff;
}

.win-tab:not(.active):hover {
  background: var(--hover);
}

.win-tab-name {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 118px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.win-tab-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
}

.win-tab-chg,
.win-tab-layout {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.win-tab-chg:empty {
  display: none;
}

.win-tab-layout {
  color: var(--muted);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-tab-x,
.tab-add {
  flex: 0 0 22px;
  border: none !important;
  background: none !important;
  color: var(--muted);
  height: 22px;
  width: 22px;
  padding: 0;
  border-radius: 4px;
}

.win-tab-x:hover,
.tab-add:hover {
  background: var(--hover) !important;
  color: var(--strong);
}

.tab-add {
  align-self: center;
  margin-left: 4px;
  font-size: 18px;
}

.drag-fill {
  flex: 1;
  align-self: stretch;
}

.win-btn {
  align-self: stretch;
  height: auto;
  width: 46px;
  border: none !important;
  border-radius: 0 !important;
  background: none !important;
  color: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.win-btn:hover {
  background: var(--hover) !important;
}

.win-quit {
  width: auto !important;
  padding: 0 10px !important;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--soft);
  border-left: 1px solid var(--border) !important;
}
.win-quit:hover {
  background: rgba(242, 54, 69, 0.16) !important;
  color: #ff6b77 !important;
}
[data-theme="light"] .win-quit:hover {
  background: rgba(242, 54, 69, 0.12) !important;
  color: #d92d3a !important;
}

.win-close:hover {
  background: #e81123 !important;
  color: #fff;
}

/* ---------- 甯冨眬鑿滃崟锛堢収 TradingView锛?---------- */
.layout-menu {
  width: 470px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.layout-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}

.layout-n {
  width: 26px;
  color: var(--muted);
  font-size: 12px;
}

.layout-row button {
  width: 34px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--soft);
  border: 1px solid transparent !important;
  border-radius: 4px !important;
}

.layout-row button:hover {
  background: var(--hover);
}

.layout-row button.on {
  background: #d1d4dc;
  color: #131722;
}

.switch-row {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  margin: 0 !important;
}
.switch-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.sync-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border);
  color: var(--bg);
  font-size: 11px;
  font-weight: 700;
  font-style: normal;
  line-height: 1;
  cursor: help;
  user-select: none;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease;
}
.sync-info:hover,
.sync-info:focus-visible {
  background: var(--accent);
  color: #fff;
  outline: none;
}
#btn-layout.dirty {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-color: #f59e0b !important;
  background: rgba(245, 158, 11, 0.16) !important;
  color: #fbbf24 !important;
  font-weight: 600;
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.25);
}
[data-theme="light"] #btn-layout.dirty {
  border-color: #d97706 !important;
  background: rgba(245, 158, 11, 0.14) !important;
  color: #b45309 !important;
}
.layout-dirty-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 5px;
  height: 16px;
  border-radius: 999px;
  background: #f59e0b;
  color: #111827;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.2px;
}
.layout-dirty-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #111827;
}
/* 使用说明：布局未保存提示图文对比卡片 */
.help-compare {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 10px 0 12px;
}
.help-compare-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.help-compare-card.is-dirty {
  border-color: rgba(245, 158, 11, 0.55);
}
.help-compare-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  margin-bottom: 8px;
  border-radius: 6px;
  background: #131722;
  border: 1px solid #2a2e39;
}
.help-mock-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border-radius: 4px;
  font-size: 12px;
  border: 1px solid #2a2e39;
  background: #1e222d;
  color: #d1d4dc;
  user-select: none;
}
.help-mock-btn.dirty {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.16);
  color: #fbbf24;
  font-weight: 600;
}
.help-compare-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--strong);
  margin-bottom: 4px;
}
.help-compare-desc {
  font-size: 12px;
  line-height: 1.55;
  color: var(--soft);
  margin: 0;
}
dialog.mr-reload-dlg {
  width: min(440px, calc(100vw - 32px));
  padding: 20px 22px 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}
dialog.mr-reload-dlg::backdrop {
  background: rgba(0, 0, 0, 0.52);
}
.mr-reload-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.mr-reload-head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  color: var(--strong);
}
.mr-reload-body {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
}
.mr-reload-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.mr-reload-save {
  height: 36px;
  padding: 0 16px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--strong);
  font-size: 14px;
  cursor: pointer;
}
.mr-reload-save:hover {
  background: var(--hover);
}
.mr-reload-discard {
  height: 36px;
  padding: 0 16px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: var(--strong);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.mr-reload-discard:hover {
  opacity: 0.9;
}

.switch {
  appearance: none;
  width: 34px;
  height: 18px;
  padding: 0;
  border-radius: 9px;
  background: #434651;
  position: relative;
  cursor: pointer;
  border: none;
}

.switch::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s;
}

.switch:checked {
  background: var(--accent);
}

.switch:checked::after {
  left: 18px;
}

.scope-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 6px;
}

.scope-row label {
  display: flex !important;
  align-items: center;
  gap: 6px;
  margin: 0 !important;
}

.scope-row input {
  height: auto;
}

.menu-sep {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

#tab-menu {
  max-height: 60vh;
  overflow-y: auto;
}

#toolbar button {
  white-space: nowrap;
  flex: none;
}

.menu-item {
  display: flex;
  align-items: center;
}

.menu-item button:first-child {
  flex: 1;
}

.menu-del {
  width: 28px;
  padding: 0 !important;
  color: var(--muted);
}

.menu-del:hover {
  color: #ef5350;
}

/* 鍥捐〃鍙抽敭鑿滃崟锛堢収 TradingView锛?*/
.chart-menu {
  min-width: 300px;
}

.menu-row {
  display: flex !important;
  justify-content: space-between;
  gap: 24px;
  width: 100%;
}

.menu-row:disabled {
  color: var(--muted);
  cursor: default;
}

.menu-row:disabled:hover {
  background: none !important;
}

.menu-key {
  color: var(--muted);
  font-size: 12px;
}

#win-span.on {
  color: var(--accent);
}

/* 鎷栧姩鏍囩椤碉細鍘熶綅缃彉娣★紝榧犳爣涓嬮潰璺熺潃涓€涓爣绛?*/
.win-tab.dragging {
  opacity: 0.35;
}
.win-tab.tab-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.9;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ---------- 宸︿晶鍝佺鍒楄〃锛堢収 TradingView 鑷€夊垪琛級 ---------- */
.watch-toggle.on {
  color: var(--strong);
  background: var(--sel);
  border-color: var(--accent);
}
#watch {
  position: relative;
  width: 300px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
  min-height: 0;
}
#watch[hidden] {
  display: none;
}
.watch-head {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}
.watch-tabs {
  flex: 1;
  display: flex;
}
.watch-tabs button,
.watch-close {
  border: none;
  background: none;
  color: var(--muted);
  padding: 8px 0;
  white-space: nowrap;
  font-size: 12px;
  flex: 1;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.watch-tabs button:hover,
.watch-close:hover {
  color: var(--text);
}
.watch-tabs button.active {
  color: var(--strong);
  border-bottom-color: var(--accent);
}
.watch-close {
  flex: none;
  width: 30px;
  font-size: 15px;
}
/* 手机刷新：表头 ↻ + 列表顶部下拉刷新（用户 2026-12-01 要求） */
.watch-refresh {
  flex: none;
  width: 30px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.watch-refresh:hover { color: var(--text); background: var(--hover); }
.watch-pull {
  flex: none;
  height: var(--pull-distance, 0px);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--muted);
  transition: height 0.12s ease;
}
.watch-pull.ready { color: var(--accent); }
.watch-pull.busy { color: var(--text); }
body.watch-sorting .watch-list { touch-action: none; }
.watch-search {
  margin: 6px 8px;
  padding: 5px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
}
.watch-search:focus {
  outline: none;
  border-color: var(--accent);
}
.watch-cols,
.watch-row {
  display: grid;
  grid-template-columns: 18px 1fr var(--wc-last, 74px) var(--wc-chg, 60px);
  align-items: center;
  gap: 2px;
  padding: 0 8px 0 4px;
}
.watch-cols {
  color: var(--muted);
  font-size: 11px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.watch-cols span:first-child {
  grid-column: 1 / span 2;
  padding-left: 4px;
}
.watch-cols span:not(:first-child),
.watch-last,
.watch-chg {
  text-align: right;
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.watch-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.watch-group {
  color: var(--muted);
  font-size: 11px;
  padding: 8px 10px 3px;
}
.watch-row {
  height: 36px;
  cursor: pointer;
}
.watch-row:hover {
  background: var(--hover);
}
.watch-row.current {
  background: var(--sel);
}
.watch-star {
  border: none;
  background: none;
  color: var(--muted);
  padding: 0;
  font-size: 14px;
  cursor: pointer;
  visibility: hidden;
}
.watch-row:hover .watch-star,
.watch-star.on {
  visibility: visible;
}
.watch-star.on {
  color: #f9a825;
}
/* 手机没有 hover：未收藏的星星也要一直显示，别人才知道可以点来自选 */
body.mobile .watch-row .watch-star {
  visibility: visible;
  color: var(--muted);
}
body.mobile .watch-row .watch-star.on {
  color: #f9a825;
}
/* 手机没有 Windows 开机启动项 */
body.mobile #autostart-head,
body.mobile #autostart-row,
body.mobile #autostart-hint {
  display: none !important;
}
.watch-name {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}
.watch-name b,
.watch-name small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.watch-name b {
  font-weight: normal;
  color: var(--text);
}
.watch-name small {
  color: var(--muted);
  font-size: 11px;
}
.watch-last {
  color: var(--text);
}

/* 鎹㈠搧绉?/ 鍛ㄦ湡鍔犺浇涓細閬綇鏃х殑 K 绾匡紝涓棿鏄剧ず鎻愮ず锛堢収 TradingView锛?*/
.chart.masked > * {
  visibility: hidden;
}
.chart-mask {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: pre-line;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
  z-index: 5;
}
.chart-mask[hidden] {
  display: none;
}

/* 褰撳墠鍝佺鐢ㄤ笉浜嗙殑鍛ㄦ湡锛氬彉鐏帮紙鐓?TradingView锛?*/
#tfs .tf-group button.na {
  color: var(--muted);
  cursor: not-allowed;
  background: none;
}

/* Alt + 鍗曞嚮锛氬崟涓浘鏈€澶у寲锛堝叾浠栧浘鍏堣棌璧锋潵锛屽啀鎸変竴娆℃仮澶嶏級 */
#grid.maxed > .cell:not(.max) {
  display: none;
}
#grid.maxed > .cell.max {
  grid-column: 1 / -1 !important;
  grid-row: 1 / -1 !important;
}

/* 璁剧疆椤垫渶涓婇潰锛氱増鏈拰寮€鍙戣€呬俊鎭?*/
.about {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  line-height: 1.8;
}
.about-name {
  font-size: 15px;
  color: var(--strong);
}
.about-ver {
  color: var(--muted);
  margin-left: 6px;
}
.about-dev {
  color: var(--text);
}
.about-dev b {
  color: var(--warn);
  user-select: text;
}
.about-dev a {
  color: var(--warn);
  font-weight: 700;
  user-select: text;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.about-dev a:hover {
  filter: brightness(1.12);
}

/* ---------- K 绾垮洖鏀炬帶鍒舵潯锛堢収 TradingView锛?---------- */
#btn-replay.on {
  color: var(--strong);
  background: var(--sel);
  border-color: var(--accent);
}
#replay-bar {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow-x: auto;
  max-width: calc(100vw - 16px);
}
#replay-bar[hidden] {
  display: none;
}
#replay-bar button,
#replay-bar select {
  height: 28px;
}
#replay-bar > * {
  flex-shrink: 0;
}
#rp-date-dialog {
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}
#rp-date-dialog h2 {
  margin: 0 0 12px;
}
.rp-calendar-nav,
.rp-calendar-time {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 8px 0;
}
.rp-calendar-nav input,
.rp-calendar-time input {
  width: 5em;
}
.rp-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  text-align: center;
  align-items: center;
}
.rp-calendar span {
  color: var(--muted);
}
.rp-calendar button {
  min-width: 0;
  padding: 4px 0;
}
.rp-calendar button[aria-current="date"] {
  border-color: var(--accent);
}
.rp-calendar button[aria-pressed="true"] {
  background: var(--accent);
  color: white;
}
#rp-date-error {
  color: var(--err);
}
#replay-bar .rp-title {
  color: var(--accent);
  font-weight: bold;
}
#replay-bar .rp-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
}
#replay-bar .rp-play {
  min-width: 36px;
  font-size: 14px;
}
#replay-bar .rp-time {
  min-width: 140px;
  text-align: center;
  color: var(--strong);
  font-variant-numeric: tabular-nums;
}
#replay-bar.picking #rp-select {
  background: var(--accent);
  color: #fff;
}
#replay-bar .rp-close {
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
#replay-bar .rp-close:hover {
  background: var(--border);
  color: var(--strong);
}
#rp-resume {
  color: var(--warn);
}
#replay-bar.picking #rp-jump {
  background: var(--accent);
  color: #fff;
}
/* 閫夎捣鐐癸細璺熺潃榧犳爣鐨勮摑鑹茬珫绾?+ 鍓垁 */
#rp-cursor {
  position: fixed;
  width: 0;
  border-left: 2px solid #2962ff;
  pointer-events: none;
  z-index: 40;
}
#rp-cursor[hidden] {
  display: none;
}
#rp-cursor span {
  position: absolute;
  top: 50%;
  left: -10px;
  width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 50%;
  background: #2962ff;
  color: #fff;
  font-size: 11px;
}

/* 鎷栧姩璋冩暣鍝佺鍒楄〃瀹藉害锛堝彸杈规锛夊拰鍒楀锛堣〃澶村垎闅旂嚎锛?*/
.watch-resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 6;
}
.watch-resizer:hover,
.col-grip:hover {
  background: rgba(41, 98, 255, 0.5);
}
.watch-cols .wc-last,
.watch-cols .wc-chg {
  position: relative;
}
.col-grip {
  position: absolute;
  left: -4px;
  top: -2px;
  width: 5px;
  height: calc(100% + 4px);
  cursor: col-resize;
  border-left: 1px solid var(--border);
}
body.col-resizing,
body.col-resizing * {
  cursor: col-resize !important;
  user-select: none;
}
/* 回放工具栏的拖动把手 */
#replay-bar .rp-grip {
  cursor: grab;
  color: var(--muted);
  padding: 0 2px;
  letter-spacing: -3px;
  user-select: none;
}
#replay-bar .rp-grip:active {
  cursor: grabbing;
}
#replay-bar .rp-grip:hover {
  color: var(--strong);
}

/* ---------- 鐢荤嚎宸ュ叿鏍忥紙鐓?TradingView锛氬垎缁勬寜閽?+ 鍙充笅瑙掑皬涓夎灞曞紑锛?---------- */
#draw-toolbar {
  overflow-y: auto;
  scrollbar-width: none;
}
#draw-toolbar .tb-group {
  position: relative;
  width: 36px;
  height: 36px;
  flex: none;
}
#draw-toolbar .tb-group .tb-main {
  width: 36px;
  height: 36px;
}
#draw-toolbar .tb-group .tb-more {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 12px;
  height: 12px;
  padding: 0;
  background: none;
  opacity: 0.45;
}
#draw-toolbar .tb-group .tb-more::after {
  content: '';
  position: absolute;
  right: 2px;
  bottom: 2px;
  border-left: 5px solid transparent;
  border-bottom: 5px solid #8a8f9c;
}
#draw-toolbar .tb-group:hover .tb-more {
  opacity: 1;
}
#draw-toolbar .tb-group .tb-more:hover::after {
  border-bottom-color: var(--strong);
}
#draw-toolbar .tb-group.active .tb-main,
#draw-toolbar .tb-act.active {
  color: var(--accent);
  background: var(--sel);
}
#draw-toolbar .tb-act {
  flex: none;
}
.draw-flyout {
  position: fixed;
  z-index: 60;
  min-width: 230px;
  max-height: calc(100vh - 8px);
  overflow-y: auto;
}
.draw-flyout .fly-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
}
.draw-flyout .fly-row.on {
  color: var(--accent);
}
.draw-flyout .fly-ico {
  display: inline-flex;
  width: 28px;
  height: 28px;
  flex: none;
}
.fib-levels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
  margin: 4px 0 8px;
}
.fib-level {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fib-level input[type='number'] {
  width: 70px;
}

/* 鏀惰棌锛氬睍寮€鑿滃崟閲岀殑鏄熸爣銆佹诞鍔ㄧ殑鏀惰棌宸ュ叿鏍忥紙鐓?TradingView锛?*/
.draw-flyout .fly-row {
  position: relative;
  padding-right: 34px;
}
.draw-flyout .fly-star {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%) scale(0.7);
  display: inline-flex;
  opacity: 0;
  color: var(--muted);
}
.draw-flyout .fly-row:hover .fly-star,
.draw-flyout .fly-star.on {
  opacity: 1;
}
#draw-favs {
  position: fixed;
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}
#draw-favs[hidden] {
  display: none;
}
#draw-favs button {
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  color: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
}
#draw-favs button:hover {
  background: var(--hover);
  color: var(--strong);
}
#draw-favs button.active {
  color: var(--accent);
  background: var(--sel);
}
#draw-favs .fav-grip {
  cursor: grab;
  color: var(--muted);
  letter-spacing: -3px;
  padding: 0 4px 0 0;
  user-select: none;
}
#draw-favs .fav-grip:active {
  cursor: grabbing;
}
#draw-favs .fav-empty {
  color: var(--muted);
  padding: 0 6px;
}

.input-row .unit {
  white-space: nowrap;
  color: var(--muted);
}

/* ---------- 璀︽姤锛堢収 TradingView锛?---------- */
.al-dlg .name {
  width: 72px;
  color: var(--muted, #8a8f98);
}
.al-dlg textarea {
  background: var(--bg, #131722);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  font: inherit;
  resize: vertical;
}
.al-ind-params {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  flex: 1;
}
.al-ind-params label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--muted, #8a8f98);
}
.al-ind-params input[type="number"] {
  width: 62px;
}
.al-ind-params select {
  max-width: 112px;
}
.al-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}
.al-tabs button.active {
  background: #2962ff;
  color: #fff;
}
.al-body {
  max-height: 60vh;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}
.al-row,
.al-pop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 2px;
  border-bottom: 1px solid var(--border);
}
.al-info {
  flex: 1;
  min-width: 0;
  cursor: default;
}
.al-main {
  color: var(--strong);
}
.al-sub {
  color: var(--muted, #8a8f98);
  font-size: 12px;
  margin-top: 2px;
  white-space: pre-wrap;
}
.al-pop-row {
  display: block;
}
.al-ops {
  display: flex;
  gap: 4px;
}
.al-st.on {
  color: #26a69a;
}
.al-st.trig {
  color: #ff9800;
}
.al-st.off {
  color: var(--muted);
}
.hint.err {
  color: #ef5350;
}
.acct-steps {
  padding-left: 20px;
  line-height: 1.8;
}

/* 鑷繁鐢荤殑鎸夐挳鎻愮ず妗嗭紙鐓?TradingView锛?*/
.mr-tip {
  position: fixed;
  z-index: 10000;
  max-width: 320px;
  padding: 5px 9px;
  background: var(--tip-bg);
  color: var(--tip-text);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.mr-tip[hidden] {
  display: none;
}

/* 鏀惰棌宸ュ叿鏍忛暱鎸夋嫋鍔ㄦ帓搴?*/
#draw-favs button.fav-dragging {
  background: #2962ff !important;
  color: #fff;
  cursor: grabbing;
  box-shadow: 0 0 0 1px #5b8cff;
}
body.fav-sorting,
body.fav-sorting * {
  cursor: grabbing !important;
  user-select: none;
}

/* 鍥句緥甯?hidden 鏍囪鏃朵竴瀹氫笉鏄剧ず锛?legend 鐨?display: flex 浼氱洊杩?hidden锛屽弻鍑绘斁澶х獥鏍兼椂琚敹璧风獥鏍肩殑鍥句緥瑕佽棌璧锋潵锛?*/
.legend[hidden] {
  display: none !important;
}

/* 鍏ㄥ眬锛氬甫 hidden 鏍囪鐨勫厓绱犱竴寰嬩笉鏄剧ず锛堥槻姝㈡煇涓厓绱犵殑 display 鏍峰紡鐩栬繃 hidden锛?*/
[hidden] {
  display: none !important;
}

.file-btn {
  cursor: pointer;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.al-tabs .al-clear {
  margin-left: auto;
  color: #ef5350;
}

.al-tabs .al-danger {
  color: #ef5350;
}
/* 璀︽姤瑙﹀彂锛氬彸涓嬭鎮诞灏忕獥锛堜笉鏄叏灞忛伄缃╃殑瀵硅瘽妗嗭級 */
dialog.al-pop {
  position: fixed;
  inset: auto 24px 44px auto;
  margin: 0;
  width: 380px;
  max-height: 50vh;
  z-index: 9000;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  border-color: #ff9800;
  padding: 12px 16px;
}
dialog.al-pop h2 {
  font-size: 15px;
  color: var(--warn);
}
dialog.al-pop .al-body {
  max-height: 30vh;
}

.about-credit {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* 浣跨敤璇存槑 */
#btn-help {
  min-width: 28px;
  font-weight: bold;
}
/* 鑷畾涔夋寚鏍囩紪杈戠獥鍙?*/
dialog.cind-dlg {
  width: 820px;
}
#cind-code {
  width: 100%;
  height: 360px;
  margin-top: 6px;
  font-family: Consolas, 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
  resize: vertical;
  tab-size: 2;
}
.hint.ok {
  color: var(--ok);
}

/* 鑷姩鏇存柊鎻愮ず */
.upd-dlg {
  width: 440px;
}
.upd-ver {
  font-size: 16px;
  color: var(--strong);
  margin-bottom: 8px;
}
.upd-notes {
  white-space: pre-wrap;
  max-height: 240px;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 10px;
}
#upd-bar {
  width: 100%;
}

/* 閿佸畾鐣岄潰锛氭病婵€娲?/ 鍒版湡 / 浣滃簾鏃剁洊浣忔暣涓獥鍙?*/
#lock {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 12, 18, 0.92);
  backdrop-filter: blur(6px);
}
.lock-box {
  width: min(460px, calc(100vw - 32px));
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px 28px 22px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.lock-title {
  font-size: 22px;
  font-weight: bold;
  color: var(--strong);
}
.lock-reason {
  margin: 10px 0 18px;
  color: var(--muted);
}
.lock-reason.bad {
  color: #ff9800;
}
.lock-row {
  display: flex;
  gap: 8px;
}
.lock-row input {
  flex: 1;
  height: 34px;
  font-size: 14px;
}
.lock-err {
  min-height: 20px;
  margin-top: 8px;
  color: var(--err);
  font-size: 12px;
}
.lock-foot {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* 浣跨敤璇存槑锛氬彲鎷栧姩銆佸彲鏈€灏忓寲鐨勬偓娴獥锛堜笉鎸℃搷浣滐紝鏂逛究瀵圭収鐫€璇曪級 */
dialog.help-dlg {
  width: 760px;
  position: fixed;
  margin: 0;
  z-index: 8000;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
.help-head {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: grab;
  user-select: none;
  margin: -18px -22px 12px;
  padding: 11px 14px 11px 18px;
  background: var(--hover);
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
}
.help-head:active {
  cursor: grabbing;
}
.help-head::before {
  content: '⋮⋮';
  color: var(--muted);
  font-size: 15px;
  letter-spacing: -3px;
  line-height: 1;
}
.help-head h2 {
  flex: 1;
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--strong);
}
.help-head button {
  min-width: 28px;
}
dialog.help-dlg.min .help-body,
dialog.help-dlg.min .buttons {
  display: none;
}
dialog.help-dlg.min {
  width: 260px;
}
.help-body {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 6px;
  line-height: 1.7;
}

/* 使用说明顶部的快捷跳转按钮（纯不透明背景，避免正文滚动时从按钮背后透出） */
.help-nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 0;
  margin: 0 0 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.help-nav button {
  height: 24px;
  padding: 0 9px;
  font-size: 12px;
  border-radius: 12px;
  border: 1px solid var(--tab-edge);
  color: var(--text);
  background: var(--tab-idle);
}

.help-nav button:hover {
  background: var(--hover);
  color: var(--strong);
}

.help-nav button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.help-body ul {
  margin: 0;
  padding-left: 20px;
}
.help-keys td {
  padding: 2px 12px 2px 0;
  vertical-align: top;
}
.help-keys td:first-child {
  white-space: nowrap;
}
kbd {
  display: inline-block;
  padding: 0 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 3px;
  font-size: 12px;
  line-height: 18px;
  background: rgba(255, 255, 255, 0.05);
}

/* 设置窗口：与使用说明和手机端统一为顶部横排分类按钮 + 下方内容区 */
dialog#settings {
  width: 760px;
  max-height: min(86vh, 760px);
  padding: 0;
  overflow: hidden;
}
dialog#settings[open] {
  display: flex;
  flex-direction: column;
}
#settings-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
#settings-form > h2,
#settings-form > .about {
  flex: none;
}
#settings-form > h2.dlg-drag-handle,
#settings-form > h2.dlg-head {
  margin: 0;
  padding: 11px 14px 11px 18px;
  border-radius: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--strong);
}
.dlg-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dlg-head .dlg-title {
  flex: 1;
  min-width: 0;
}
.dlg-head .dlg-ver {
  flex: none;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.help-fb-btn {
  flex: none;
  height: 26px;
  padding: 0 9px;
  font-size: 11.5px;
  border-radius: 5px;
}
.dlg-head .dlg-close {
  flex: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.dlg-head .dlg-close:hover {
  background: var(--border);
  color: var(--strong);
}
#settings-form > .about {
  margin: 12px 22px 0;
}
#settings-form > .buttons {
  flex: none;
  margin: 10px 22px 16px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.set-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  gap: 10px;
  margin: 8px 22px 0;
}
.set-nav {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
  flex: none;
  padding: 6px 0 10px;
  border-bottom: 1px solid var(--border);
}
.set-nav button {
  height: 28px;
  padding: 0 14px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}
.set-nav button:hover {
  background: var(--hover);
  color: var(--strong);
}
.set-nav button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
.set-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding-right: 6px;
}
.set-pane section h3:first-child {
  margin-top: 4px;
}

/* ---------- 鐧藉ぉ妯″紡锛堢収 TradingView 鐨勬祬鑹蹭富棰橈級 ---------- */
:root[data-theme='light'] {
  --bg: #ffffff;
  --panel: #f8f9fd;
  --border: #e0e3eb;
  --text: #131722;
  --muted: #787b86;
  --strong: #131722;
  --hover: #f0f3fa;
  --sel: #e3effd;
  --soft: #434651;
  --deep: #f0f3fa;
  --tab-idle: #e5eaf3;
  --tab-edge: #aab7cb;
  --tab-active: #dae7ff;
  --closed-bg: #fff0d5;
  --closed-text: #704600;
  --open-bg: #dff5e9;
  --open-text: #146044;
  --tip-bg: #ffffff;
  --tip-text: #131722;
  --warn: #b26a00;
  --legend-hover: rgba(240, 243, 250, 0.92);
  --swatch-border: rgba(19, 23, 34, 0.18);
  --shadow-pop: 0 8px 24px rgba(19, 23, 34, 0.16);
  color-scheme: light;
}
:root[data-theme='light'] .mr-tip {
  border: 1px solid var(--border);
}
:root[data-theme='light'] dialog::backdrop {
  background: rgba(0, 0, 0, 0.25);
}

/* 鍥句緥锛氭渶瀹藉埌浠锋牸杞翠负姝紝鏀句笉涓嬭嚜鍔ㄦ崲琛岋紙澶氬浘骞舵帓銆佸浘寰堢獎鏃朵笉浼氫几鍒版梺杈圭殑鍥句笂锛?*/
.legend {
  max-width: calc(100% - 84px);
}
.legend-row {
  flex-wrap: wrap;
  white-space: normal;
  row-gap: 0;
}
.legend-vals {
  flex-wrap: wrap;
  column-gap: 6px;
  row-gap: 0;
}
.legend-pair {
  display: inline-flex;
  gap: 3px;
  white-space: nowrap;
}
.legend-val {
  white-space: nowrap;
}

/* 宸︿晶宸ュ叿鏍忥細鏀惰棌銆佺櫧澶?/ 榛戝璐寸潃鏈€搴曢儴 */
#draw-toolbar .tb-spacer {
  flex: 1 1 auto;
  min-height: 24px;
}
#draw-toolbar {
  padding-bottom: 8px;
}

.watch-more { width: 100%; padding: 8px; border: 1px dashed var(--border); background: transparent; color: var(--muted); cursor: pointer; }


.watch-group-toggle { width: 100%; text-align: left; border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 4px 6px; }
.watch-group-toggle:hover { background: var(--hover); }


.watch-search-row { display: flex; gap: 4px; align-items: center; }
.watch-search-row .watch-search { flex: 1; }
.watch-search-clear { border: 1px solid var(--border); background: transparent; color: var(--muted); border-radius: 4px; width: 24px; height: 24px; line-height: 1; cursor: pointer; }
.watch-search-clear:hover { color: var(--text); background: var(--hover); }


.watch-group-toggle { width: 100%; text-align: left; border: 0; background: transparent; font-size: 14px; font-weight: 600; cursor: pointer; padding: 6px 6px; color: var(--text); letter-spacing: .5px; }
.watch-group-toggle.folded { color: var(--muted); }
.watch-group-toggle:hover { background: var(--hover); }

/* 使用说明窗口标题栏与设置/指标/警报完全统一 */
#help-head {
  background: var(--hover);
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  padding: 11px 14px 11px 18px;
  cursor: grab;
  user-select: none;
}
#help-head:active { cursor: grabbing; }
#help-head b, #help-head strong, #help-head .help-title {
  font-size: 15px;
  font-weight: 600;
}
#help-body, #help > .help-body { font-size: 13px; }

/* 鍥捐〃鍖轰笉瑕佸嚭鐜版祻瑙堝櫒鏂囧瓧閫夊尯锛堟嫋閫夊悗浼氬湪鍓浘涓婄暀涓嬫秷涓嶆帀鐨勮摑鑹查珮浜級 */
.chart, .legend-layer, .legend, .legend-row, .legend-title, .legend-value,
#grid, .pane, .chart-mask {
  user-select: none;
  -webkit-user-select: none;
}

/* 鍏ㄥ睆鐪嬪浘琛細闅愯棌宸ュ叿鏍忓拰鍝佺鍒楄〃锛屽彧鐣欏浘琛紙鐓?TradingView锛?*/
body.chart-fullscreen #toolbar,
body.chart-fullscreen #watch,
body.chart-fullscreen .strip-arrow {
  display: none !important;
}

/* 收藏工具栏：拖动柄做成两列小点（照 TradingView），工具按钮仍是单排 */
#draw-favs .fav-grip {
  width: 12px;
  height: 18px;
  font-size: 0;
  line-height: 0;
  color: var(--muted);
  background-image: radial-gradient(circle, currentColor 1.1px, transparent 1.2px);
  background-size: 6px 6px;
  background-repeat: repeat;
  cursor: grab;
}

/* 全屏按钮的「已全屏」状态 */
#win-full.active { color: var(--accent, #4c9aff); background: var(--hover); }

/* 可拖动的把手统一成「两列三点」（照 TradingView 的 ⠿），不再用字符拼 */
#replay-bar .rp-grip {
  width: 12px;
  height: 18px;
  letter-spacing: 0;
  background-image: radial-gradient(circle, currentColor 1.1px, transparent 1.2px);
  background-size: 6px 6px;
  background-repeat: repeat;
  cursor: grab;
}
#replay-bar .rp-grip:active {
  cursor: grabbing;
}

/* 自选与多列表板块长按拖动排序 */
.watch-section { display: flex; flex-direction: column; }
.watch-section.dragging {
  opacity: 0.78;
  outline: 1px dashed var(--accent);
  outline-offset: -2px;
  background: rgba(41, 98, 255, 0.08);
}
.watch-group-toggle.reorderable { touch-action: pan-y; }
.watch-section.dragging .watch-group-toggle { cursor: grabbing; }
.watch-row.reorderable { touch-action: pan-y; }
.watch-row.dragging {
  opacity: 0.78;
  outline: 1px dashed var(--accent);
  outline-offset: -2px;
  background: var(--sel);
}

/* 自选：长按拖动排序时不选中文字；右键菜单范围 */
.watch-list, .watch-row { user-select: none; -webkit-user-select: none; }
.watch-row.dragging { cursor: grabbing; }

/* 布局菜单里「保存 / 另存为 / 重命名」这类文字按钮：单排、按文字宽度 */
#layout-menu .layout-row.actions {
  flex-wrap: nowrap;
  gap: 6px;
}
#layout-menu .layout-row.actions button {
  width: auto;
  min-width: 0;
  padding: 0 12px;
  white-space: nowrap;
  font-size: 13px;
  color: var(--strong);
  border-color: var(--border) !important;
}
#layout-menu .layout-row.actions button:hover { background: var(--hover); }

/* 使用说明独立窗口（?help=1）：整个窗口就是说明，可以拖到任意一块屏幕 */
html.help-only body > *:not(#help) { display: none !important; }
html.help-only #help {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: var(--bg);
  z-index: 1000;
}
html.help-only #help .help-head { cursor: default; }
html.help-only #help-detach { display: none; }

/* 自选表顶部的拖动排序提示 */
.watch-hint {
  padding: 5px 8px 6px;
  font-size: 11px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  user-select: none;
}

/* 标签页上的品种实时价格 */
.win-tab-quote {
  flex: 0 0 auto;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
  white-space: nowrap;
}
.win-tab-quote:empty { display: none; }

/* ===== 贴着按钮的小框（确认 / 提示，替代系统 confirm / alert） ===== */
.mr-pop {
  position: fixed;
  inset: auto;
  margin: 0;
  z-index: 4000;
  min-width: 190px;
  max-width: 330px;
  padding: 12px 14px 10px;
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
  font-size: 13px;
  line-height: 1.45;
}

.mr-pop::before {
  content: '';
  position: absolute;
  width: 9px;
  height: 9px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
  left: -5px;
  top: calc(var(--arrow-y, 20px) - 5px);
}

.mr-pop[data-side='left']::before {
  left: auto;
  right: -5px;
  transform: rotate(225deg);
}

.mr-pop[data-side='below']::before {
  left: calc(var(--arrow-x, 20px) - 5px);
  top: -5px;
  transform: rotate(135deg);
}

.mr-pop-text {
  white-space: pre-wrap;
  word-break: break-word;
}

/* 水平十字线右端的「+」和它的小菜单（照 TradingView） */
.cross-plus {
  position: absolute;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--strong);
  font-size: 15px;
  line-height: 1;
  text-align: center;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.45);
}

.cross-plus:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.cross-menu {
  position: absolute;
  z-index: 21;
  min-width: 210px;
  padding: 4px 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.cross-menu button {
  height: 28px;
  padding: 0 14px;
  border: none;
  border-radius: 0;
  background: none;
  text-align: left;
  white-space: nowrap;
}

.cross-menu button:hover {
  background: var(--hover);
}

/* 设置、警报、指标、布局、使用说明等窗口的标题栏统一按设置样式，鼠标呈小手抓取态 */
.dlg-drag-handle {
  cursor: grab;
  user-select: none;
}
.dlg-drag-handle:active {
  cursor: grabbing;
}

/* 可拖动窗口的标题栏：整条统一底色、字号、间距，按住任意位置都能拖 */
dialog > h2.dlg-drag-handle,
dialog > form > h2.dlg-drag-handle {
  margin: -18px -22px 12px;
  padding: 11px 14px 11px 18px;
  background: var(--hover);
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--strong);
  cursor: grab;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
dialog > h2.dlg-drag-handle:active,
dialog > form > h2.dlg-drag-handle:active {
  cursor: grabbing;
}

dialog > h2.dlg-drag-handle::before,
dialog > form > h2.dlg-drag-handle::before {
  content: '⋮⋮';
  color: var(--muted);
  font-size: 15px;
  letter-spacing: -3px;
  line-height: 1;
}


body.dlg-dragging,
body.dlg-dragging * {
  cursor: grabbing !important;
}

.mr-pop-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.mr-pop-btns button {
  height: 26px;
  padding: 0 12px;
  border-radius: 5px;
  font-size: 12px;
}

.mr-pop-btns .mr-pop-ok {
  border-color: var(--accent);
  color: var(--strong);
}

.mr-pop-btns .mr-pop-ok.danger {
  background: var(--err);
  border-color: var(--err);
  color: #fff;
}

.mr-pop-btns .mr-pop-ok.danger:hover {
  filter: brightness(1.1);
}

.mr-pop-note {
  min-width: 220px;
}

.mr-pop-input {
  display: block;
  width: 100%;
  margin-top: 8px;
  height: 28px;
  box-sizing: border-box;
}

.mr-pop-text-ask {
  min-width: 260px;
}

.mr-pop-note .mr-pop-btns {
  margin-top: 8px;
}

/* ---------- 手机端布局（2026-11-30 用户定的方案） ---------- */
#mobile-top { display: none; }
#mobile-drawbar, #mobile-funcbar { display: none; }
.legend-row { flex-wrap: wrap; }

body.mobile #titlebar { display: none; }
body.mobile #statusbar { display: none; }
body.mobile #mobile-top {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 46px;
  flex: none;
  padding: 0 8px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  order: 0;
}
body.mobile #mobile-top button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  flex: none;
  border: 0;
  background: none;
  color: var(--text);
  font-size: 18px;
  border-radius: 8px;
}
body.mobile #mt-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}
body.mobile #mt-meta {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
}
body.mobile #mt-meta-top,
body.mobile #mt-meta-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  line-height: 1.15;
}
body.mobile #mt-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
body.mobile #mt-ex {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  flex: none;
}
body.mobile #mt-tf {
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  flex: none;
}
body.mobile #mt-session {
  font-size: 9.5px;
  line-height: 13px;
  padding: 0 4px;
  border-radius: 3px;
  flex: none;
}
body.mobile #mt-price {
  font-size: 14px;
  font-weight: 700;
  flex: none;
  font-variant-numeric: tabular-nums;
}
body.mobile #workspace { order: 1; flex-direction: column; }
body.mobile #grid { order: 1; flex: 1; min-height: 0; }
body.mobile #draw-toolbar { display: none; }
body.mobile #toolbar { display: none; }
body.mobile #mobile-drawbar {
  display: flex;
  align-items: center;
  height: 52px;
  flex: none;
  padding: 0 5px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  order: 2;
}
body.mobile #md-cat {
  width: 30px;
  height: 40px;
  flex: none;
  margin: 0 6px;
  border: 1.5px solid var(--accent);
  border-radius: 8px;
  background: rgba(41, 98, 255, 0.1);
  color: var(--accent);
  font-size: 8px;
  font-weight: 700;
  line-height: 1.15;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
body.mobile #md-cat.off { border-color: var(--tab-edge); color: var(--muted); background: transparent; }
body.mobile .mobile-bottom-strip {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  overflow-x: auto;
  gap: 3px;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}
body.mobile #md-periods button {
  flex: none;
  min-width: 45px;
  min-height: 36px;
  padding: 0 9px;
  border-color: transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}
body.mobile #md-periods button[aria-disabled] { color: var(--muted); }
body.mobile #md-periods button[aria-current] {
  background: var(--accent);
  color: #fff;
}
body.mobile .md-tool {
  width: 38px;
  height: 44px;
  flex: none;
  border: 0;
  background: transparent;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 7.5px;
  border-radius: 7px;
  padding: 0;
}
body.mobile .md-tool svg { width: 16px; height: 16px; }
body.mobile #mobile-funcbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  height: 50px;
  flex: none;
  padding: 0 6px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  order: 3;
}
body.mobile #mobile-funcbar button {
  flex: 1;
  height: 36px;
  border: 1px solid var(--tab-edge);
  border-radius: 9px;
  background: var(--tab-idle);
  color: var(--soft);
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
body.mobile #mobile-funcbar button:active { color: #fff; background: var(--accent); border-color: var(--accent); }
body.mobile #mobile-funcbar .mf-landscape-only { display: none; }

body.mobile .md-tool {
  width: 42px;
  height: 46px;
  font-size: 8.5px;
  gap: 3px;
}
body.mobile .md-tool svg { width: 18px; height: 18px; }
body.mobile .md-tool.on { background: var(--accent); color: #fff; }

body.mobile.hide-drawbar #mobile-drawbar { display: none; }

/* 手机：让出系统状态栏 / 手势条，品种列表不盖住顶部条和底部工具栏 */
body.mobile { padding-top: env(safe-area-inset-top, 0px); }
body.mobile #mobile-drawbar,
body.mobile #mobile-funcbar { position: relative; z-index: 400; }
body.mobile #mobile-funcbar {
  height: calc(50px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

/* 手机：对话框铺满可用区域（不继承电脑上的拖动位置），内部滚动 */
body.mobile dialog:not(.al-pop) {
  position: fixed !important;
  inset: 0 !important;
  margin: auto !important;
  width: calc(100vw - 16px) !important;
  max-width: calc(100vw - 16px) !important;
  max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  overflow: auto;
}
/* 手机：警报弹窗放底部，内容多了可以滑 */
body.mobile dialog.al-pop {
  position: fixed !important;
  left: 8px !important;
  right: 8px !important;
  bottom: calc(8px + env(safe-area-inset-bottom, 0px)) !important;
  top: auto !important;
  width: auto !important;
  max-height: 62dvh;
  overflow: auto;
}
body.mobile dialog.al-pop .al-body { max-height: 46dvh; overflow: auto; }
body.mobile dialog.al-pop .buttons button { min-width: 88px; padding: 8px 14px; line-height: 1.3; }
/* 手机：右键菜单 / 布局菜单用不透明底色，别看不清 */
body.mobile .ctx-menu,
body.mobile .layout-menu {
  background: var(--panel) !important;
  opacity: 1 !important;
  max-height: 72dvh;
  overflow: auto;
  z-index: 9999;
}

/* 顶部价格两行（价格 + 涨跌幅） */
body.mobile #mt-price { display: flex; flex-direction: column; align-items: flex-start; align-self: center; line-height: 1.05; }
body.mobile #mt-price small { font-size: 9.5px; font-weight: 400; }
/* 左右两个按钮做成看得出是按钮 */
body.mobile #mobile-top button {
  width: clamp(29px, 8vw, 36px);
  background: var(--tab-idle);
  border: 1px solid var(--tab-edge);
  border-radius: 9px;
  color: var(--text);
}
body.mobile #mobile-top button:active { background: var(--accent); border-color: var(--accent); color: #fff; }
/* 横屏快捷组：「布局」在左、「退出」在右（仅真正进入横屏全屏时显示「退出」，已移除容易错位的竖屏放大模式） */
body.mobile.landscape.mobile-fullscreen #mobile-top { display: none; }
#mt-land-actions { display: none; }
body.mobile.landscape #mt-land-actions {
  position: fixed;
  right: calc(8px + env(safe-area-inset-right, 0px));
  top: calc(6px + env(safe-area-inset-top, 0px));
  z-index: 999;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
body.mobile.landscape #mt-land-actions[hidden] { display: none; }
body.mobile #mt-land-layout,
body.mobile #mt-exit-fs {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: auto !important;
  padding: 0 10px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: rgba(26, 31, 43, 0.9) !important;
  color: #ffffff !important;
  font-size: 12px;
  backdrop-filter: blur(4px);
}
body.mobile #mt-exit-fs[hidden] { display: none; }

/* 手机菜单：始终在屏幕内，别被左边裁掉（.mobile-sheet 由下方 --sheet-left 统一定位，不抢占横屏左侧工具栏） */
body.mobile .ctx-menu:not(#rp-menu):not(.mobile-select-menu):not(#draw-flyout):not(.mobile-sheet),
body.mobile .layout-menu:not(.mobile-sheet) {
  left: 8px !important;
  right: 8px !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: calc(100vw - 16px) !important;
  max-height: 72dvh;
  overflow: auto;
  z-index: 9999;
}
body.mobile .ctx-menu button,
body.mobile #tf-menu button { padding: 11px 14px; font-size: 13px; }
/* 警报弹窗：关闭按钮拉宽，说明文字可以提前换行 */
body.mobile dialog.al-pop .buttons { display: flex; gap: 8px; justify-content: flex-end; margin-top: 8px; }
body.mobile dialog.al-pop .buttons button { min-width: 96px; padding: 10px 16px; white-space: nowrap; }
body.mobile dialog.al-pop .al-main { white-space: normal; word-break: break-word; }
/* 手机：设置 / 指标 / 警报等窗口和品种列表一样高（顶部条下方到底部工具栏上方） */
body.mobile dialog:not(.al-pop) {
  top: calc(46px + env(safe-area-inset-top, 0px)) !important;
  bottom: calc(102px + env(safe-area-inset-bottom, 0px)) !important;
  left: 8px !important;
  right: 8px !important;
  height: auto !important;
  max-height: none !important;
  margin: 0 !important;
  width: auto !important;
}
/* 手机：布局菜单里的样式图标放大，别缩成小点 */
body.mobile .mobile-saved-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px 8px;
}
body.mobile .mobile-saved-row { display: flex; gap: 6px; }
body.mobile .mobile-saved-row button:first-child {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
body.mobile .mobile-saved-row .mobile-saved-remove {
  flex: none;
  min-width: 56px;
  text-align: center;
  white-space: nowrap;
  color: var(--down, #ef5350);
}
body.mobile .mobile-saved-list button {
  min-height: 40px;
  padding: 8px 10px;
  text-align: left;
  border: 1px solid var(--tab-edge);
  border-radius: 8px;
  background: var(--tab-idle);
  color: var(--text);
  font-size: 13px;
}
body.mobile .mobile-saved-list button:active { background: var(--accent); color: #fff; }
body.mobile #layout-menu .layout-row button { min-width: 42px; min-height: 42px; }
body.mobile #layout-menu .layout-row button svg { width: 30px; height: 30px; }


/* ===== 2026-12-01 手机第二批：图例信息条 / 警报弹窗居中 / 触摸拖动 ===== */

/* 主图图例挪到图表上方的独立信息条，不再盖住 K 线顶部（手机优先；电脑保持原样） */
body.mobile .cell { flex-direction: column; }
body.mobile .cell > .chart-legend-bar {
  flex: none;
  width: 100%;
  padding: 3px 8px 2px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
body.mobile .chart-legend-bar .legend-layer { position: static; inset: auto; }
body.mobile .chart-legend-bar .legend { position: static; left: 0; max-width: 100%; }
body.mobile .chart-legend-bar .legend-row { font-size: 11px; line-height: 16px; gap: 5px; }
body.mobile .chart-legend-bar .legend-title { font-size: 12px; }
/* 手机端：点击指标名或长按指标行，内联展开与电脑端一致的「隐藏 / 设置 / 删除」按钮 */
body.mobile .chart-legend-bar .legend-tools,
body.mobile .legend-layer .legend-tools { display: none; }
body.mobile .legend-ind.is-open {
  border-color: var(--accent);
  background: var(--legend-hover);
}
body.mobile .legend-ind.is-open .legend-tools { display: inline-flex; gap: 3px; }
body.mobile .legend-ind.is-open .legend-btn { width: 26px; height: 24px; }
body.mobile .legend-name { padding: 1px 2px; border-radius: 3px; }
/* 手机：选中画线后的浮动工具栏放到图表底部，别压住上面的图例信息条 */
body.mobile .draw-float {
  top: auto;
  bottom: 6px;
  width: max-content;
  max-width: calc(100% - 12px);
}
body.mobile .draw-float button { flex: none; min-height: 32px; white-space: nowrap; }
body.mobile .draw-float .df-action { min-width: 48px; padding: 0 8px; }
body.mobile .draw-float .df-kind { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 手机：十字光标「+」加大，手指好点（位置仍贴主图右边） */
body.mobile .cross-plus {
  width: 28px;
  height: 28px;
  font-size: 21px;
  line-height: 26px;
}

/* 手机：警报触发的弹窗放屏幕正中间（不贴底），内容多了自己滚 */
body.mobile dialog.al-pop {
  position: fixed !important;
  inset: 0 !important;
  left: 0 !important;
  right: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  margin: auto !important;
  width: calc(100vw - 28px) !important;
  max-width: 440px !important;
  height: fit-content !important;
  max-height: calc(72dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  overflow: auto;
  padding: 14px 16px;
  border-radius: 12px;
}
body.mobile dialog.al-pop h2 { touch-action: none; cursor: grab; }
body.mobile dialog.al-pop h2:active { cursor: grabbing; }
body.mobile dialog.al-pop .al-body { max-height: 46dvh; overflow: auto; }

/* 手机收藏条：六点拖动柄居中，工具单排横滑 + 底部滑动进度条。 */
body.mobile #draw-favs {
  position: fixed;
  width: max-content;
  max-width: min(264px, calc(100vw - 12px));
  padding-bottom: 7px;
}
body.mobile #draw-favs .fav-grip {
  flex: 0 0 26px;
  width: 26px;
  height: 38px;
  padding: 0 !important;
  margin: 0;
  background: none;
  display: grid;
  place-items: center;
  touch-action: none;
}
body.mobile #draw-favs .fav-grip::before {
  content: '';
  display: block;
  width: 10px;
  height: 16px;
  background: radial-gradient(circle, currentColor 1.2px, transparent 1.35px) 0 0 / 5px 5.3px;
}
body.mobile #draw-favs .fav-tools {
  display: flex;
  min-width: 0;
  gap: 2px;
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--muted) transparent;
}
body.mobile #draw-favs .fav-tools button {
  flex: 0 0 36px;
  height: 38px;
}
body.mobile .fav-empty {
  max-width: calc(100vw - 8px);
  overflow-wrap: anywhere;
}

/* 手机：画线子工具长按后拖动排序时的样子（竖屏与横屏均锁定原生滚动，防止安卓 WebView 抢走手势） */
body.mobile #md-scroll.md-sorting { scroll-behavior: auto; touch-action: none; user-select: none; -webkit-user-select: none; }
body.mobile .md-tool.md-sorting {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.75);
}
body.mobile .md-tool.md-dragging {
  opacity: 0.92;
  transform: scale(1.08);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(91, 140, 255, 0.9);
}

/* ===== 2026-12-01 手机第三批：横屏左侧窄栏 + 双列画线面板 ===== */
body.mobile.landscape #workspace { flex-direction: row; }
body.mobile.landscape #grid { order: 2; }

body.mobile.landscape :is(#mobile-funcbar, #mobile-drawbar) {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  height: auto;
  min-height: 0;
  padding: 5px 3px;
  border: 0;
  border-right: 1px solid var(--border);
}
body.mobile.landscape #mobile-funcbar {
  order: 0;
  width: var(--landscape-functions);
  justify-content: flex-start;
  overflow-y: auto;
}
body.mobile.landscape #mobile-funcbar button {
  flex: 1 0 0;
  height: auto;
  min-height: 29px;
  padding: 0;
}
body.mobile.landscape #mobile-funcbar .mf-landscape-only { display: flex; }
body.mobile.landscape #mf-help { font-size: 16px; }
body.mobile.landscape #mobile-drawbar {
  order: 1;
  width: var(--landscape-tools);
}
body.mobile.landscape.hide-drawbar #mobile-drawbar { display: none; }
body.mobile.landscape #md-cat { width: 100%; height: 36px; margin: 0 0 3px; font-size: 10px; }
body.mobile.landscape .mobile-bottom-strip {
  flex-direction: column;
  align-items: stretch;
  min-height: 0;
  overflow: hidden auto;
  touch-action: pan-y;
  overscroll-behavior-y: contain;
}
body.mobile.landscape #md-periods button {
  min-width: 0;
  padding: 0 2px;
  font-size: 10px;
}
body.mobile.landscape .md-tool { width: 100%; }
body.mobile.landscape #md-scroll.md-sorting { touch-action: none; }

body.mobile.landscape #mobile-top {
  height: 46px;
  padding: 0 8px;
}
body.mobile #mt-replay.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
body.mobile.landscape #mobile-top :is(#mt-replay, #mt-help) { display: none; }
body.mobile.landscape #mt-name { font-size: 14px; }
body.mobile.landscape #mt-price { font-size: 15px; }
/* 横屏底部状态行（周期、时间、实时状态），高度小、不挡图 */
body.mobile.landscape #statusbar {
  display: flex;
  order: 4;
  height: calc(24px + env(safe-area-inset-bottom, 0px));
  padding: 0 8px calc(env(safe-area-inset-bottom, 0px));
  font-size: 10.5px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  color: var(--muted);
}
body.mobile.landscape #statusbar #status-text { margin-left: auto; }
/* 横屏没有底部两行工具栏了：对话框只让出底部状态行 */
body.mobile.landscape dialog:not(.al-pop) {
  bottom: calc(32px + env(safe-area-inset-bottom, 0px)) !important;
}

body.mobile.landscape.mobile-fullscreen #statusbar { display: none; }

/* 这些手机面板都占用图表的可见区域，只有中间的内容滚动。 */
body.mobile {
  --sheet-top: calc(46px + env(safe-area-inset-top, 0px));
  --sheet-bottom: calc(102px + env(safe-area-inset-bottom, 0px));
  --sheet-left: 0px;
}
body.mobile.hide-drawbar {
  --sheet-bottom: calc(50px + env(safe-area-inset-bottom, 0px));
}
body.mobile.landscape {
  --landscape-functions: 52px;
  --landscape-tools: 54px;
  --landscape-bars: calc(var(--landscape-functions) + var(--landscape-tools));
  --sheet-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  --sheet-left: var(--landscape-bars);
}
body.mobile.landscape.mobile-fullscreen {
  --sheet-top: env(safe-area-inset-top, 0px);
  --sheet-bottom: env(safe-area-inset-bottom, 0px);
  --sheet-left: var(--sheet-left-live, calc(var(--landscape-bars) + env(safe-area-inset-left, 0px)));
}
body.mobile.web {
  height: 100dvh;
}
@media (display-mode: standalone) {
  body.mobile.web {
    height: 100%;
  }
}
/* 手机横屏避让 iPhone 灵动岛/刘海左右安全区，并用实测左侧栏右边界定位浮窗 */
body.mobile.landscape {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  --sheet-left: var(--sheet-left-live, calc(var(--landscape-bars) + env(safe-area-inset-left, 0px)));
}
body.mobile.landscape.hide-drawbar { --landscape-bars: var(--landscape-functions); }
body.mobile :is(#watch, #tf-menu, #layout-menu, dialog.mobile-sheet[open]) {
  display: flex;
  flex-direction: column;
  position: fixed !important;
  inset: var(--sheet-top) 0 var(--sheet-bottom) var(--sheet-left) !important;
  width: auto !important;
  height: auto !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--panel);
  overflow: hidden;
  z-index: 8000;
}
/* 横屏下品种/指标/警报/周期/布局/设置采用紧凑抽屉宽度，紧贴左侧栏右边缘，绝不盖住左侧功能键且右侧保留 K 线视野 */
body.mobile.landscape :is(#watch, #tf-menu, #layout-menu, dialog.mobile-sheet[open]) {
  left: var(--sheet-left-live, calc(var(--landscape-bars) + env(safe-area-inset-left, 0px))) !important;
  right: auto !important;
  width: min(440px, calc(100vw - var(--sheet-left-live, calc(var(--landscape-bars) + env(safe-area-inset-left, 0px))) - env(safe-area-inset-right, 0px))) !important;
  border-right: 1px solid var(--border);
  box-shadow: 6px 0 24px rgba(0, 0, 0, 0.45);
}
body.mobile .mobile-sheet-title {
  flex: none;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--strong);
  font-size: 16px;
  line-height: 20px;
}
body.mobile .mobile-sheet-footer {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
body.mobile .mobile-sheet-footer button {
  flex: none;
  min-width: 68px;
  min-height: 38px;
  padding: 6px 12px;
  white-space: nowrap;
  border: 1px solid var(--tab-edge);
  border-radius: 8px;
  line-height: 1.2;
}
body.mobile .mobile-sheet-footer .primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
body.mobile .mobile-scroll-frame {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
body.mobile .mobile-scroll-frame > :first-child {
  flex: 1 1 auto;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
}
body.mobile .mobile-scroll-frame > :first-child::-webkit-scrollbar {
  display: none;
}
body.mobile .mobile-scroll-rail {
  position: absolute;
  top: 5px;
  bottom: 5px;
  right: 3px;
  width: 4px;
  border-radius: 6px;
  background: var(--border);
  pointer-events: none;
}
body.mobile .mobile-scroll-rail span {
  display: block;
  width: 100%;
  border-radius: inherit;
  background: var(--muted);
}
body.mobile #watch .watch-head,
body.mobile #watch .watch-search-row,
body.mobile #watch .watch-cols { flex: none; }
body.mobile #watch .watch-resizer { display: none; }
body.mobile #watch .watch-list { padding-right: 8px; touch-action: pan-y; }
body.mobile.watch-sorting #watch .watch-list { touch-action: none; }
body.mobile .mobile-menu-content { padding: 5px 12px; }
body.mobile #layout-menu .layout-row { flex-wrap: wrap; }
body.mobile #tf-menu .mobile-menu-content > button {
  width: 100%;
  min-height: 40px;
  text-align: left;
}
body.mobile #tf-menu .mobile-menu-content > .active {
  background: var(--sel);
  color: var(--strong);
  box-shadow: inset 3px 0 var(--accent);
  font-weight: 700;
}
body.mobile #tf-menu .tf-menu-input {
  flex: 0 1 120px;
  width: 120px;
  min-width: 0;
  min-height: 38px;
  padding: 0 8px;
  background: var(--bg);
  border: 1px solid var(--tab-edge);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
body.mobile #tf-menu .mobile-sheet-close { margin-left: auto; }

body.mobile .desktop-about,
body.mobile .desktop-alert-hint,
body.mobile #help-detach,
body.mobile #help-min { display: none; }
body.mobile #settings-form > .buttons {
  margin: 0;
  padding: 8px 12px;
}
body.mobile #settings-form > h2.dlg-head {
  padding: 10px 10px 10px 14px;
}
body.mobile #settings-form,
body.mobile #settings .set-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  gap: 0;
  margin: 0;
}
body.mobile #settings .set-nav {
  flex-direction: row;
  gap: 4px;
  width: 100%;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
body.mobile #settings .set-nav button { flex: none; white-space: nowrap; }
body.mobile #settings .set-nav button.active { background: var(--sel); }
body.mobile #settings .set-pane,
body.mobile #ind-lib-list,
body.mobile #alert-list .al-body { padding: 6px 13px 12px; }
body.mobile #help .help-body { padding: 0 13px 12px; }
body.mobile #help-head {
  margin: 0 !important;
  padding: 10px 10px 10px 14px !important;
  border-radius: 0 !important;
  border-bottom: 1px solid var(--border) !important;
  background: var(--panel) !important;
  align-items: center;
}
body.mobile #help-head h2.mobile-sheet-title {
  padding: 0 !important;
  border: 0 !important;
  flex: 1;
}
body.mobile .mobile-sheet-title.dlg-head {
  padding: 10px 10px 10px 14px;
}
body.mobile #settings .row { flex-wrap: wrap; }
body.mobile #settings :is(input, select) { max-width: 100%; }
body.mobile #ind-lib .ind-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
body.mobile #ind-lib .ind-row > .hint { flex: 1 1 100%; order: 1; }
body.mobile #alert-list .al-tabs {
  flex: none;
  flex-wrap: wrap;
  margin: 0;
  padding: 6px 12px;
}
body.mobile #alert-list .al-tabs button { min-height: 34px; white-space: nowrap; }
body.mobile #alert-list .al-row { flex-wrap: wrap; touch-action: manipulation; }
body.mobile #alert-list .al-info { flex: 1 1 170px; overflow-wrap: anywhere; }
body.mobile #alert-list .al-list-hint { margin: 0 auto 0 0; }
body.mobile #help-head {
  cursor: default;
  margin: 0;
  padding: 0 12px 0 0;
  border-bottom: 1px solid var(--border);
}
body.mobile #help-head h2 { border: 0; }
body.mobile #help-head h2::after { display: none; }
body.mobile .help-download { overflow-wrap: anywhere; }
body.mobile .help-nav {
  display: grid;
  grid-template-columns: repeat(var(--help-columns, 6), minmax(0, 1fr));
  gap: 4px;
}
body.mobile .help-nav button {
  min-width: 0;
  min-height: 29px;
  height: auto;
  padding: 3px 2px;
  font-size: 11px;
  line-height: 1.2;
  white-space: normal;
}
body.mobile :is(#settings .set-pane, #help .help-body) { touch-action: pan-y; }
body.mobile .mobile-help-section li { margin-bottom: 5px; }
body.mobile .chart { position: relative; }
body.mobile .chart-pull {
  position: absolute;
  top: var(--pull-distance, 0px);
  left: 50%;
  z-index: 19;
  transform: translateX(-50%);
  border: 1px solid var(--tab-edge);
  border-radius: 20px;
  padding: 6px 12px;
  color: var(--text);
  background: var(--panel);
  white-space: nowrap;
  pointer-events: none;
}
body.mobile :is(.chart-pull, .watch-pull).ready { color: var(--accent); }

/* 手机盯盘「添加品种」：小框居中，不再用安卓原生全屏下拉 */
dialog.monitor-pick-dialog {
  width: min(92vw, 340px);
  max-width: min(92vw, 340px);
  height: min(58dvh, 430px);
  max-height: min(58dvh, 430px);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
dialog.monitor-pick-dialog[open] { display: flex; flex-direction: column; }
dialog.monitor-pick-dialog::backdrop { background: rgba(0, 0, 0, 0.48); }
body.mobile dialog.monitor-pick-dialog {
  top: 50% !important;
  left: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%);
  width: min(92vw, 340px) !important;
  max-width: min(92vw, 340px) !important;
  height: min(58dvh, 430px) !important;
  max-height: min(58dvh, 430px) !important;
  margin: 0 !important;
}
dialog.monitor-pick-dialog > h3 {
  flex: none;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--strong);
  font-size: 15px;
}
.monitor-pick-list { flex: 1; min-height: 0; overflow-y: auto; }
.monitor-pick-list button {
  width: 100%;
  min-height: 42px;
  padding: 8px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}
.monitor-pick-list button:active { background: var(--accent); color: #fff; }
.monitor-add {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--tab-edge);
  border-radius: 8px;
  background: var(--tab-idle);
  color: var(--text);
  font-size: 12px;
}
.monitor-pick-close {
  flex: none;
  margin: 10px 12px;
  min-height: 38px;
  border: 1px solid var(--tab-edge);
  border-radius: 8px;
  background: var(--tab-idle);
  color: var(--text);
  font-size: 14px;
}

/* ===== 2026-12-01 全库体检视觉与交互抛光 ===== */

/* 全局交互反馈：焦点轮廓、主按钮悬停提亮、禁用态清晰可辨 */
:is(button, input, select, textarea, a):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
button.primary:hover:not(:disabled) {
  filter: brightness(1.1);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 桌面端细圆角滚动条（更贴近 TradingView 紧凑金融界面） */
body:not(.mobile) ::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
body:not(.mobile) ::-webkit-scrollbar-track {
  background: transparent;
}
body:not(.mobile) ::-webkit-scrollbar-thumb {
  background: rgba(138, 143, 156, 0.35);
  border-radius: 999px;
}
body:not(.mobile) ::-webkit-scrollbar-thumb:hover {
  background: rgba(138, 143, 156, 0.58);
}

/* 顶部标签页溢出保护 & 回放时间防抖动 */
.win-tab { overflow: hidden; }
.win-tab-layout { flex: 0 1 auto; min-width: 0; }
#rp-time { min-width: 185px; }

/* 设置页宽输入框：电脑端舒展、手机端自适应不撑爆屏幕 */
.wide-input { width: min(320px, 100%); max-width: 100%; }
.wide-input-lg { width: min(420px, 100%); }
body.mobile .wide-input,
body.mobile .wide-input-lg {
  width: 100%;
  min-width: 0;
  flex: 1 1 100%;
}

/* 手机端按钮按压态 & 弹窗/画线子类菜单统一基于可见图表区定位（适配横屏与隐藏画线栏） */
body.mobile .md-tool:active,
body.mobile #md-periods button:active {
  background: var(--sel);
}
body.mobile dialog:not(.al-pop):not(.mobile-sheet):not(.monitor-pick-dialog) {
  top: calc(var(--sheet-top) + 4px) !important;
  bottom: calc(var(--sheet-bottom) + 4px) !important;
  left: calc(var(--sheet-left) + 8px) !important;
  right: 8px !important;
}
body.mobile:not(.landscape) #draw-flyout {
  left: calc(var(--sheet-left) + 8px) !important;
  right: 8px !important;
  top: auto !important;
  bottom: calc(var(--sheet-bottom) + 8px) !important;
  width: auto !important;
  max-height: 52dvh;
  overflow-y: auto;
}
body.mobile .mr-pop {
  z-index: 9500;
}

/* 手机布局菜单里的 K 线回放入口 & 手机端回放控制条适配 */
body.mobile .mobile-replay-entry {
  width: 100%;
  min-height: 40px;
  margin: 6px 0 8px;
  padding: 8px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--sel);
  color: var(--strong);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}
body.mobile .mobile-replay-entry:active {
  background: var(--accent);
  color: #ffffff;
}
body.mobile #replay-bar {
  left: calc(var(--sheet-left) + 6px) !important;
  right: 6px !important;
  bottom: calc(var(--sheet-bottom) + 6px) !important;
  top: auto !important;
  transform: none !important;
  max-width: calc(100vw - var(--sheet-left) - 12px);
  overflow-x: auto;
  flex-wrap: nowrap;
  gap: 5px;
  padding: 5px 8px;
}
body.mobile #replay-bar #rp-time { min-width: 0; }

/* 选中画线的浮动栏：六点拖动柄与删除红警示 */
.draw-float .df-grip {
  width: 10px;
  height: 16px;
  flex: none;
  color: var(--muted);
  background-image: radial-gradient(circle, currentColor 1.1px, transparent 1.2px);
  background-size: 5px 5px;
  background-repeat: repeat;
  cursor: grab;
  touch-action: none;
}
.draw-float .df-grip:active { cursor: grabbing; }
.draw-float .df-del:hover {
  border-color: var(--err);
  color: var(--err);
  background: rgba(239, 83, 80, 0.12);
}

/* 手机端热区微调：十字线 + 保持 position: absolute（勿覆盖为 relative，否则会被挤出画布），仅用伪元素扩大透明点击热区；自选星标列防误触 */
body.mobile .cross-plus::after {
  content: '';
  position: absolute;
  inset: -6px;
}
body.mobile .watch-cols,
body.mobile .watch-row {
  grid-template-columns: 28px minmax(88px, 1fr) var(--w-last, 72px) var(--w-chg, 62px);
}

/* ===== 2026-12-01 0.6.1 / 安卓 0.1.8 交互与视觉统一打磨 ===== */

/* 全站统一圆角基准 */
:root {
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
}

/* 1. 设置、自选列表、指标/画线弹窗、使用说明：标题/分类标签栏全部居中且选中态统一醒目主蓝色（与底部保存按钮一致） */
.set-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: var(--r-sm);
}
.set-nav button.active,
body.mobile #settings .set-nav button.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
body.mobile #settings .set-nav {
  justify-content: safe center;
  gap: 6px;
  padding: 8px 10px;
}
body.mobile #settings .set-nav button {
  flex: 1 0 auto;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--tab-edge);
  background: var(--tab-idle);
}
body.mobile #settings .set-nav button.active {
  border-color: var(--accent);
}

.watch-head {
  padding: 4px 6px;
  gap: 4px;
}
.watch-tabs {
  gap: 4px;
  align-items: center;
}
.watch-tabs button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6px 4px;
  border-bottom: none;
  border-radius: var(--r-sm);
}
.watch-tabs button.active {
  background: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
.tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.tabs .tab {
  flex: 1;
  text-align: center;
  border-radius: var(--r-sm);
}
.tabs .tab.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}
.help-nav button {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: var(--r-sm);
}
.help-nav button.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
}

/* 2. 警报界面（图一）：单排紧凑展示「警报 / 日志 / 重启不活跃 / 删除不活跃 / 删除全部」 */
body.mobile #alert-list .al-tabs {
  flex-wrap: nowrap;
  gap: 4px;
  padding: 6px 8px;
  overflow-x: auto;
}
body.mobile #alert-list .al-tabs button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 4px 7px;
  font-size: 11.5px;
  border-radius: var(--r-sm);
}
body.mobile #alert-list .al-tabs .al-clear {
  margin-left: auto;
}

/* 3. 桌面收藏栏拖动手柄居中 & 手机画线/收藏栏底部滑动进度条 */
#draw-favs .fav-grip {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0 3px 0 1px;
  background-position: center;
}
body.mobile #mobile-drawbar {
  position: relative;
  padding-bottom: 5px;
}
.h-scroll-rail {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 2px;
  height: 3px;
  border-radius: 999px;
  background: rgba(138, 143, 156, 0.22);
  pointer-events: none;
  overflow: hidden;
}
.h-scroll-rail span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  opacity: 0.78;
}
body.mobile #mobile-drawbar .md-rail {
  left: 48px;
  right: 8px;
  bottom: 2px;
}
body.mobile #draw-favs .fav-rail {
  left: 30px;
  right: 8px;
  bottom: 2px;
}

/* 4. 手机画线工具栏：带子类的分组按钮右下角醒目小三角（照 TradingView） */
body.mobile .md-tool {
  position: relative;
}
body.mobile .md-tool.has-sub::after {
  content: '';
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0 0 5px 5px;
  border-color: transparent transparent currentColor transparent;
  opacity: 0.72;
}
body.mobile #mobile-funcbar button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* 5. 主图图例折叠箭头（清晰 SVG 图标 + 竖屏去重省行 + 横屏指标左右并排） */
.legend-fold {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 24px;
  height: 20px;
  padding: 0;
  margin-left: 4px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--legend-hover);
  color: var(--strong);
  cursor: pointer;
}
.legend-fold:hover,
.legend-fold.is-folded {
  color: #fff;
  border-color: var(--accent);
  background: var(--accent);
}
.legend-inds {
  display: flex;
  flex-direction: column;
}
.legend-inds[hidden] {
  display: none;
}
/* 手机竖屏：顶部标题栏已经显示了品种名和周期，图例区隐藏重复标题直接显示开高低收 + 折叠箭头，且箭头紧跟在开高低收后面不单独换行 */
body.mobile:not(.landscape) .chart-legend-bar .legend-heading {
  display: none;
}
body.mobile .chart-legend-bar .legend-head {
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  height: 18px;
  min-height: 18px;
  max-height: 18px;
  overflow: hidden;
}
body.mobile .chart-legend-bar .legend-head .legend-vals {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
  font-size: 10.5px;
  line-height: 18px;
  gap: 0 4px;
}
body.mobile:not(.landscape) .chart-legend-bar .legend-head .legend-vals {
  font-size: 10px;
  column-gap: 3px;
}
body.mobile:not(.landscape) .chart-legend-bar .legend-pair {
  gap: 1.5px;
}
body.mobile:not(.landscape) .chart-legend-bar .legend-chg-abs {
  display: none;
}
body.mobile .chart-legend-bar .legend-ind:not(.is-open) {
  width: 100%;
  max-width: 100%;
  height: 17px;
  min-height: 17px;
  max-height: 17px;
  line-height: 17px;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
}
body.mobile .chart-legend-bar .legend-ind:not(.is-open) .legend-vals {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
  column-gap: 4px;
  font-size: 10px;
}
body.mobile .chart-legend-bar .legend-fold {
  width: 24px;
  height: 20px;
  margin-left: 2px;
}
/* 手机横屏：主图各指标横向按顺序左右排布（一行放得下绝不占两行），同时右侧给「布局 / 退出」按钮留出安全边距 */
body.mobile.landscape .cell > .chart-legend-bar {
  padding-right: 150px;
}
body.mobile.landscape .chart-legend-bar .legend-inds {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 14px;
}
body.mobile.landscape .chart-legend-bar .legend-inds .legend-ind {
  width: auto;
}

/* 6. 颜色选择器棋盘格透明底纹 & SVG 按钮居中对齐 */
.cp-swatch,
.cp-cell {
  background-image:
    linear-gradient(45deg, rgba(138, 143, 156, 0.28) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(138, 143, 156, 0.28) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(138, 143, 156, 0.28) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(138, 143, 156, 0.28) 75%);
  background-size: 8px 8px;
  background-position: 0 0, 0 4px, 4px -4px, -4px 0;
}
#btn-help,
#mt-more,
#mt-help,
#mf-help,
#rp-back,
#rp-play,
#rp-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
body.mobile #mt-exit-fs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
body.mobile #mt-exit-fs[hidden] {
  display: none;
}
.mr-pop[data-side='center']::before {
  display: none;
}

/* ===== 2026-12-01 0.6.2 / 安卓 0.1.9 真机反馈细节精修 ===== */

/* 1. 周期窗口等所有手机 sheet 底部按钮（添加 / 关闭）文字彻底居中（覆写 .ctx-menu button 的左对齐） */
body.mobile .mobile-sheet-footer button,
body.mobile #tf-menu .mobile-sheet-footer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center !important;
  padding: 6px 14px;
}

/* 2. 桌面与手机收藏栏：3×3 圆点 SVG 拖动手柄大而居中，工具列表与底部进度条独立成列 */
#draw-favs .fav-grip {
  width: 24px;
  height: 32px;
  padding: 0 !important;
  margin: 0 2px 0 0;
  background: none !important;
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
}
#draw-favs .fav-grip::before {
  display: none !important;
  content: none !important;
}
#draw-favs .fav-grip svg {
  display: block;
}
body.mobile #draw-favs {
  padding: 4px 6px;
  align-items: center;
}
body.mobile #draw-favs .fav-grip {
  flex: 0 0 32px;
  width: 32px;
  height: 40px;
  margin: 0 2px 0 0;
}
body.mobile #draw-favs .fav-tools-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}
body.mobile #draw-favs .fav-rail {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  margin-top: 2px;
  width: 100%;
}

/* 3. 回放控制条：左侧常驻 3×3 拖动手柄 + 内部横滑容器与底部进度条；每次打开回到默认布局，按住 3×3 手柄可自由移动 */
#replay-bar .rp-grip {
  width: 24px;
  height: 30px;
  padding: 0 !important;
  margin: 0;
  background: none !important;
  font-size: 0;
  line-height: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 24px;
  cursor: grab;
  touch-action: none;
  color: var(--muted);
}
#replay-bar .rp-grip:active {
  cursor: grabbing;
}
#replay-bar .rp-grip::before {
  display: none !important;
  content: none !important;
}
#replay-bar .rp-grip svg {
  display: block;
}
#replay-bar .rp-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
}
#replay-bar .rp-scroll {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
#replay-bar .rp-scroll > * {
  flex-shrink: 0;
}
body.mobile #replay-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 6px 4px;
  overflow: visible;
  z-index: 600;
}
body.mobile #replay-bar[hidden] {
  display: none;
}
body.mobile #replay-bar .rp-grip {
  flex: 0 0 32px;
  width: 32px;
  height: 36px;
}
body.mobile #replay-bar .rp-scroll {
  overflow-x: auto;
  gap: 6px;
  scrollbar-width: none;
  touch-action: pan-x;
}
body.mobile #replay-bar .rp-scroll::-webkit-scrollbar {
  display: none;
}
body.mobile #replay-bar .rp-rail {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  margin-top: 2px;
  width: 100%;
}
/* 横屏与竖屏回放条都避开底部功能栏和横屏左侧工具栏 */
body.mobile:not(.landscape) #replay-bar {
  bottom: calc(var(--sheet-bottom) + 8px) !important;
}
body.mobile.landscape #replay-bar {
  left: calc(var(--sheet-left) + 8px) !important;
  bottom: calc(var(--sheet-bottom) + 12px) !important;
}
body.mobile #replay-bar.rp-dragged {
  left: var(--rp-x) !important;
  top: var(--rp-y) !important;
  right: auto !important;
  bottom: auto !important;
  width: min(calc(100vw - var(--sheet-left) - 12px), 680px) !important;
  max-width: calc(100vw - var(--sheet-left) - 12px) !important;
}

/* 4. 手机「跳到」小窗与全局自定义 <select> 主题下拉窗：紧凑贴按钮，绝不盖住左侧栏，绝不出现白色系统大窗 */
body.mobile #rp-menu,
body.mobile .mobile-select-menu {
  right: auto !important;
  width: max-content !important;
  min-width: 148px !important;
  max-width: min(260px, calc(100vw - var(--sheet-left) - 16px)) !important;
  max-height: 52dvh;
  overflow-y: auto;
  padding: 4px;
  border-radius: var(--r-md);
  background: var(--panel) !important;
  color: var(--text) !important;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
  z-index: 10020 !important;
}
body.mobile #rp-menu button,
body.mobile .mobile-select-menu .msel-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  color: var(--text);
  background: transparent;
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
}
body.mobile .mobile-select-menu .msel-opt.on {
  background: var(--sel);
  color: var(--strong);
  font-weight: 600;
}
body.mobile .mobile-select-menu .msel-chk {
  color: var(--accent);
  font-weight: 700;
}

/* 5. 横屏「选择回放日期」弹窗紧凑适配：标题与底部「今天 / 取消 / 确定」始终固定可见不被裁出 */
body.mobile dialog#rp-date-dialog {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  overflow: hidden;
  width: min(360px, calc(100vw - var(--sheet-left) - 16px)) !important;
  max-width: calc(100vw - var(--sheet-left) - 16px) !important;
  height: fit-content !important;
  max-height: calc(100dvh - 16px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)) !important;
  top: 50% !important;
  left: calc(var(--sheet-left) + (100vw - var(--sheet-left)) / 2) !important;
  right: auto !important;
  bottom: auto !important;
  transform: translate(-50%, -50%);
  border-radius: var(--r-lg);
}
body.mobile dialog#rp-date-dialog:not([open]) {
  display: none;
}
body.mobile #rp-date-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
}
body.mobile #rp-date-dialog h2 {
  flex: none;
  margin: 0 0 6px;
  font-size: 15px;
}
body.mobile #rp-date-dialog .rp-calendar {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  gap: 2px;
}
body.mobile #rp-date-dialog .rp-calendar button {
  height: 28px;
  padding: 0;
  font-size: 12px;
}
body.mobile #rp-date-dialog .rp-calendar-nav,
body.mobile #rp-date-dialog .rp-calendar-time {
  flex: none;
  margin: 5px 0;
  gap: 6px;
}
body.mobile #rp-date-dialog .buttons {
  flex: none;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
body.mobile #rp-date-dialog .buttons button {
  min-width: 64px;
  height: 32px;
}
body.mobile.landscape dialog#rp-date-dialog {
  padding: 8px 12px;
  width: min(390px, calc(100vw - var(--sheet-left) - 16px)) !important;
}
body.mobile.landscape #rp-date-dialog h2 {
  margin: 0 0 4px;
  font-size: 14px;
}
body.mobile.landscape #rp-date-dialog .rp-calendar button {
  height: 24px;
  font-size: 11.5px;
}
body.mobile.landscape #rp-date-dialog .rp-calendar-nav,
body.mobile.landscape #rp-date-dialog .rp-calendar-time {
  margin: 3px 0;
}

/* 6. 横屏画线子类窗口：参考回放「跳到/下拉」的紧凑伸缩弹出小窗，贴按钮弹出不横跨全屏；手机星标常显、去白闪烁 */
body.mobile #draw-flyout {
  -webkit-tap-highlight-color: transparent;
  background: var(--panel) !important;
  color: var(--text) !important;
}
body.mobile .draw-flyout .fly-row {
  -webkit-tap-highlight-color: transparent;
  background: transparent;
  color: var(--text);
}
body.mobile .draw-flyout .fly-star {
  opacity: 0.72;
}
body.mobile .draw-flyout .fly-star.on {
  opacity: 1;
  color: #f5b400;
}
body.mobile.landscape #draw-flyout {
  right: auto !important;
  bottom: auto !important;
  width: max-content !important;
  min-width: 176px !important;
  max-width: min(244px, calc(100vw - var(--sheet-left) - 16px)) !important;
  max-height: calc(100dvh - 16px) !important;
  overflow-y: auto;
  padding: 4px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-pop);
}
body.mobile.landscape #draw-flyout .menu-title {
  padding: 4px 10px 6px;
  font-size: 11.5px;
}
body.mobile.landscape #draw-flyout .fly-row {
  min-height: 34px;
  padding: 5px 32px 5px 8px;
  font-size: 13px;
  border-radius: var(--r-sm);
}
body.mobile.landscape #draw-flyout .fly-ico {
  width: 22px;
  height: 22px;
}

/* 7. 手机指标图例防误触选中文字，展开操作栏高优先级可点 */
body.mobile .legend-ind {
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
body.mobile .legend-ind.is-open {
  position: relative;
  z-index: 6;
}
body.mobile .legend-ind.is-open .legend-tools {
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
}
body.mobile .legend-ind.is-open .legend-btn {
  width: 26px;
  height: 24px;
  border-radius: 5px;
  background: var(--tab-idle);
  border: 1px solid var(--tab-edge);
  color: var(--strong);
}

/* ============ 网页端（body.web）适配样式 ============ */
body.web #btn-new-window,
body.web #win-span,
body.web #win-quit,
body.web #win-min,
body.web #win-max,
body.web #win-close,
body.web #autostart-head,
body.web #autostart-row,
body.web #autostart-hint,
body.web #upd-head,
body.web #upd-row,
body.web #upd-auto-row,
body.web #upd-hint,
body.web #help-detach,
body.web #help-min {
  display: none !important;
}

.inapp-banner {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(41, 98, 255, 0.18);
  border-bottom: 1px solid rgba(41, 98, 255, 0.45);
  color: var(--strong);
  font-size: 12.5px;
  line-height: 1.45;
  z-index: 9500;
}
.inapp-banner[hidden] {
  display: none !important;
}
.inapp-banner button {
  flex: none;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--strong);
  font-size: 16px;
  line-height: 1;
}

.lock-replace-wrap {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--hover);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lock-replace-wrap[hidden] {
  display: none !important;
}
.lock-replace-wrap .hint {
  margin: 0;
}
.lock-replace-wrap button {
  align-self: flex-start;
}

/* ---------- 桌面端「布局」「品种」标题栏统一按「设置」样式 ---------- */
#layout-menu .layout-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: -8px -12px 10px;
  padding: 11px 14px 11px 18px;
  background: var(--hover);
  border-bottom: 1px solid var(--border);
  border-radius: 8px 8px 0 0;
  cursor: grab;
  user-select: none;
}
#layout-menu .layout-menu-head:active {
  cursor: grabbing;
}
#layout-menu .layout-menu-head::before {
  content: '⋮⋮';
  color: var(--muted);
  font-size: 15px;
  letter-spacing: -3px;
  line-height: 1;
}
#layout-menu .layout-menu-head .dlg-title {
  margin: 0;
  color: var(--strong);
  font-size: 15px;
  font-weight: 600;
}
#layout-menu .layout-menu-head .dlg-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#layout-menu .layout-menu-head .dlg-close:hover {
  background: var(--border);
  color: var(--strong);
}

#watch .watch-titlebar {
  margin: 0;
  padding: 11px 12px 11px 14px;
  background: var(--hover);
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--strong);
  flex: none;
}

/* 手机端各抽屉与弹窗标题栏同样统一（无桌面拖动点，紧贴边缘） */
body.mobile .help-head {
  margin: 0;
  padding: 10px 10px 10px 14px;
  border-radius: 0;
  cursor: default;
}
body.mobile .help-head::before {
  display: none;
}
body.mobile .mobile-sheet-title.dlg-head {
  background: var(--hover);
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--strong);
}

/* 手机端回放条最右侧「×」常驻固定、不被中间横向滚动卷走 */
body.mobile #replay-bar .rp-close {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  font-size: 20px;
  border-left: 1px solid var(--border);
  border-radius: 0 6px 6px 0;
  padding-left: 2px;
}

/* ---------- 手机端撤销 / 恢复按钮（方案 C：智能联动） ---------- */
#mt-history,
#md-history {
  display: none;
}
/* 竖屏默认（画线条显示时）：固定在底部第 1 行画线条最右侧 */
body.mobile #md-history {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
  padding-left: 5px;
  margin-left: 4px;
  border-left: 1px solid var(--border);
}
body.mobile #md-history button {
  width: 32px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--tab-edge);
  border-radius: 7px;
  background: var(--tab-idle);
  color: var(--text);
  display: grid;
  place-items: center;
  flex: none;
  touch-action: manipulation;
}
body.mobile #md-history button:disabled,
body.mobile #mt-history button:disabled {
  opacity: 0.34;
  background: transparent;
  border-color: transparent;
}
body.mobile #md-history button:not(:disabled):active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* 底部画线条滑动进度条避让右侧撤销/恢复区 */
body.mobile #mobile-drawbar .md-rail {
  left: 48px;
  right: 80px;
}
/* 设置里隐藏画线条时：自动切到顶栏右侧，绝不消失 */
body.mobile.hide-drawbar #mt-history {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
}
body.mobile.hide-drawbar #mobile-top {
  gap: 4px;
  padding: 0 6px;
}
body.mobile.hide-drawbar #mobile-top button {
  width: clamp(27px, 7.2vw, 34px);
}
/* 横屏时（画线条显示时）：稳妥放在左侧画线栏最底部，纵向双键好点按、不挤占功能键 */
body.mobile.landscape #md-history {
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 3px;
  padding: 4px 0 0;
  margin: 4px 0 0;
  border-left: 0;
  border-top: 1px solid var(--border);
}
body.mobile.landscape #md-history button {
  width: 100%;
  height: 30px;
}

/* ---------- 中证 1000 期权（MO）文华 T 型报价弹窗与列表入口 ---------- */
.watch-mo-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 16px);
  margin: 4px 8px 6px;
  padding: 6px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: 5px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--strong);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.watch-mo-btn:hover {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
}

#workspace.mo-view-open > #draw-toolbar,
#workspace.mo-view-open > #grid {
  display: none;
}

.mo-back-btn {
  flex: none;
  margin-right: 4px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}
.mo-back-btn:hover {
  filter: brightness(1.1);
}
.mo-back-btn.active {
  background: var(--surface);
  color: var(--strong);
  border-color: var(--accent);
}
.mo-back-btn.mobile {
  padding: 2px 7px;
  font-size: 11px;
  margin-right: 4px;
}
.mo-back-btn[hidden] {
  display: none;
}

.mo-opt-view {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 14px;
  background: var(--bg);
  overflow: hidden;
}
.mo-opt-view[hidden] {
  display: none;
}
.mo-opt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.mo-opt-title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--strong);
  white-space: nowrap;
}
.mo-opt-return {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
.mo-opt-months {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mo-month-btn {
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
}
.mo-month-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
.mo-opt-meta {
  flex: 1;
  font-size: 13.5px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mo-opt-meta b {
  color: var(--strong);
}
.mo-opt-sep {
  margin: 0 4px;
  opacity: 0.6;
}
.mo-opt-tip {
  margin: 0;
  font-size: 12.5px;
}
.mo-opt-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.mo-opt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}
.mo-opt-table th,
.mo-opt-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  white-space: nowrap;
}
.mo-opt-table thead th {
  position: sticky;
  background: var(--panel);
  z-index: 2;
}
.mo-opt-table thead tr.mo-grp th {
  top: 0;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.mo-opt-table thead tr.mo-cols th {
  top: 34px;
  font-size: 12.5px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
}
.mo-call-hdr {
  color: var(--up, #00b87c);
}
.mo-put-hdr {
  color: var(--down, #f23645);
}
.mo-mid-hdr,
.mo-mid-col,
.mo-strike {
  text-align: center !important;
  font-size: 15.5px;
  font-weight: 700;
  background: color-mix(in srgb, var(--panel) 85%, var(--accent) 8%);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  color: var(--strong);
}
.mo-opt-table tbody td.mo-c {
  cursor: pointer;
}
.mo-opt-table tbody tr:hover td.mo-c {
  background: var(--hover);
}
.mo-opt-table tbody tr.selected td {
  background: color-mix(in srgb, var(--accent) 18%, transparent);
}
.mo-opt-table tbody td.itm-call {
  background: color-mix(in srgb, var(--up, #00b87c) 7%, transparent);
}
.mo-opt-table tbody td.itm-put {
  background: color-mix(in srgb, var(--down, #f23645) 7%, transparent);
}
.mo-opt-table tbody tr.atm td {
  border-top: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
}
.mo-opt-table tbody tr.atm td.mo-strike {
  background: var(--accent);
  color: #ffffff;
}
.mo-last {
  font-size: 15px;
  font-weight: 700;
}
.mo-opt-table td.up {
  color: var(--up, #00b87c);
}
.mo-opt-table td.down {
  color: var(--down, #f23645);
}
.mo-opt-empty {
  text-align: center !important;
  padding: 28px 12px !important;
  color: var(--muted);
}
body.mobile .mo-opt-view {
  padding: 8px;
}
body.mobile .mo-opt-meta {
  text-align: left;
  flex-basis: 100%;
}
body.mobile .mo-opt-table {
  font-size: 13px;
}
body.mobile .mo-opt-table th,
body.mobile .mo-opt-table td {
  padding: 6px 6px;
}
body.mobile .mo-strike {
  font-size: 13.5px;
}
body.mobile .mo-last {
  font-size: 13.5px;
}

/* ---------- 金荣中国 MT5 本机桥接设置卡片 ---------- */
.set-nav button[hidden] {
  display: none !important;
}
section[data-cat="broker"] .mt5-card {
  margin-top: 0;
}
.mt5-card {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--hover);
}
.mt5-card[hidden] {
  display: none !important;
}
.mt5-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.mt5-head h3 {
  margin: 0 !important;
}
.mt5-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
}
.mt5-badge-wait {
  color: var(--muted);
  background: transparent;
}
.mt5-badge-demo {
  color: #16c784;
  background: rgba(22, 199, 132, 0.14);
  border-color: rgba(22, 199, 132, 0.45);
}
.mt5-badge-real {
  color: #f23645;
  background: rgba(242, 54, 69, 0.14);
  border-color: rgba(242, 54, 69, 0.45);
}
.mt5-status-box {
  margin: 8px 0 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-line;
}
.mt5-steps {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.6;
}
.mt5-steps li + li {
  margin-top: 4px;
}
#mt5-export-hint {
  white-space: pre-line;
  word-break: break-all;
}

.mt5-risk-box {
  margin: 8px 0;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--bg);
}

#btn-mt5-trade[hidden],
#mt5-trade-panel[hidden] {
  display: none !important;
}

#btn-mt5-trade.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.mt5-trade-panel {
  flex: none;
  position: relative;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 6;
}

.mt5-tp-resizer {
  position: absolute;
  z-index: 12;
  background: transparent;
  transition: background-color 0.15s;
}

.mt5-tp-resizer[hidden] {
  display: none !important;
}

.mt5-trade-panel.mode-bottom {
  height: 326px;
  min-height: 220px;
  max-height: 620px;
  border-top: 1px solid var(--border);
  padding-top: 4px;
}

.mt5-trade-panel.mode-bottom > .mt5-tp-resizer {
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  cursor: ns-resize;
}

.mt5-trade-panel.mode-right {
  width: 376px;
  min-width: 310px;
  max-width: 760px;
  height: auto;
  border-left: 1px solid var(--border);
  padding-left: 4px;
}

.mt5-trade-panel.mode-right > .mt5-tp-resizer {
  top: 0;
  bottom: 0;
  left: 0;
  width: 6px;
  cursor: ew-resize;
}

.mt5-tp-resizer:hover,
body.col-resizing .mt5-trade-panel.mode-right > .mt5-tp-resizer,
body.row-resizing .mt5-trade-panel.mode-bottom > .mt5-tp-resizer {
  background: var(--accent);
}

body.row-resizing {
  cursor: ns-resize;
  user-select: none;
}

.mt5-tp-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--deep);
  flex: none;
}

.mt5-tp-head-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

.mt5-tp-head-left,
.mt5-tp-head-right {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  flex-wrap: wrap;
}

.mt5-tp-modes {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px;
  gap: 1px;
}

.mt5-tp-modes button {
  padding: 1px 6px;
  font-size: 11px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.mt5-tp-modes button.on {
  background: var(--accent);
  color: #ffffff;
}

.mt5-tp-title {
  font-weight: 700;
  color: var(--strong);
  font-size: 12.5px;
  white-space: nowrap;
}

.mt5-tp-acct {
  font-size: 11.5px;
  color: var(--soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mt5-tp-cap {
  font-size: 11px;
  color: var(--muted);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  white-space: nowrap;
}

.mt5-tp-lock-btn {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 183, 77, 0.5);
  color: var(--warn);
  background: rgba(255, 183, 77, 0.1);
  white-space: nowrap;
}

.mt5-tp-lock-btn.unlocked {
  border-color: rgba(242, 54, 69, 0.55);
  color: #ff8a80;
  background: rgba(242, 54, 69, 0.16);
}

.mt5-tp-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 10px;
  padding: 6px 10px;
}

.mt5-trade-panel.mode-right .mt5-tp-body,
.mt5-trade-panel.mode-popup .mt5-tp-body {
  flex-direction: column;
  overflow: hidden;
}

.mt5-trade-panel.mode-right .mt5-tp-ticket,
.mt5-trade-panel.mode-popup .mt5-tp-ticket {
  width: 100%;
  flex: none;
  border-right: none;
  border-bottom: 1px solid var(--border);
  padding-right: 0;
  padding-bottom: 8px;
}

.mt5-trade-panel.mode-right .mt5-tp-tables,
.mt5-trade-panel.mode-popup .mt5-tp-tables {
  flex: 1;
  min-height: 110px;
}

.mt5-trade-panel.mode-right .mt5-tp-tip,
.mt5-trade-panel.mode-popup .mt5-tp-tip {
  display: none;
}

.mt5-tp-ticket {
  width: 332px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-right: 10px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}

.mt5-tp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.mt5-tp-seg {
  display: inline-flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px;
  gap: 2px;
}

.mt5-tp-seg button {
  padding: 2px 8px;
  font-size: 11.5px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
}

.mt5-tp-seg button.on {
  background: var(--accent);
  color: #ffffff;
}

.mt5-tp-quotes {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 6px;
}

.mt5-tp-qbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 8px;
  line-height: 1.25;
  height: auto;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  cursor: pointer;
}

.mt5-tp-qbtn .q-label {
  font-size: 10.5px;
  color: var(--muted);
}

.mt5-tp-qbtn strong {
  font-size: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.mt5-tp-qbtn.sell strong { color: #f23645; }
.mt5-tp-qbtn.buy strong { color: #089981; }
.mt5-tp-qbtn.sell.on {
  border-color: #f23645;
  background: rgba(242, 54, 69, 0.14);
}
.mt5-tp-qbtn.buy.on {
  border-color: #089981;
  background: rgba(8, 153, 129, 0.14);
}

.mt5-tp-spread {
  font-size: 11px;
  color: var(--muted);
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
}

.mt5-tp-fields {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mt5-tp-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 12px;
}

.mt5-tp-field > span {
  flex: none;
  color: var(--soft);
  white-space: nowrap;
}

.mt5-tp-field > span small {
  color: var(--muted);
  font-size: 10.5px;
}

.mt5-tp-input-grp {
  display: flex;
  align-items: center;
  gap: 3px;
}

.mt5-tp-input-grp input {
  width: 84px;
  padding: 3px 6px;
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.mt5-tp-input-grp button {
  padding: 3px 6px;
  font-size: 11px;
}

.mt5-tp-check {
  font-size: 11.5px;
  line-height: 1.4;
  padding: 4px 7px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.mt5-tp-check.ok {
  color: var(--ok);
  border-color: rgba(38, 166, 154, 0.45);
}

.mt5-tp-check.warn {
  color: var(--warn);
  border-color: rgba(255, 183, 77, 0.45);
}

.mt5-tp-check.err {
  color: #ff6b6b;
  border-color: rgba(242, 54, 69, 0.5);
}

.mt5-tp-submit-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.mt5-tp-submit {
  width: 100%;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  color: #ffffff;
  cursor: pointer;
}
.mt5-tp-broker-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
}
.mt5-tp-broker-row select {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  font-size: 11.5px;
}
.mt5-tp-vol-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
}

.mt5-tp-chip {
  width: 100%;
  min-width: 0;
  padding: 4px 2px;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  text-align: center;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--soft);
  cursor: pointer;
}

.mt5-tp-chip.on {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(41, 98, 255, 0.14);
  font-weight: 600;
}

.mt5-tp-vol-custom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px dashed var(--border);
  font-size: 11px;
}
.mt5-tp-vol-custom-head {
  font-size: 10.5px;
  color: var(--muted);
  line-height: 1.35;
}
.mt5-tp-vol-custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.mt5-tp-vol-custom-row {
  display: flex;
}
.mt5-tp-vol-custom label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  color: var(--soft);
  min-width: 0;
}
.mt5-tp-vol-custom label.full {
  width: 100%;
}
.mt5-tp-vol-custom input {
  width: 66px;
  padding: 3px 6px;
  font-size: 11.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.mt5-tp-vol-custom label.full input {
  flex: 1;
  min-width: 0;
  width: auto;
}
.mt5-tp-vol-save-btn {
  width: 100%;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 5px;
}
.mt5-broker-bar {
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}
.mt5-broker-bar .danger {
  border-color: rgba(242, 54, 69, 0.45);
  color: #ff7b7b;
}

/* 图表悬浮快捷交易条（默认顶部居中，支持自由拖动与双击归位） */
.mt5-chart-qtrade {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 14;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 4px;
  border-radius: 6px;
  background: rgba(19, 23, 34, 0.88);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(132, 142, 156, 0.32);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  touch-action: none;
}
.mt5-chart-qtrade.dragging {
  cursor: grabbing;
  user-select: none;
  border-color: rgba(41, 98, 255, 0.72);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.48);
}
.mt5-qt-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 7px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: -1.5px;
  line-height: 1;
  cursor: grab;
  user-select: none;
}
.mt5-qt-grip:hover {
  color: var(--strong);
}
.mt5-chart-qtrade.dragging .mt5-qt-grip {
  cursor: grabbing;
}
.mt5-chart-qtrade[hidden] { display: none !important; }
.mt5-qt-toggle {
  padding: 3px 6px;
  font-size: 11px;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  border: 1px solid transparent;
  cursor: pointer;
}
.mt5-qt-toggle:hover {
  color: var(--strong);
  border-color: var(--border);
}
.mt5-qt-body {
  display: flex;
  align-items: center;
  gap: 4px;
}
.mt5-qt-body[hidden] { display: none !important; }
.mt5-qt-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 72px;
  padding: 3px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  color: #ffffff;
  line-height: 1.15;
  cursor: pointer;
}
.mt5-qt-btn.sell { background: rgba(242, 54, 69, 0.9); }
.mt5-qt-btn.buy { background: rgba(8, 153, 129, 0.9); }
.mt5-qt-btn.sell:hover:not(:disabled) { background: #f23645; }
.mt5-qt-btn.buy:hover:not(:disabled) { background: #089981; }
.mt5-qt-btn:disabled { opacity: 0.42; cursor: not-allowed; }
.mt5-qt-lbl { font-size: 10px; opacity: 0.92; font-weight: 600; }
.mt5-qt-px { font-size: 12px; font-weight: 700; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.mt5-qt-vol {
  width: 56px;
  height: 28px;
  padding: 2px 4px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  border-radius: 4px;
}

/* 图表持仓线右侧 DOM 一键平仓操作条 */
.mt5-chart-posbar-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 12;
  overflow: hidden;
}
.mt5-chart-posbar {
  position: absolute;
  transform: translateY(-50%);
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
  background: rgba(19, 23, 34, 0.9);
  border: 1px solid rgba(132, 142, 156, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
}
.mt5-chart-posbar[hidden] { display: none !important; }
.mt5-chart-posbar.buy { border-color: rgba(0, 184, 124, 0.85); }
.mt5-chart-posbar.sell { border-color: rgba(242, 54, 69, 0.85); }
.mt5-posbar-pnl.up { color: #34d399; }
.mt5-posbar-pnl.down { color: #fb7185; }
.mt5-posbar-close {
  padding: 1px 6px;
  font-size: 11px;
  line-height: 1.3;
  border-radius: 3px;
  border: none;
  background: rgba(242, 54, 69, 0.9);
  color: #ffffff;
  cursor: pointer;
}
.mt5-posbar-close:hover:not(:disabled) { background: #f23645; }
.mt5-posbar-close:disabled { opacity: 0.45; cursor: not-allowed; }

/* 意见反馈与全员公告弹窗 */
.fb-dlg,
.ann-dlg {
  width: min(460px, 92vw);
  padding: 16px 18px;
}
.fb-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0 12px;
}
.fb-body .field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--soft);
}
.fb-body textarea {
  resize: vertical;
  min-height: 92px;
  padding: 7px 9px;
  font-size: 13px;
  line-height: 1.5;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
}
.ann-meta {
  margin-top: 6px;
  font-size: 11.5px;
}
.ann-body {
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  max-height: 46vh;
  overflow: auto;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 13px;
  color: var(--fg);
}

.mt5-tp-submit.buy { background: #089981; }
.mt5-tp-submit.sell { background: #f23645; }
.mt5-tp-submit:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.mt5-tp-tables {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mt5-tp-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.mt5-tp-tabs button {
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 5px;
}

.mt5-tp-tabs button.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.mt5-tp-tip {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
}

.mt5-tp-edit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--accent);
  font-size: 12px;
  flex: none;
  flex-wrap: wrap;
}

.mt5-tp-edit-bar[hidden] { display: none !important; }
.mt5-tp-edit-bar input { width: 88px; padding: 2px 6px; }

.mt5-tp-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
}

.mt5-tp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.mt5-tp-table th,
.mt5-tp-table td {
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.mt5-tp-table th {
  position: sticky;
  top: 0;
  background: var(--deep);
  color: var(--muted);
  font-weight: 600;
}

.mt5-tp-table td.up { color: #089981; font-weight: 600; }
.mt5-tp-table td.down { color: #f23645; font-weight: 600; }
.mt5-tp-empty {
  text-align: center !important;
  color: var(--muted);
  padding: 28px 10px !important;
}

.mt5-tp-actions {
  display: flex;
  gap: 4px;
}

.mt5-tp-actions button {
  padding: 2px 7px;
  font-size: 11px;
}

.mt5-tp-actions button.danger {
  border-color: rgba(242, 54, 69, 0.5);
  color: #ff8a80;
}

/* 独立 MT5 交易弹窗（?mt5trade=1）：跨四块屏幕自由拖动和缩放 */
html.mt5-trade-only body > *:not(#mt5-trade-panel) {
  display: none !important;
}

html.mt5-trade-only #mt5-trade-panel {
  position: fixed;
  inset: 0;
  width: 100vw !important;
  height: 100vh !important;
  max-width: none;
  max-height: none;
  border: none;
  padding: 0;
}

html.mt5-trade-only #mt5-tp-head {
  cursor: move;
}

@media (min-width: 740px) {
  html.mt5-trade-only #mt5-trade-panel.mode-popup .mt5-tp-body {
    flex-direction: row;
  }

  html.mt5-trade-only #mt5-trade-panel.mode-popup .mt5-tp-ticket {
    width: 332px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding-bottom: 0;
    padding-right: 10px;
  }

  html.mt5-trade-only #mt5-trade-panel.mode-popup .mt5-tp-tip {
    display: inline;
  }
}

/* 设置 → 交易商 内嵌图文配对教程 */
.mt5-guide-box {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}
.mt5-guide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.mt5-guide-head strong {
  font-size: 12.5px;
  color: var(--strong);
}
.mt5-guide-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.mt5-guide-tab {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--hover);
  color: var(--text);
  cursor: pointer;
}
.mt5-guide-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
}
.mt5-guide-cap {
  margin: 7px 0 8px !important;
  color: var(--text);
}
.mt5-guide-preview {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #0d111a;
}
.mt5-guide-preview img {
  display: block;
  width: 100%;
  max-height: 290px;
  object-fit: contain;
  cursor: zoom-in;
}
.mt5-guide-zoom-btn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  background: rgba(19, 23, 34, 0.88);
  color: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.45);
  cursor: pointer;
}
.mt5-guide-zoom-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.mt5-guide-lightbox {
  width: min(1160px, 95vw);
  max-height: 92vh;
  padding: 14px 16px;
}
.mt5-lb-wrap {
  max-height: calc(92vh - 115px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0d111a;
}
.mt5-lb-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

/* 币安 / OKX API 交易商设置与交易面板（三端共用） */
.cex-secret-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 6px;
}
.cex-secret-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--soft);
}
.cex-secret-grid label[hidden] {
  display: none !important;
}
.cex-secret-grid input {
  width: 100%;
  box-sizing: border-box;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.cex-ip-bar {
  margin-top: 8px;
  padding: 7px 10px;
  border: 1px solid #1e6b52;
  background: rgba(8, 153, 129, 0.09);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.cex-ip-bar .hint {
  margin: 0;
  flex: 1 1 240px;
}
.cex-ip-bar button {
  padding: 4px 10px;
  font-size: 12px;
  flex-shrink: 0;
}
.cex-tp-bal-top {
  flex: none;
  font-size: 11px;
  color: var(--ok);
  white-space: nowrap;
}
.cex-tp-swap-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 11.5px;
}
.cex-tp-swap-bar[hidden] {
  display: none !important;
}
.cex-tp-swap-bar label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--soft);
}
.cex-tp-swap-bar select,
.cex-tp-swap-bar input {
  padding: 2px 5px;
  font-size: 11.5px;
}
.cex-tp-swap-bar input {
  width: 48px;
}
.cex-tp-swap-bar button {
  margin-left: auto;
  padding: 3px 8px;
  font-size: 11px;
}
.cex-tp-tpsl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.cex-tp-tpsl label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 11px;
  color: var(--muted);
}
.cex-tp-tpsl input {
  width: 100%;
  box-sizing: border-box;
  padding: 3px 6px;
  font-size: 11.5px;
}

body.mobile .cex-secret-grid {
  grid-template-columns: 1fr;
}
body.mobile .cex-trade-panel {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  width: 100% !important;
  max-height: 80vh;
  z-index: 65;
  border-left: none;
  border-top: 1px solid var(--border);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.55);
  padding-bottom: env(safe-area-inset-bottom, 10px);
}

/* 四端按能力显隐规则 */
body.mobile .desktop-only {
  display: none !important;
}
body.web .desktop-app-only,
body.mobile .desktop-app-only {
  display: none !important;
}
body.mobile .mobile-only {
  display: inline-flex;
}
body:not(.mobile) .mobile-only {
  display: none !important;
}
body.web .app-only {
  display: none !important;
}
body:not(.android-app) .android-app-only {
  display: none !important;
}








