* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #0d1117; color: #c9d1d9; font-size: 13px;
}

.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: radial-gradient(circle at 50% 30%, #161b22, #0d1117);
}
.login-box {
  background: #161b22; border: 1px solid #30363d; border-radius: 12px;
  padding: 40px 36px; width: 360px; box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.login-box h1 { color: #58a6ff; font-size: 22px; margin-bottom: 6px; }
.login-sub { color: #8b949e; font-size: 12px; margin-bottom: 24px; }
.login-box input {
  width: 100%; padding: 10px 12px; background: #0d1117; color: #c9d1d9;
  border: 1px solid #30363d; border-radius: 6px; font-size: 14px;
  outline: none; margin-bottom: 16px;
}
.login-box input:focus { border-color: #58a6ff; }
.login-box button { width: 100%; padding: 10px; font-size: 14px; }
.login-msg { margin-top: 12px; font-size: 12px; text-align: center; height: 16px; }

header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: #161b22; border-bottom: 1px solid #30363d;
  position: sticky; top: 0; z-index: 100;
  flex-wrap: wrap; gap: 8px;
}
.logo { font-size: 16px; font-weight: 600; color: #58a6ff; }
.logo span { color: #8b949e; font-weight: 400; margin-left: 8px; }
.status-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.on { background: #3fb950; box-shadow: 0 0 8px #3fb950; }
.dot.off { background: #8b949e; }
.balance { color: #8b949e; }
.balance b { color: #d29922; }

.summary-box {
  display: flex; gap: 14px; padding: 0 12px;
  border-left: 1px solid #30363d; border-right: 1px solid #30363d;
}
.summary-item { font-size: 12px; color: #8b949e; }
.summary-item b { font-weight: 600; }

.btn {
  padding: 6px 16px; border-radius: 6px; border: none; cursor: pointer;
  font-size: 13px; font-weight: 500; transition: all .2s;
}
.btn-start { background: #238636; color: white; }
.btn-start:hover { background: #2ea043; }
.btn-stop { background: #da3633; color: white; }
.btn-stop:hover { background: #f85149; }
.btn-logout { background: #484f58; color: white; }
.btn-logout:hover { background: #6e7681; }
.btn-danger { background: #da3633; color: white; padding: 10px 24px; font-size: 14px; }
.btn-danger:hover { background: #f85149; }
.btn-warn { background: #d29922; color: #000; padding: 10px 24px; font-size: 14px; }
.btn-warn:hover { background: #e3b341; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-update { background: #1f6feb; color: white; width: 100%; margin-top: 12px; padding: 10px; }
.btn-mini {
  padding: 2px 8px; font-size: 11px; background: #21262d; color: #8b949e;
  border: 1px solid #30363d; border-radius: 4px; cursor: pointer; margin-left: 4px;
}
.btn-mini:hover { background: #30363d; color: #c9d1d9; }

.container { display: flex; gap: 16px; padding: 16px; }
.sidebar {
  width: 320px; flex-shrink: 0; display: flex; flex-direction: column;
  gap: 12px; max-height: calc(100vh - 100px);
  overflow-y: auto; padding-right: 4px;
}
.main { flex: 1; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.panel {
  background: #161b22; border: 1px solid #30363d; border-radius: 8px;
  padding: 14px;
}
.panel h3 {
  font-size: 13px; color: #58a6ff; margin-bottom: 10px;
  padding-bottom: 8px; border-bottom: 1px solid #21262d;
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 6px;
}
.badge {
  background: #21262d; color: #8b949e; font-size: 11px;
  padding: 2px 8px; border-radius: 10px; font-weight: 400;
}
.kline-actions { display: flex; gap: 2px; }

.action-bar {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  flex-wrap: wrap;
}
.action-hint { color: #f85149; font-size: 12px; margin-left: auto; }

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.sum-card {
  background: #0d1117; border: 1px solid #30363d; border-radius: 8px;
  padding: 12px 14px;
}
.sum-card.highlight {
  border-color: #d29922;
  background: linear-gradient(135deg, rgba(210,153,34,.08), rgba(210,153,34,.02));
}
.sum-label { font-size: 11px; color: #8b949e; margin-bottom: 4px; }
.sum-value { font-size: 20px; font-weight: 600; margin-bottom: 4px; }
.sum-value.up { color: #3fb950; }
.sum-value.down { color: #f85149; }
.sum-sub { font-size: 11px; color: #8b949e; }
.sum-sub .up { color: #3fb950; }
.sum-sub .down { color: #f85149; }

.kline-container {
  width: 100%; height: 400px; background: #0d1117;
  border-radius: 6px; overflow: hidden; position: relative;
}
.kline-placeholder {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: #6e7681; font-size: 14px;
}

label { display: block; margin-bottom: 8px; color: #8b949e; font-size: 12px; }
input, select, textarea {
  width: 100%; margin-top: 4px; padding: 6px 8px;
  background: #0d1117; color: #c9d1d9; border: 1px solid #30363d;
  border-radius: 6px; font-size: 12px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #58a6ff; }
.switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { width: auto; margin: 0; }

.table-wrap { overflow-x: auto; max-height: 320px; overflow-y: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid #21262d; }
th {
  color: #8b949e; font-weight: 500; position: sticky; top: 0;
  background: #161b22; z-index: 2;
}
tr:hover { background: #1c2128; }
tr.row-active { background: rgba(88, 166, 255, .12); }

td.up, td.down { transition: color 0.2s ease; }

.tag { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
.tag-bull { background: rgba(0, 255, 0, .15); color: #3fb950; }
.tag-bear { background: rgba(255, 0, 85, .15); color: #f85149; }
.tag-long { background: rgba(0, 229, 255, .15); color: #00e5ff; }
.tag-short { background: rgba(224, 64, 251, .15); color: #e040fb; }
.tag-none { color: #6e7681; }
.up { color: #3fb950; }
.down { color: #f85149; }

.log-box {
  background: #010409; border-radius: 6px; padding: 10px;
  font-family: "SF Mono", Monaco, monospace; font-size: 11px;
  line-height: 1.7; height: 240px; overflow-y: auto;
}
.log-line { display: flex; gap: 8px; }
.log-ts { color: #6e7681; }
.log-info .log-msg { color: #8b949e; }
.log-success .log-msg { color: #3fb950; }
.log-warn .log-msg { color: #d29922; }
.log-error .log-msg { color: #f85149; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0d1117; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

@media (max-width: 900px) {
  .container { flex-direction: column; }
  .sidebar { width: 100%; max-height: none; }
  .kline-container { height: 300px; }
  .summary-box { border: none; padding: 0; }
}