:root {
  --bg-0: #0b1118;
  --bg-1: #0f1823;
  --panel: rgba(14, 24, 36, 0.82);
  --border: rgba(138, 154, 178, 0.22);
  --text-main: #e6edf5;
  --text-muted: #90a0b8;
  --bull: #1dbf73;
  --bear: #e25555;
  --bull-hover: #18aa65;
  --bear-hover: #cf4a4a;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "IBM Plex Sans", "Segoe UI", Tahoma, sans-serif;
  color: var(--text-main);
  background: linear-gradient(145deg, #05070a, #0a0d12);
}

.screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0;
}

.login-panel {
  width: calc(100vw - 20px);
  height: calc(100vh - 20px);
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--panel);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(8px);
  display: grid;
  align-content: center;
  justify-items: center;
  position: relative;
}

.panel-kicker {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: #cdd7e5;
  font-size: 12px;
}

h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
}

.panel-subtitle {
  margin: 8px 0 24px;
  color: var(--text-muted);
}

.login-form {
  width: 100%;
  display: grid;
  justify-items: center;
  gap: 16px;
}

.code-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  width: min(100%, 420px);
}

.code-input {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  border: 1px solid rgba(153, 169, 191, 0.3);
  background: rgba(12, 20, 30, 0.96);
  color: var(--text-main);
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.code-input:focus {
  border-color: var(--bull);
  box-shadow: 0 0 0 3px rgba(29, 191, 115, 0.18);
}

.login-button {
  width: min(100%, 420px);
  height: 48px;
  border: 0;
  border-radius: 4px;
  background: var(--bull);
  color: #f7fbff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, background 120ms ease;
}

.login-button:hover {
  background: var(--bull-hover);
  filter: brightness(1.03);
}

.login-button.error {
  background: var(--bear);
}

.login-button.error:hover {
  background: var(--bear-hover);
}

.login-button:disabled {
  cursor: not-allowed;
  background: #5b6677;
  color: #dbe4f0;
  filter: none;
}

.login-button:active {
  transform: translateY(1px);
}

.login-message {
  margin: 0;
  min-height: 20px;
  width: min(100%, 420px);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}

.login-message.error {
  color: #ff8f8f;
}

.logout-button {
  width: auto;
  min-width: 92px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(145, 160, 184, 0.28);
  border-radius: 4px;
  background: rgba(9, 14, 22, 0.86);
  color: #dbe5f2;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.settings-button {
  min-width: 34px;
  width: 34px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

#bc-button {
  min-width: 31px;
  width: 31px;
  padding: 0;
}

.panel-shell {
  align-content: start;
  justify-items: stretch;
  padding: 20px 20px 18px;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.01), rgba(255, 255, 255, 0)),
    var(--panel);
  animation: panel-enter 300ms ease-out;
}

.panel-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(124, 144, 176, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 144, 176, 0.06) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  opacity: 0.22;
}

.panel-shell > * {
  position: relative;
  z-index: 1;
}

.top-actions {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
}

.top-actions [hidden] {
  display: none !important;
}

.panel-top {
  margin-top: 16px;
}

.panel-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: start;
  column-gap: 12px;
}

.panel-left-info {
  justify-self: start;
  border: 1px solid rgba(136, 154, 179, 0.2);
  border-radius: 4px;
  background: rgba(9, 15, 23, 0.76);
  padding: 8px 10px;
  display: grid;
  gap: 8px;
  min-width: 0;
}

.panel-center-info {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 0;
}

.panel-right-spacer {
  min-width: 0;
}

.panel-price {
  margin: 0;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1;
}

.panel-price[data-pnl="profit"] {
  color: var(--bull);
}

.panel-price[data-pnl="loss"] {
  color: var(--bear);
}

.world-clocks {
  display: grid;
  grid-template-columns: 1fr;
  justify-content: start;
  gap: 4px;
  width: 100%;
}

.clock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #98a8bf;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: clamp(10px, 1.35vw, 12px);
  letter-spacing: 0.04em;
  white-space: nowrap;
  text-align: left;
  min-width: 180px;
}

.clock-item span {
  color: #e6edf5;
  margin-left: 4px;
}

.clock-item.open,
.clock-item.open span {
  color: var(--bull);
}

.panel-pair {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: clamp(11px, 1.8vw, 16px);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  text-align: center;
}

.day-range {
  margin: 6px 0 0;
  color: #a6b4c8;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: clamp(10px, 1.35vw, 12px);
  letter-spacing: 0.06em;
  text-align: center;
  white-space: nowrap;
}

.panel-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.panel-card {
  border: 1px solid rgba(148, 164, 188, 0.22);
  border-radius: 4px;
  background: rgba(8, 14, 22, 0.74);
  padding: 10px;
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 6px;
}

.panel-label {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-muted);
  white-space: nowrap;
}

.panel-value {
  margin: 0;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 650;
  white-space: nowrap;
}

.inline-edit-input {
  width: 100%;
  height: 30px;
  border: 1px solid rgba(145, 160, 184, 0.3);
  border-radius: 4px;
  background: rgba(12, 20, 30, 0.96);
  color: #dbe5f2;
  padding: 0 8px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 14px;
}

.active-level-input {
  width: 100%;
  height: 28px;
  border: 0;
  background: rgba(12, 20, 30, 0.96);
  color: #dbe5f2;
  padding: 0 6px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 14px;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

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

.active-level-input:focus {
  outline: none;
}

.active-level-editor {
  display: grid;
  grid-template-columns: 22px 1fr 22px;
  align-items: center;
  gap: 4px;
  width: 100%;
  border: 0;
  border-radius: 4px;
  background: transparent;
  padding: 0 2px;
}

.active-level-step {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 3px;
  background: rgba(18, 29, 44, 0.9);
  color: #dbe5f2;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.active-level-step:active {
  transform: translateY(1px);
}

.inline-edit-select {
  width: 100%;
  height: 30px;
  border: 1px solid rgba(145, 160, 184, 0.3);
  border-radius: 4px;
  background: rgba(12, 20, 30, 0.96);
  color: #dbe5f2;
  padding: 0 26px 0 8px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 14px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #dbe5f2 50%),
    linear-gradient(135deg, #dbe5f2 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 1px),
    calc(100% - 11px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.inline-edit-action {
  min-width: 72px;
}

.panel-card-capital {
  min-width: 0;
}

.panel-value-capital {
  font-size: clamp(15px, 1.75vw, 23px);
}

.active-trade-wrap {
  margin-top: 16px;
  width: 100%;
  border: 1px solid rgba(148, 164, 188, 0.22);
  border-radius: 4px;
  background: rgba(8, 14, 22, 0.74);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.active-trade-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.active-trade-head-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.active-trade-title {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-muted);
}

.active-trade-gear {
  margin: 0;
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  color: #dbe5f2;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.active-trade-live {
  display: flex;
  align-items: center;
  gap: 8px;
}

.active-trade-live-label {
  color: #dbe5f2;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.live-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 20px;
}

.live-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.live-switch-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(226, 85, 85, 0.45);
  border: 1px solid rgba(226, 85, 85, 0.55);
  border-radius: 999px;
  transition: 140ms ease;
}

.live-switch-slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: #fff4f4;
  border-radius: 50%;
  transition: 140ms ease;
}

.live-switch input:checked + .live-switch-slider {
  background: rgba(29, 191, 115, 0.45);
  border-color: rgba(29, 191, 115, 0.6);
}

.live-switch input:checked + .live-switch-slider::before {
  transform: translateX(20px);
  background: #eafff3;
}

.live-switch-sm {
  width: 32px;
  height: 16px;
}

.live-switch-sm .live-switch-slider::before {
  width: 10px;
  height: 10px;
  left: 2px;
  top: 2px;
}

.live-switch-sm input:checked + .live-switch-slider::before {
  transform: translateX(16px);
}

.active-trade-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.active-trade-item {
  border: 1px solid rgba(136, 154, 179, 0.2);
  border-radius: 4px;
  padding: 8px;
  background: rgba(9, 15, 23, 0.8);
}

.active-trade-item-split {
  padding: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  align-content: stretch;
}

.split-mini {
  border: 1px solid rgba(136, 154, 179, 0.2);
  border-radius: 4px;
  padding: 8px;
  background: rgba(11, 18, 28, 0.82);
  display: grid;
  gap: 6px;
}

.active-trade-label {
  margin: 0 0 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  white-space: nowrap;
}

.open-time-counter {
  color: #dbe5f2;
}

.active-trade-value {
  margin: 0;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: clamp(14px, 1.75vw, 20px);
  font-weight: 650;
  white-space: nowrap;
}

.profit-value {
  color: var(--bull);
}

.loss-value {
  color: var(--bear);
}

#active-max-move {
  color: var(--bull);
}

#active-min-move {
  color: var(--bear);
}

#active-direction[data-direction="LONG"] {
  color: var(--bull);
}

#active-direction[data-direction="SHORT"] {
  color: var(--bear);
}

#active-tp-price {
  color: var(--bull);
}

#active-sl-price {
  color: var(--bear);
}

#active-tp-level {
  color: var(--bull);
}

#active-sl-level {
  color: var(--bear);
}

.active-trade-close {
  display: grid;
  align-items: stretch;
}

.trade-close-button {
  width: 100%;
  height: 100%;
  min-height: 68px;
  border: 1px solid rgba(145, 160, 184, 0.35);
  border-radius: 4px;
  background: rgba(18, 26, 38, 0.9);
  color: #dbe5f2;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 3px;
  cursor: pointer;
}

.trade-close-button[data-pnl="profit"] {
  border-color: rgba(29, 191, 115, 0.5);
  background: rgba(17, 68, 46, 0.9);
  color: #d9ffec;
}

.trade-close-button[data-pnl="loss"] {
  border-color: rgba(226, 85, 85, 0.5);
  background: rgba(78, 24, 24, 0.9);
  color: #ffd7d7;
}

.trade-close-button[data-pnl="flat"] {
  border-color: rgba(145, 160, 184, 0.35);
  background: rgba(18, 26, 38, 0.9);
  color: #dbe5f2;
}

.trade-close-value {
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: clamp(14px, 1.75vw, 20px);
  font-weight: 700;
  line-height: 1;
}

.trade-close-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1;
}

.trade-open-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  height: 100%;
}

.trade-open-button {
  width: 100%;
  min-height: 68px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.trade-open-button-long {
  border: 1px solid rgba(29, 191, 115, 0.45);
  background: rgba(17, 68, 46, 0.88);
  color: #d9ffec;
}

.trade-open-button-short {
  border: 1px solid rgba(226, 85, 85, 0.45);
  background: rgba(78, 24, 24, 0.85);
  color: #ffd7d7;
}

.chart-wrap {
  margin-top: 16px;
  width: 100%;
  border: 1px solid rgba(148, 164, 188, 0.22);
  border-radius: 4px;
  background: rgba(8, 14, 22, 0.74);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-title {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-muted);
}

.chart-meta {
  margin: 0;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #cfd9e8;
}

.chart-indicator-toggle {
  width: 18px;
  height: 18px;
  border: 1px solid rgba(145, 160, 184, 0.38);
  border-radius: 50%;
  background: rgba(9, 14, 22, 0.9);
  color: #dbe5f2;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 11px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.chart-indicator-toggle.is-active {
  border-color: rgba(29, 191, 115, 0.7);
  color: #24d184;
}

.chart-canvas {
  width: 100%;
  height: clamp(200px, 32vh, 360px);
  border: 1px solid rgba(136, 154, 179, 0.2);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(24, 38, 57, 0.65), rgba(8, 13, 20, 0.9)),
    repeating-linear-gradient(
      90deg,
      rgba(145, 165, 192, 0.08) 0,
      rgba(145, 165, 192, 0.08) 1px,
      transparent 1px,
      transparent 44px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(145, 165, 192, 0.08) 0,
      rgba(145, 165, 192, 0.08) 1px,
      transparent 1px,
      transparent 38px
    );
}

.indicator-canvas {
  width: 100%;
  height: clamp(170px, 24vh, 260px);
  border: 1px solid rgba(136, 154, 179, 0.3);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(15, 28, 44, 0.8), rgba(7, 12, 20, 0.95));
}

.signals-config-wrap {
  display: grid;
  gap: 8px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.signals-config-wrap[hidden],
.signals-fast-mode-wrap[hidden] {
  display: none;
}

.signals-config-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.signals-config-title {
  margin: 0;
  color: #d7e2f0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.signals-fast-mode-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.signals-fast-mode-label {
  color: #b6c4d8;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.chart-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.chart-line {
  stroke: #35d39c;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-grid-line {
  stroke: rgba(155, 174, 200, 0.2);
  stroke-width: 0.8;
}

.chart-grid-line-v {
  stroke: rgba(155, 174, 200, 0.14);
}

.chart-axis-label {
  fill: #eaf2ff;
  font-size: 11px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(7, 12, 20, 0.95);
  stroke-width: 2.2px;
}

.chart-time-label {
  fill: #9fb0c8;
  font-size: 10px;
  font-family: "JetBrains Mono", "Consolas", monospace;
}

.indicator-grid-line {
  stroke: rgba(127, 143, 168, 0.28);
  stroke-width: 1;
}

.indicator-price-line {
  stroke: rgba(121, 187, 255, 0.62);
  stroke-width: 1.6;
  fill: none;
}

.indicator-ts-line {
  stroke-width: 2.3;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.indicator-ts-line.up {
  stroke: rgba(36, 209, 132, 0.96);
}

.indicator-ts-line.down {
  stroke: rgba(241, 107, 107, 0.96);
}

.indicator-ama-line {
  stroke: rgba(255, 206, 92, 0.98);
  stroke-width: 1.9;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.indicator-signal.buy {
  fill: rgba(36, 209, 132, 0.92);
}

.indicator-signal.sell {
  fill: rgba(241, 107, 107, 0.92);
}

.indicator-signal-hit {
  cursor: pointer;
}

.indicator-signal-hover-info {
  opacity: 0;
  pointer-events: none;
}

.indicator-signal-hit:hover .indicator-signal-hover-info {
  opacity: 1;
}

.indicator-signal-stem {
  stroke: rgba(173, 188, 210, 0.32);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.indicator-signal-time {
  fill: #9fb0c8;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 9px;
  text-anchor: middle;
}

.indicator-signal-label {
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 9.5px;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(8, 13, 20, 0.96);
  stroke-width: 2.2px;
}

.indicator-signal-label.buy {
  fill: #24d184;
}

.indicator-signal-label.sell {
  fill: #f16b6b;
}

.indicator-legend {
  fill: #dfe8f6;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.indicator-y-label {
  fill: #aebfd6;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 10px;
  paint-order: stroke;
  stroke: rgba(8, 13, 20, 0.95);
  stroke-width: 2px;
}

.chart-current-line {
  stroke-width: 1;
  stroke-dasharray: 4 3;
}

.chart-current-label {
  font-size: 11px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(7, 12, 20, 0.95);
  stroke-width: 2px;
  dominant-baseline: middle;
}

.chart-current-label-bg {
  stroke-width: 1;
}

.chart-current-line.up {
  stroke: #1dbf73;
}

.chart-current-line.down {
  stroke: #e25555;
}

.chart-current-label.up {
  fill: #1dbf73;
}

.chart-hover-line {
  stroke: rgba(220, 232, 248, 0.85);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.chart-hover-line-h {
  stroke: rgba(220, 232, 248, 0.78);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.chart-hover-time-bg {
  fill: rgba(10, 16, 25, 0.92);
  stroke: rgba(145, 160, 184, 0.35);
  stroke-width: 1;
}

.chart-hover-time-label {
  fill: #dbe5f2;
  font-size: 10px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-weight: 700;
  dominant-baseline: middle;
}

.chart-hover-price-bg {
  fill: rgba(10, 16, 25, 0.95);
  stroke: rgba(145, 160, 184, 0.4);
  stroke-width: 1;
}

.chart-hover-price-label {
  fill: #dbe5f2;
  font-size: 10px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-weight: 700;
  dominant-baseline: middle;
}

.chart-trade-line {
  stroke-width: 1.2;
  stroke-dasharray: 6 4;
}

.chart-trade-line.tp {
  stroke: rgba(29, 191, 115, 0.95);
}

.chart-trade-line.sl {
  stroke: rgba(226, 85, 85, 0.95);
}

.chart-trade-line.open {
  stroke: rgba(110, 180, 255, 0.95);
}

.chart-pnl-zone {
  pointer-events: none;
}

.chart-pnl-zone.profit {
  fill: rgba(29, 191, 115, 0.1);
}

.chart-pnl-zone.loss {
  fill: rgba(226, 85, 85, 0.1);
}

.chart-trade-label {
  font-size: 10px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-weight: 700;
  paint-order: stroke;
  stroke: rgba(7, 12, 20, 0.95);
  stroke-width: 2px;
}

.chart-trade-label.tp {
  fill: #24d184;
}

.chart-trade-label.sl {
  fill: #f16b6b;
}

.chart-trade-label.open {
  fill: #79bbff;
}

.chart-signal-marker {
  stroke-width: 0.9;
}

.chart-signal-marker.buy {
  fill: rgba(36, 209, 132, 0.96);
  stroke: rgba(24, 132, 85, 0.95);
}

.chart-signal-marker.sell {
  fill: rgba(241, 107, 107, 0.96);
  stroke: rgba(163, 61, 61, 0.95);
}

.chart-current-label.down {
  fill: #e25555;
}

.chart-current-label-bg.up {
  fill: rgba(10, 28, 22, 0.9);
  stroke: rgba(29, 191, 115, 0.55);
}

.chart-current-label-bg.down {
  fill: rgba(35, 14, 14, 0.9);
  stroke: rgba(226, 85, 85, 0.55);
}

.candle-wick {
  stroke-width: 1.2;
}

.candle-body {
  stroke-width: 0.8;
}

.candle-up {
  stroke: #1dbf73;
  fill: rgba(29, 191, 115, 0.62);
}

.candle-down {
  stroke: #e25555;
  fill: rgba(226, 85, 85, 0.62);
}

.stats-wrap {
  margin-top: 14px;
  width: 100%;
  border: 1px solid rgba(148, 164, 188, 0.22);
  border-radius: 4px;
  background: rgba(8, 14, 22, 0.74);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.stats-title {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-muted);
}

.stats-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.stats-item {
  border: 1px solid rgba(136, 154, 179, 0.2);
  border-radius: 4px;
  padding: 6px;
  background: rgba(9, 15, 23, 0.8);
}

.stats-label {
  margin: 0 0 4px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.stats-value {
  margin: 0;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: clamp(13px, 1.4vw, 18px);
  font-weight: 650;
}

.stats-value.pnl-win {
  color: var(--bull);
}

.stats-value.pnl-loss {
  color: var(--bear);
}

.post-stats-gear {
  margin: 0;
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  color: #dbe5f2;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.post-stats-gear.is-save {
  font-size: 16px;
  font-family: "Segoe UI Symbol", "JetBrains Mono", "Consolas", monospace;
}

.stats-filter-wrap {
  display: none;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
}

.stats-filter-wrap.is-open {
  display: inline-flex;
}

.stats-filter-label {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.stats-filter-input {
  height: 26px;
  border: 1px solid rgba(136, 154, 179, 0.28);
  border-radius: 4px;
  background: rgba(8, 14, 22, 0.92);
  color: #dbe5f2;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 11px;
  padding: 0 6px;
}

.history-wrap {
  margin-top: 14px;
  width: 100%;
  border: 1px solid rgba(148, 164, 188, 0.22);
  border-radius: 4px;
  background: rgba(8, 14, 22, 0.74);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.history-title {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-muted);
}

.history-title-toggle {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(145, 160, 184, 0.28);
  border-radius: 4px;
  background: rgba(9, 14, 22, 0.86);
  color: #dbe5f2;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}

.history-title-toggle:active {
  transform: translateY(1px);
}

.history-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.history-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 12px;
}

.history-table th,
.history-table td {
  border: 1px solid rgba(136, 154, 179, 0.18);
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}

.history-table th {
  color: #aebcd2;
  background: rgba(11, 18, 28, 0.85);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 10px;
}

.history-table .history-signal-summary-row th {
  background: rgba(14, 23, 35, 0.92);
  font-size: 11px;
  letter-spacing: 0.05em;
}

.history-table .history-signal-summary-label {
  text-transform: none;
  color: #c8d5e8;
}

.history-table .history-signal-summary-value {
  text-transform: none;
}

.history-table td {
  color: #dbe5f2;
  background: rgba(9, 15, 23, 0.8);
}

/* Close Time column: keep it noticeably narrower (~40%). */
.history-table th:nth-child(7),
.history-table td:nth-child(7) {
  width: 120px;
  max-width: 120px;
}

.history-table th:nth-child(1),
.history-table td:nth-child(1) {
  width: 170px;
  max-width: 170px;
}

.history-table th:nth-child(8),
.history-table td:nth-child(8) {
  width: 100px;
  max-width: 100px;
}

.history-table th:nth-child(2),
.history-table td:nth-child(2) {
  width: 90px;
  max-width: 90px;
}

.history-table th:nth-child(3),
.history-table td:nth-child(3) {
  width: 110px;
  max-width: 110px;
}

.history-table th:nth-child(4),
.history-table td:nth-child(4) {
  width: 110px;
  max-width: 110px;
}

.history-table th:nth-child(5),
.history-table td:nth-child(5) {
  width: 110px;
  max-width: 110px;
}

.history-table th:nth-child(6),
.history-table td:nth-child(6) {
  width: 100px;
  max-width: 100px;
}

.history-table .pnl-win {
  color: var(--bull);
  font-weight: 700;
}

.history-table .pnl-loss {
  color: var(--bear);
  font-weight: 700;
}

.history-table .direction-long {
  color: var(--bull);
  font-weight: 700;
}

.history-table .direction-short {
  color: var(--bear);
  font-weight: 700;
}

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.history-page-btn {
  min-width: 72px;
  height: 30px;
  border: 1px solid rgba(145, 160, 184, 0.28);
  border-radius: 4px;
  background: rgba(9, 14, 22, 0.86);
  color: #dbe5f2;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.history-page-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.history-page-info {
  margin: 0;
  min-width: 120px;
  text-align: center;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.future-wrap {
  margin-top: 14px;
  width: 100%;
  border: 1px solid rgba(148, 164, 188, 0.22);
  border-radius: 4px;
  background: rgba(8, 14, 22, 0.74);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.future-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}

.future-title {
  margin: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.11em;
  color: var(--text-muted);
}

.platform-config-gear {
  margin: 0;
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  color: #dbe5f2;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.future-text {
  margin: 0;
  color: #dbe5f2;
  font-size: 13px;
}

.platform-config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.platform-config-item {
  border: 1px solid rgba(136, 154, 179, 0.2);
  border-radius: 4px;
  padding: 8px;
  background: rgba(9, 15, 23, 0.8);
  display: grid;
  gap: 6px;
}

.platform-config-label {
  margin: 0;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.platform-config-value {
  margin: 0;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 14px;
  font-weight: 650;
  color: #dbe5f2;
}

.platform-config-input,
.platform-config-select {
  width: 100%;
  height: 28px;
  border: 1px solid rgba(145, 160, 184, 0.3);
  border-radius: 4px;
  background: rgba(12, 20, 30, 0.96);
  color: #dbe5f2;
  padding: 0 8px;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 13px;
}

.platform-fee-editor {
  display: grid;
  grid-template-columns: 22px 1fr 22px;
  align-items: center;
  gap: 4px;
  width: 100%;
  border: 0;
  border-radius: 4px;
  background: transparent;
}

.platform-fee-step {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 3px;
  background: rgba(18, 29, 44, 0.9);
  color: #dbe5f2;
  font-family: "JetBrains Mono", "Consolas", monospace;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

.platform-fee-step:active {
  transform: translateY(1px);
}

.platform-fee-editor .platform-config-input {
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}

.platform-fee-editor .platform-config-input::-webkit-outer-spin-button,
.platform-fee-editor .platform-config-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.platform-config-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #dbe5f2 50%),
    linear-gradient(135deg, #dbe5f2 50%, transparent 50%);
  background-position:
    calc(100% - 14px) calc(50% - 1px),
    calc(100% - 9px) calc(50% - 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 22px;
}

.panel-footer {
  margin-top: auto;
  padding-top: 16px;
}

.panel-footnote {
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: rgba(159, 176, 202, 0.82);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 600px) {
  .login-panel {
    padding: 20px;
  }

  h1 {
    font-size: 24px;
  }

  .code-grid {
    gap: 8px;
  }

  .panel-shell {
    padding: 16px 16px 14px;
  }

  .top-actions {
    top: 16px;
    right: 16px;
  }

  .panel-grid {
    grid-template-columns: 1fr;
  }

  .panel-label {
    font-size: 10px;
    letter-spacing: 0.07em;
  }

  .panel-value {
    font-size: 20px;
  }

  .panel-value-capital {
    font-size: 18px;
  }

  .chart-canvas {
    height: 220px;
  }

  .indicator-canvas {
    height: 180px;
  }

  .active-trade-grid {
    grid-template-columns: 1fr;
  }

  .active-trade-item-split {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .history-pagination {
    justify-content: space-between;
  }

  .history-page-info {
    min-width: 92px;
    font-size: 10px;
  }

  .platform-config-grid {
    grid-template-columns: 1fr 1fr;
  }
}
