* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  display: flex;
  height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background: #0d1117;
  color: #e6edf3;
  overflow: hidden;
}

.sidebar {
  width: 190px;
  flex-shrink: 0;
  background: #161b22;
  border-right: 1px solid #21262d;
  display: flex;
  flex-direction: column;
  padding: 18px 0;
}
.logo {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  padding: 8px 0 20px;
  color: #f0b90b;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a {
  color: #9da7b3;
  text-decoration: none;
  padding: 12px 22px;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: #1c2128; color: #e6edf3; }
.sidebar nav a.active { background: #1c2128; color: #f0b90b; border-left-color: #f0b90b; }
.sidebar-foot { margin-top: auto; padding: 14px 18px; font-size: 12px; color: #6e7681; }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px 20px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 28px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 12px 18px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.stat .label { display: block; font-size: 12px; color: #6e7681; }
.stat .value { font-size: 15px; font-weight: 600; }
.actions { margin-left: auto; display: flex; gap: 10px; }

.btn {
  padding: 9px 26px;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-start { background: #2ea043; }
.btn-start:hover:not(:disabled) { background: #3fb950; }
.btn-stop { background: #da3633; }
.btn-stop:hover:not(:disabled) { background: #f85149; }

.chart-wrap {
  flex: 1.35;
  min-height: 320px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 14px;
}
#chart { width: 100%; height: 100%; }

.trades-wrap {
  flex: 1;
  min-height: 180px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.trades-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid #21262d;
}
.trades-head h2 { font-size: 15px; }
.msg { font-size: 13px; color: #f0b90b; }

.trades {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  overflow-y: auto;
}
.trades thead { position: sticky; top: 0; background: #161b22; }
.trades th, .trades td {
  text-align: right;
  padding: 8px 14px;
  border-bottom: 1px solid #21262d;
  white-space: nowrap;
}
.trades th { color: #6e7681; font-weight: 500; }
.trades th:nth-child(1), .trades td:nth-child(1),
.trades th:nth-child(2), .trades td:nth-child(2),
.trades th:nth-child(3), .trades td:nth-child(3),
.trades th:nth-child(4), .trades td:nth-child(4) { text-align: left; }
.pnl-pos { color: #3fb950; }
.pnl-neg { color: #f85149; }

/* 设置页 */
.page-title { font-size: 20px; margin-bottom: 16px; }
form { overflow-y: auto; padding-bottom: 30px; }
fieldset {
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 16px;
  background: #161b22;
}
legend { font-size: 15px; font-weight: 600; color: #f0b90b; padding: 0 8px; }
.tip { font-size: 12px; color: #9da7b3; margin-bottom: 12px; line-height: 1.6; }
label { display: block; font-size: 13px; color: #9da7b3; margin-bottom: 10px; }
input[type="text"], input[type="password"], input[type="number"], select {
  width: 100%;
  margin-top: 5px;
  padding: 8px 10px;
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  color: #e6edf3;
  font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: #f0b90b; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 24px; }
.api-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 24px; }
.mode-row { display: flex; align-items: center; gap: 22px; margin: 4px 0 12px; }
.radio { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 14px; color: #e6edf3; }
.radio input { width: auto; margin: 0; }
.check { display: flex; align-items: center; gap: 8px; }
.check input { width: auto; margin: 0; }
.masked-row { font-size: 13px; color: #6e7681; margin: 8px 0 12px; }
.warn { color: #f85149; font-size: 13px; }
.hidden { display: none !important; }
.auto-view {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  color: #9da7b3;
  margin: 10px 0 14px;
  line-height: 1.9;
}
.inner-fieldset {
  border: none;
  padding: 0;
  background: transparent;
  margin: 0;
}
fieldset:disabled { opacity: 0.55; }
.form-actions { display: flex; align-items: center; gap: 16px; }

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  width: 360px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 22px;
}
.modal h3 { margin-bottom: 8px; font-size: 16px; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }
.modal-actions .btn { padding: 8px 18px; }

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .api-grid { grid-template-columns: 1fr; }
  .topbar { gap: 16px; }
}
