﻿:root {
      --bg: #000000;
      --panel: #050505;
      --panel-2: #080808;
      --text: #e6e6e6;
      --muted: #a8a8a8;
      --line: #2e2e2e;
      --green: #14c38e;
      --red: #ef5350;
      --yellow: #f5b014;
      --blue: #2f7df6;
    }
    * { box-sizing: border-box; }
    html {
      background: #000;
    }
    html, body {
      width: 100%;
      height: 100%;
      overflow: hidden;
    }
    body {
      margin: 0;
      color: var(--text);
      font-family: "Segoe UI", "Noto Sans TC", sans-serif;
      background: var(--bg);
      min-height: 100vh;
    }
    .wrap {
      width: 100%;
      height: 100vh;
      margin: 0;
      padding: 6px 8px 8px;
      display: grid;
      gap: 8px;
      grid-template-columns: 1fr;
      grid-template-rows: auto auto auto minmax(300px, 1fr) minmax(210px, 28vh) 20px;
      overflow: hidden;
    }
    .bar {
      display: grid;
      grid-template-columns: 280px minmax(0, 1fr);
      gap: 10px;
      align-items: center;
      background: #050505;
      border: 1px solid #222;
      border-radius: 12px;
      padding: 10px 12px;
    }
    .title {
      font-size: 18px;
      font-weight: 700;
      letter-spacing: 0.5px;
    }
    .controls {
      display: flex;
      flex-wrap: nowrap;
      gap: 8px;
      align-items: flex-end;
      justify-content: flex-start;
      overflow-x: auto;
      overflow-y: hidden;
      min-width: 0;
      padding-bottom: 2px;
      scrollbar-width: thin;
      scrollbar-color: #2f4f8f transparent;
    }
    .controls::-webkit-scrollbar {
      height: 6px;
    }
    .controls::-webkit-scrollbar-thumb {
      background: #2f4f8f;
      border-radius: 999px;
    }
    .controls input, .controls button, .controls select {
      height: 34px;
      border-radius: 8px;
      border: 1px solid #345192;
      background: #0d1730;
      color: var(--text);
      padding: 0 10px;
      font-size: 13px;
    }
    .controls > label {
      display: inline-flex;
      flex-direction: column;
      gap: 4px;
      color: var(--muted);
      font-size: 12px;
      line-height: 1.1;
    }
    .controls .ctl-kline button { width: 120px; }
    .controls .ctl-kline {
      position: relative;
    }
    .controls .ctl-signal button { width: 120px; }
    .controls .source-row {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .controls .source-clear-btn {
      width: 52px !important;
      min-width: 52px;
      padding: 0 8px;
      background: linear-gradient(180deg, #2a3450, #1d2841);
      border-color: #4e648f;
      color: #dbe5ff;
      font-size: 12px;
      font-weight: 700;
    }
    .controls .ctl-product select { width: 72px; }
    .controls .ctl-tf select { width: 72px; }
    .controls .ctl-pane select { width: 62px; }
    .controls .ctl-tz select { width: 124px; }
    .controls .ctl-tz { display: none !important; }
    .controls .ctl-date select { width: 110px; }
    .controls .ctl-ind select { width: 120px; }
    .controls .ctl-qty input { width: 72px !important; }
    .controls .ctl-num input { width: 78px !important; }
    .controls .chk {
      display: inline-flex;
      flex-direction: row;
      align-items: center;
      gap: 6px;
      border: 1px solid #345192;
      border-radius: 8px;
      padding: 0 8px;
      height: 34px;
      background: #0d1730;
      font-size: 13px;
    }
    .controls .chk input[type="checkbox"] {
      width: 14px;
      height: 14px;
      accent-color: #2f7df6;
    }
    .controls input[type="number"] { width: 90px; }
    .controls button {
      cursor: pointer;
      background: linear-gradient(180deg, #1a3a86, #15306d);
      border-color: #4062ab;
      font-weight: 600;
    }
    .controls button:hover { filter: brightness(1.08); }
    .tf-tabs {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      height: 34px;
      padding: 0 4px;
      border: 1px solid #345192;
      border-radius: 10px;
      background: #081329;
    }
    .tf-tabs button {
      height: 26px;
      min-width: 42px;
      padding: 0 10px;
      border-radius: 7px;
      border: 1px solid transparent;
      background: transparent;
      color: #c8d7f7;
      font-size: 13px;
      font-weight: 600;
      line-height: 1;
      cursor: pointer;
      box-shadow: none;
    }
    .tf-tabs button:hover {
      filter: none;
      background: rgba(255,255,255,0.06);
    }
    .tf-tabs button.active {
      background: linear-gradient(180deg, #3d4f6f, #2c3953);
      border-color: #7f95be;
      color: #ffffff;
    }
    .tf-native-select {
      display: none;
    }
    .pane-tabs {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      height: 34px;
      padding: 0 4px;
      border: 1px solid #345192;
      border-radius: 10px;
      background: #081329;
    }
    .pane-tabs button[data-pane] {
      height: 26px;
      width: 36px;
      border-radius: 7px;
      border: 1px solid transparent;
      background: transparent;
      color: #c8d7f7;
      font-size: 13px;
      font-weight: 700;
      line-height: 1;
      cursor: pointer;
      box-shadow: none;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
    .pane-tabs button[data-pane].active {
      background: linear-gradient(180deg, #3d4f6f, #2c3953);
      border-color: #7f95be;
      color: #ffffff;
    }
    .pane-icon-one,
    .pane-icon-two,
    .pane-icon-three {
      position: relative;
      width: 22px;
      height: 14px;
      border: 1px solid #9fb4dc;
      border-radius: 3px;
      opacity: 0.9;
    }
    .pane-icon-two::after {
      content: "";
      position: absolute;
      left: 0;
      top: 50%;
      width: 100%;
      height: 1px;
      background: #9fb4dc;
      transform: translateY(-50%);
    }
    .pane-icon-three::after {
      content: "";
      position: absolute;
      left: 50%;
      top: 0;
      width: 1px;
      height: 100%;
      background: #9fb4dc;
      transform: translateX(-50%);
    }
    .tool-optional { display: none; }
    .toolbar-spacer {
      flex: 1 1 auto;
      min-width: 12px;
    }
    .btn-buy {
      background: linear-gradient(180deg, #1ca86a, #137d4f) !important;
      border-color: #3ecb8a !important;
    }
    .btn-sell {
      background: linear-gradient(180deg, #d9535a, #a93a40) !important;
      border-color: #f07d82 !important;
    }
    .sim-switch {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      border: 1px solid #345192;
      border-radius: 8px;
      background: #0d1730;
      height: 34px;
      padding: 0 8px;
      font-size: 13px;
      color: #dbe5ff;
    }
    .controls > .sim-switch {
      flex-direction: row;
      align-items: center;
      align-self: flex-end;
      height: 34px;
      gap: 8px;
      color: #dbe5ff;
      font-size: 13px;
      line-height: 1;
      padding: 0 8px;
    }
    .controls > .sim-switch > span {
      color: #dbe5ff;
      font-size: 13px;
      line-height: 1;
      margin: 0;
    }
    .sim-switch input {
      appearance: none;
      width: 34px;
      height: 18px;
      border-radius: 999px;
      background: #31486f;
      position: relative;
      outline: none;
      cursor: pointer;
      border: 1px solid #4b6598;
    }
    .sim-switch input::after {
      content: "";
      position: absolute;
      left: 1px;
      top: 1px;
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: #d8e6ff;
      transition: transform 120ms ease;
    }
    .sim-switch input:checked {
      background: #1c7c4f;
      border-color: #2fb574;
    }
    .sim-switch input:checked::after {
      transform: translateX(16px);
    }
    .icon-btn {
      width: 34px;
      min-width: 34px;
      padding: 0 !important;
      font-size: 16px !important;
    }

    .cards {
      display: flex;
      gap: 10px;
      flex-wrap: nowrap;
      overflow-x: auto;
      overflow-y: hidden;
      min-width: 0;
      padding-bottom: 2px;
      scrollbar-width: thin;
      scrollbar-color: #2f4f8f transparent;
    }
    .cards::-webkit-scrollbar {
      height: 6px;
    }
    .cards::-webkit-scrollbar-thumb {
      background: #2f4f8f;
      border-radius: 999px;
    }
    .cards .card {
      flex: 1 1 0;
      min-width: 150px;
    }
    .replay-bar {
      display: flex;
      align-items: center;
      gap: 8px;
      background: #070707;
      border: 1px solid #222;
      border-radius: 10px;
      padding: 8px 10px;
      overflow-x: auto;
      overflow-y: hidden;
      white-space: nowrap;
    }
    .replay-bar.hidden {
      display: none;
    }
    .replay-bar input, .replay-bar button, .replay-bar select {
      height: 32px;
      border-radius: 8px;
      border: 1px solid #345192;
      background: #0d1730;
      color: var(--text);
      padding: 0 10px;
      font-size: 13px;
    }
    .history-strip {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 0;
      border: none;
      background: transparent;
      overflow-x: auto;
      overflow-y: hidden;
      width: 100%;
      max-width: 260px;
      white-space: nowrap;
    }
    .controls .ctl-kline .history-strip {
      position: absolute;
      left: 0;
      top: calc(100% + 2px);
      z-index: 2;
    }
    .history-title {
      color: #8da0c8;
      font-size: 10px;
      font-weight: 600;
      flex: 0 0 auto;
      line-height: 1;
    }
    .history-list {
      display: inline-flex;
      gap: 4px;
      align-items: center;
      min-width: 0;
      flex: 1 1 auto;
    }
    .history-item {
      height: 22px;
      border-radius: 999px;
      border: 1px solid #345192;
      background: #0d1730;
      color: #dbe5ff;
      padding: 0 8px;
      font-size: 11px;
      cursor: pointer;
      max-width: 220px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      line-height: 20px;
    }
    .history-item:hover {
      filter: brightness(1.08);
    }
    .history-empty {
      color: #6f86b8;
      font-size: 10px;
    }
    .card {
      background: #080808;
      border: 1px solid #222;
      border-radius: 10px;
      padding: 10px;
    }
    .settings-panel {
      position: absolute;
      right: 12px;
      top: 12px;
      z-index: 30;
      width: 360px;
      background: #0a0a0a;
      border: 1px solid #2a2a2a;
      border-radius: 12px;
      box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
      padding: 10px;
      display: none;
    }
    .settings-panel.show { display: block; }
    .chart-wrap .settings-panel {
      z-index: 45;
    }
    .settings-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 8px;
      font-weight: 700;
    }
    .settings-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 8px;
    }
    .settings-grid label {
      display: flex;
      flex-direction: column;
      gap: 4px;
      font-size: 12px;
      color: var(--muted);
      min-width: 0;
    }
    .settings-grid input,
    .settings-grid select {
      height: 32px;
      border-radius: 8px;
      border: 1px solid #345192;
      background: #0d1730;
      color: var(--text);
      padding: 0 8px;
      font-size: 13px;
      width: 100%;
      min-width: 0;
    }
    .settings-grid .span-2 {
      grid-column: 1 / span 2;
    }
    .settings-subtitle {
      grid-column: 1 / span 2;
      margin-top: 6px;
      font-size: 11px;
      font-weight: 700;
      color: #8da0c8;
      letter-spacing: 0.3px;
    }
    .settings-check-row {
      grid-column: 1 / span 2;
      display: flex;
      align-items: center;
      gap: 10px;
      color: #dbe5ff;
      font-size: 12px;
    }
    .settings-check-row label {
      display: inline-flex;
      flex-direction: row;
      align-items: center;
      gap: 6px;
      margin: 0;
    }
    .candle-style-row {
      grid-column: 1 / span 2;
      display: grid;
      grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1fr);
      align-items: center;
      gap: 8px;
      color: var(--muted);
      font-size: 12px;
    }
    .candle-style-row .label {
      display: inline-flex;
      align-items: center;
      gap: 6px;
    }
    .candle-style-row input[type="color"] {
      width: 100%;
      height: 32px;
      min-width: 0;
      padding: 2px;
      border-radius: 8px;
      border: 1px solid #345192;
      background: #0d1730;
    }
    .card .k { color: var(--muted); font-size: 12px; }
    .card .v { margin-top: 6px; font-size: 18px; font-weight: 700; }

    .panel {
      background: #060606;
      border: 1px solid #1f1f1f;
      border-radius: 12px;
      overflow: hidden;
      min-height: 0;
      min-width: 0;
    }
    .chart-layout {
      width: 100%;
      height: 100%;
      display: grid;
      grid-template-columns: minmax(0, 1fr) 6px var(--bo-panel-w, 380px);
      grid-template-rows: minmax(0, 1fr);
      align-items: stretch;
      gap: 0;
      padding: 8px;
      min-height: 0;
      min-width: 0;
    }
    .chart-layout.bo-collapsed {
      grid-template-columns: minmax(0, 1fr) 0 0;
    }
    .bo-expand-fab {
      position: absolute;
      right: 12px;
      top: 12px;
      z-index: 11;
      display: none;
      align-items: center;
      justify-content: center;
      height: 28px;
      min-width: 36px;
      border-radius: 8px;
      border: 1px solid #3b5f9d;
      background: #0e1f3f;
      color: #dbe7ff;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      padding: 0 10px;
    }
    .chart-layout.bo-collapsed .bo-expand-fab {
      display: inline-flex;
    }
    .chart-wrap {
      position: relative;
      display: grid;
      grid-template-rows: minmax(0, 1fr);
      gap: 8px;
      height: 100%;
      min-height: 420px;
      min-width: 0;
      max-height: none;
      align-self: stretch;
      overflow: hidden;
    }
    .chart-wrap.panes-2 {
      grid-template-rows: minmax(0, 1fr) minmax(0, 1fr);
    }
    .chart-wrap.panes-3 {
      grid-template-columns: minmax(0, 1fr) 8px minmax(0, 1fr);
      grid-template-rows: minmax(0, 1fr);
      column-gap: 0;
    }
    .chart-wrap.panes-3 .chart-main-pane { grid-column: 1; }
    .chart-wrap.panes-3 .pane-split-handle { grid-column: 2; }
    .chart-wrap.panes-3 .chart-secondary-pane { grid-column: 3; }
    .chart-main-pane {
      position: relative;
      height: 100%;
      min-height: 420px;
      min-width: 0;
      overflow: hidden;
    }
    .chart-secondary-pane {
      position: relative;
      height: 100%;
      min-height: 220px;
      min-width: 0;
      overflow: hidden;
      border: none;
      border-radius: 0;
      background: transparent;
      display: none;
    }
    .chart-wrap.panes-2 .chart-secondary-pane,
    .chart-wrap.panes-3 .chart-secondary-pane {
      display: block;
    }
    .pane-split-handle {
      display: none;
      height: 100%;
      min-height: 0;
      width: 8px;
      cursor: col-resize;
      border-radius: 4px;
      border: 1px solid rgba(64, 118, 214, 0.28);
      background: linear-gradient(180deg, rgba(64, 118, 214, 0.28), rgba(64, 118, 214, 0.08));
      user-select: none;
      align-self: stretch;
      z-index: 4;
    }
    .pane-split-handle:hover {
      background: linear-gradient(180deg, rgba(64, 118, 214, 0.42), rgba(64, 118, 214, 0.16));
    }
    .chart-wrap.panes-3 .pane-split-handle {
      display: block;
    }
    .bo-stats-panel {
      height: 100%;
      min-height: 0;
      min-width: 0;
      border: 1px solid #222;
      border-radius: 10px;
      background: #060606;
      overflow: hidden;
      padding: 10px;
      margin-left: 8px;
      display: flex;
      flex-direction: column;
      align-self: stretch;
    }
    .bo-resizer {
      width: 6px;
      height: 100%;
      min-height: 0;
      cursor: col-resize;
      border-radius: 4px;
      background: linear-gradient(180deg, rgba(64, 118, 214, 0.22), rgba(64, 118, 214, 0.06));
      border: 1px solid rgba(64, 118, 214, 0.25);
      user-select: none;
      align-self: stretch;
    }
    .bo-resizer:hover {
      background: linear-gradient(180deg, rgba(64, 118, 214, 0.35), rgba(64, 118, 214, 0.12));
    }
    .bo-stats-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 8px;
    }
    .bo-stats-title {
      font-size: 18px;
      font-weight: 700;
      color: #e6e6e6;
    }
    .bo-head-right {
      display: inline-flex;
      align-items: center;
      gap: 8px;
    }
    .bo-collapse-btn {
      height: 26px;
      min-width: 30px;
      border-radius: 6px;
      border: 1px solid #3b5f9d;
      background: #0e1f3f;
      color: #dbe7ff;
      font-size: 14px;
      font-weight: 700;
      cursor: pointer;
      padding: 0 8px;
    }
    .bo-stats-updated {
      font-size: 12px;
      color: #a8a8a8;
      white-space: nowrap;
    }
    .bo-stats-summary {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
      margin-bottom: 10px;
    }
    .bo-stat-mini {
      border: 1px solid #222;
      border-radius: 8px;
      background: #080808;
      padding: 6px 8px;
    }
    .bo-stat-mini .k {
      color: #a8a8a8;
      font-size: 11px;
      margin-bottom: 2px;
    }
    .bo-stat-mini .v {
      color: #e6e6e6;
      font-size: 15px;
      font-weight: 700;
    }
    .bo-stats-list {
      display: flex;
      flex-direction: column;
      gap: 10px;
      flex: 1 1 auto;
      min-height: 0;
      overflow: auto;
      padding-right: 2px;
    }
    .bo-stat-item {
      border: 1px solid #222;
      border-radius: 10px;
      background: #080808;
      padding: 10px;
    }
    .bo-item-top {
      display: grid;
      grid-template-columns: 1fr auto;
      gap: 8px;
      align-items: center;
      margin-bottom: 8px;
    }
    .bo-item-symbol {
      font-size: 30px;
      font-weight: 800;
      letter-spacing: 0.2px;
      color: #f0f0f0;
      line-height: 1;
    }
    .bo-item-tag {
      margin-top: 4px;
      display: inline-flex;
      align-items: center;
      padding: 2px 8px;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 600;
      color: #9fd0ff;
      border: 1px solid #3a5ca3;
      background: rgba(12, 24, 48, 0.75);
    }
    .bo-item-signed {
      font-size: 40px;
      font-weight: 800;
      line-height: 1;
      text-align: right;
    }
    .bo-item-signed.buy { color: #21c770; }
    .bo-item-signed.sell { color: #ef5350; }
    .bo-item-contracts {
      margin-top: 2px;
      text-align: right;
      color: #a8a8a8;
      font-size: 12px;
    }
    .bo-item-grid {
      display: grid;
      grid-template-columns: repeat(2, minmax(0, 1fr));
      gap: 6px;
    }
    .bo-item-cell {
      border: 1px solid #1f315a;
      border-radius: 8px;
      background: #0a1226;
      padding: 6px 8px;
    }
    .bo-item-cell .k {
      font-size: 11px;
      color: #a8a8a8;
      margin-bottom: 2px;
    }
    .bo-item-cell .v {
      font-size: 18px;
      font-weight: 700;
      color: #e6e6e6;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .bo-stats-empty {
      border: 1px dashed #2e3f62;
      border-radius: 8px;
      color: #a8a8a8;
      padding: 14px;
      text-align: center;
      font-size: 12px;
    }
    .chart-main-pane.empty-grid::before {
      content: "";
      position: absolute;
      inset: 0;
      pointer-events: none;
      z-index: 0;
      background-color: #000;
      background-image:
        repeating-linear-gradient(
          to right,
          rgba(255, 255, 255, 0.08) 0px,
          rgba(255, 255, 255, 0.08) 1px,
          transparent 1px,
          transparent 60px
        ),
        repeating-linear-gradient(
          to bottom,
          rgba(255, 255, 255, 0.08) 0px,
          rgba(255, 255, 255, 0.08) 1px,
          transparent 1px,
          transparent 48px
        );
    }
    #chart {
      position: absolute;
      inset: 0;
      z-index: 1;
    }
    #chartSecondary {
      position: absolute;
      inset: 0;
      z-index: 1;
    }
    #bubbleLayer {
      position: absolute;
      inset: 0;
      pointer-events: none;
      overflow: hidden;
      z-index: 4;
      width: 100%;
      height: 100%;
    }
    #drawLayer {
      position: absolute;
      inset: 0;
      z-index: 5;
      pointer-events: none;
      width: 100%;
      height: 100%;
    }
    #drawLayer.active {
      pointer-events: auto;
      cursor: crosshair;
    }
    .replay-mini {
      position: absolute;
      left: 14px;
      bottom: 38px;
      z-index: 7;
      display: flex;
      gap: 6px;
      background: rgba(17, 26, 46, 0.92);
      border: 1px solid #2a3b66;
      border-radius: 8px;
      padding: 4px;
      backdrop-filter: blur(2px);
    }
    .replay-mini.hidden {
      display: none;
    }
    .replay-mini button {
      width: 28px;
      height: 28px;
      border: 1px solid #345192;
      border-radius: 6px;
      background: #0d1730;
      color: #dbe5ff;
      font-size: 14px;
      cursor: pointer;
      line-height: 1;
      padding: 0;
    }
    .order-ticket {
      position: absolute;
      z-index: 9;
      min-width: 390px;
      display: none;
      gap: 6px;
      align-items: center;
      flex-wrap: nowrap;
      padding: 6px 8px;
      border: 1px solid #3d66bd;
      border-radius: 8px;
      background: rgba(7, 15, 31, 0.97);
      box-shadow: 0 12px 30px rgba(0,0,0,0.35);
      right: 12px;
      top: 12px;
      left: auto !important;
    }
    .order-ticket.show {
      display: flex;
    }
    .order-ticket input, .order-ticket button {
      height: 28px;
      border-radius: 6px;
      border: 1px solid #345192;
      background: #0d1730;
      color: var(--text);
      padding: 0 7px;
      font-size: 12px;
    }
    .order-ticket label {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      font-size: 12px;
      color: #a9c0f7;
    }
    .order-ticket .buy-btn {
      background: linear-gradient(180deg, #1759d2, #0f438f);
      border-color: #4d7ce8;
    }
    .order-ticket .sell-btn {
      background: linear-gradient(180deg, #e05055, #b4363c);
      border-color: #ef7378;
    }
    .order-chip {
      font-size: 12px;
      padding: 0 8px;
      height: 22px;
      display: inline-flex;
      align-items: center;
      border-radius: 4px;
      border: 1px dashed #3a5ca3;
      color: #9fd0ff;
      background: rgba(12, 24, 48, 0.85);
    }
    .order-chip.tp {
      color: #21d39d;
      border-color: rgba(33, 211, 157, 0.45);
    }
    .order-chip.sl {
      color: #ffcc4d;
      border-color: rgba(255, 204, 77, 0.45);
    }
    .order-ticket .qty-box {
      width: 42px;
      text-align: center;
      padding: 0;
    }
    .order-ticket .small-box {
      width: 48px;
      text-align: center;
      padding: 0;
    }
    .order-close {
      width: 24px;
      min-width: 24px;
      padding: 0;
      font-weight: 700;
    }
    .order-ticket .mode-label {
      color: #d5e3ff;
      font-weight: 600;
    }
    .trade-handle-layer {
      position: absolute;
      inset: 0;
      z-index: 10;
      pointer-events: none;
    }
    .trade-handle {
      position: absolute;
      right: 12px;
      transform: translateY(-50%);
      min-width: 148px;
      padding: 4px 10px;
      border-radius: 10px;
      border: 1px dashed #3f577f;
      background: rgba(8, 14, 24, 0.92);
      color: #dbe5ff;
      display: flex;
      align-items: center;
      gap: 8px;
      pointer-events: auto;
      cursor: ns-resize;
      user-select: none;
      box-shadow: 0 4px 18px rgba(0,0,0,0.28);
      backdrop-filter: blur(2px);
    }
    .trade-handle.hidden {
      display: none;
    }
    .trade-handle.dragging {
      box-shadow: 0 0 0 2px rgba(255,255,255,0.10), 0 8px 24px rgba(0,0,0,0.34);
    }
    .trade-handle .tag {
      font-size: 11px;
      font-weight: 700;
      border-radius: 6px;
      padding: 3px 6px;
      min-width: 28px;
      text-align: center;
    }
    .trade-handle .meta {
      display: flex;
      flex-direction: column;
      gap: 2px;
      flex: 1 1 auto;
      min-width: 0;
    }
    .trade-handle .money {
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
    }
    .trade-handle .ticks {
      font-size: 11px;
      color: #8da0c8;
      white-space: nowrap;
    }
    .trade-handle.tp {
      border-color: rgba(33, 211, 157, 0.45);
    }
    .trade-handle.tp .tag {
      color: #0a2319;
      background: #1de0a0;
    }
    .trade-handle.sl {
      border-color: rgba(255, 204, 77, 0.45);
    }
    .trade-handle.sl .tag {
      color: #2a1800;
      background: #ffb43b;
    }
    .resize-handle {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 18px;
      height: 8px;
      cursor: ns-resize;
      z-index: 8;
      background: linear-gradient(
        to bottom,
        rgba(80, 120, 210, 0),
        rgba(80, 120, 210, 0.25)
      );
    }
    .bubble {
      position: absolute;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 999px;
      color: #f7fbff;
      font-weight: 700;
      letter-spacing: 0.2px;
      box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 8px 24px rgba(0,0,0,0.28);
      transform: translate(-50%, -50%);
      white-space: nowrap;
      text-shadow: 0 1px 1px rgba(0,0,0,0.3);
    }
    .bubble.buy {
      background: radial-gradient(circle at 35% 30%, rgba(72,233,187,0.95), rgba(20,153,118,0.92));
    }
    .bubble.sell {
      background: radial-gradient(circle at 35% 30%, rgba(255,108,132,0.96), rgba(167,27,80,0.92));
    }
    .bubble-sub {
      position: absolute;
      left: 50%;
      transform: translateX(-50%);
      font-size: 11px;
      font-weight: 600;
      white-space: nowrap;
      text-shadow: 0 1px 1px rgba(0,0,0,0.35);
    }
    .bubble-sub.buy { color: #4ce2b2; }
    .bubble-sub.sell { color: #ff6f86; }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
    }
    thead { background: #0b0b0b; }
    th, td {
      padding: 8px 10px;
      border-bottom: 1px solid #1f315a;
      text-align: right;
      white-space: nowrap;
    }
    th:first-child, td:first-child,
    th:nth-child(2), td:nth-child(2),
    th:nth-child(3), td:nth-child(3) { text-align: left; }

    .foot {
      color: var(--muted);
      font-size: 12px;
      padding: 6px 2px 0;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .pos { color: var(--green); }
    .neg { color: var(--red); }

    /* ── Timezone Selector ──────────────────────────────────────────────── */
    .ctl-tz select {
      background: #0d1730;
      border: 1px solid #1e4080;
      color: #7eb3ff;
      font-weight: 600;
      min-width: 86px;
    }

    /* ── Strategy Tester Panel ─────────────────────────────────────────── */
    .strategy-tester {
      display: flex;
      flex-direction: column;
      overflow: hidden;
      background: #050505;
      border: 1px solid #1a1a1a;
      border-radius: 10px;
    }

    /* Tab Bar */
    .pt-tabs {
      display: flex;
      gap: 0;
      border-bottom: 1px solid #1e1e1e;
      flex-shrink: 0;
      background: #070707;
    }
    .pt-tab {
      padding: 6px 16px;
      font-size: 12px;
      font-weight: 600;
      color: #666;
      background: transparent;
      border: none;
      border-bottom: 2px solid transparent;
      cursor: pointer;
      letter-spacing: 0.3px;
      transition: color 0.15s, border-color 0.15s;
    }
    .pt-tab:hover { color: #aaa; }
    .pt-tab.active { color: #e6e6e6; border-bottom-color: #2f7df6; }

    /* Panel Content */
    .pt-panel {
      display: none;
      flex: 1;
      overflow: hidden;
      min-height: 0;
    }
    .pt-panel.active { display: flex; flex-direction: column; }

    /* Overview: mini stats + equity chart */
    .pt-mini-stats {
      display: flex;
      gap: 6px;
      padding: 6px 10px 4px;
      flex-shrink: 0;
      flex-wrap: wrap;
      border-bottom: 1px solid #111;
    }
    .pt-stat {
      display: flex;
      flex-direction: column;
      min-width: 80px;
      background: #090909;
      border: 1px solid #1a1a1a;
      border-radius: 6px;
      padding: 4px 8px;
    }
    .pt-k { font-size: 10px; color: #555; margin-bottom: 1px; white-space: nowrap; }
    .pt-v { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

    #pt-overview { flex-direction: column; }
    .pt-equity-chart {
      flex: 1;
      min-height: 0;
      background: #050505;
    }

    /* Performance Table */
    .pt-perf-wrap {
      overflow-y: auto;
      padding: 8px;
      flex: 1;
    }
    .perf-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 12px;
    }
    .perf-table thead th {
      text-align: left;
      color: #666;
      font-size: 11px;
      font-weight: 600;
      letter-spacing: 0.5px;
      padding: 4px 8px;
      border-bottom: 1px solid #1e1e1e;
    }
    .perf-table tbody tr { border-bottom: 1px solid #0f0f0f; }
    .perf-table tbody tr:hover { background: #0c0c0c; }
    .pm-label { padding: 4px 8px; color: #777; white-space: nowrap; }
    .pm-val {
      padding: 4px 8px;
      font-weight: 600;
      font-variant-numeric: tabular-nums;
      text-align: right;
    }

    /* Trades List */
    .pt-trades-wrap {
      overflow-y: auto;
      overflow-x: auto;
      flex: 1;
      min-height: 0;
    }
    .trades-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 11px;
      white-space: nowrap;
    }
    .trades-table thead th {
      position: sticky;
      top: 0;
      background: #070707;
      color: #666;
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.4px;
      padding: 5px 8px;
      border-bottom: 1px solid #1e1e1e;
      z-index: 2;
    }
    .trades-table tbody tr { border-bottom: 1px solid #0d0d0d; }
    .trades-table tbody tr:hover { background: #0c0c0c; }
    .trades-table td { padding: 4px 8px; }
    .win-row  td:first-child { border-left: 2px solid #14c38e; }
    .loss-row td:first-child { border-left: 2px solid #ef5350; }
    .tc { text-align: center; color: #555; }
    .tr { text-align: right; font-variant-numeric: tabular-nums; }
    .cumulative { font-size: 10px; color: #555; margin-left: 4px; }

    .pt-empty {
      padding: 20px;
      color: #444;
      font-size: 12px;
      text-align: center;
    }

    /* Grid row update for Strategy Tester */
    .wrap { grid-template-rows: auto auto auto minmax(300px, 1fr) minmax(210px, 28vh) 20px; }

    @media (max-width: 1600px) {
      .wrap { grid-template-rows: auto auto auto minmax(280px, 1fr) minmax(190px, 26vh) 20px; }
      .chart-layout { grid-template-columns: 1fr; }
      .bo-resizer { display: none; }
      .bo-stats-panel {
        min-height: 220px;
        max-height: 300px;
        margin-left: 0;
        margin-top: 8px;
      }
    }
    @media (max-width: 640px) {
      .bar { grid-template-columns: 1fr; }
      .wrap { grid-template-rows: auto auto auto minmax(240px, 1fr) minmax(160px, 24vh) 20px; }
    }

    /* Hard-lock dark theme (avoid any runtime/style override drifting back) */
    html, body, .wrap, .bar, .panel, .card, .settings-panel, .replay-bar, .strategy-tester {
      background: #000 !important;
    }
