* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0b0f14;
  color: #e8edf3;
}

.topbar {
  min-height: 58px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #202832;
  background: #10161d;
}

.topbar strong {
  margin-right: 10px;
}

#statusText {
  font-size: 13px;
  color: #9ba7b4;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #39d98a;
  margin-right: 5px;
}

.status-dot.offline {
  background: #e05a5a;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 18px;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
  padding: 14px;
  background: #10161d;
  border: 1px solid #202832;
  border-radius: 10px;
}

.control {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 190px;
}

label,
.label {
  font-size: 12px;
  color: #8d9aa8;
}

select,
button {
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid #303b47;
  background: #171e27;
  color: #e8edf3;
  padding: 0 12px;
  font-size: 14px;
}

button {
  cursor: pointer;
  background: #1c8f5a;
  border-color: #1c8f5a;
  font-weight: 600;
}

.secondary-button {
  background: #171e27;
  border-color: #303b47;
}

.secondary-button:disabled {
  opacity: .6;
  cursor: wait;
}

button:disabled {
  opacity: .6;
  cursor: wait;
}

.market-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin: 14px 0;
  background: #202832;
  border: 1px solid #202832;
  border-radius: 10px;
  overflow: hidden;
}

.market-info > div {
  background: #10161d;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.backtest-panel {
  margin: 14px 0;
  background: #10161d;
  border: 1px solid #202832;
  border-radius: 10px;
  overflow: hidden;
}

.backtest-controls {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
  padding: 14px;
}

.backtest-controls label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.backtest-controls input {
  width: 100px;
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid #303b47;
  background: #171e27;
  color: #e8edf3;
  padding: 0 10px;
  font-size: 14px;
}

.backtest-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: #202832;
  border-top: 1px solid #202832;
}

.backtest-results > div {
  background: #10161d;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.chart-panel {
  min-height: 520px;
  background: #10161d;
  border: 1px solid #202832;
  border-radius: 10px;
  overflow: hidden;
}

.panel-header {
  height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #202832;
}

.panel-header span {
  font-size: 12px;
  color: #8d9aa8;
}

.chart-area {
  height: 470px;
  min-height: 470px;
  width: 100%;
}

@media (max-width: 700px) {
  .market-info,
  .backtest-results {
    grid-template-columns: 1fr;
  }

  .control {
    width: 100%;
  }

  .toolbar button {
    width: 100%;
  }
}
