:root {
  --bg: #0b0e11;
  --panel: #181a20;
  --panel-2: #1e2329;
  --panel-3: #2b3139;
  --border: #2b3139;
  --border-strong: #474d57;
  --text: #eaecef;
  --muted: #848e9c;
  --muted-2: #5e6673;
  --yellow: #fcd535;
  --yellow-deep: #f0b90b;
  --green: #0ecb81;
  --red: #f6465d;
  --blue: #1e90ff;
  --radius: 12px;
  --mono: "SF Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--yellow);
  color: var(--panel);
  font-size: 16px;
}
.brand-name { letter-spacing: .02em; }

.nav { display: flex; gap: 4px; height: 100%; }
.nav a {
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--text); border-bottom-color: var(--yellow); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.clock { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.conn { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.conn.ok i { background: var(--green); box-shadow: 0 0 8px rgba(14, 203, 129, .6); }
.conn.err i { background: var(--red); }

.app { max-width: 1280px; margin: 0 auto; padding: 28px 24px 64px; }

.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}
.hero h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.hero p { margin: 0; color: var(--muted); }
.hero-tools { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.stat-value { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.btn:hover { border-color: var(--yellow); color: var(--yellow); }
.btn.primary { background: var(--yellow); border-color: var(--yellow); color: #181a20; font-weight: 600; }
.btn.primary:hover { background: var(--yellow-deep); color: #181a20; }
.btn:disabled { opacity: .5; cursor: wait; }

.trader-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 14px;
}

.trader-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
  cursor: pointer;
}
.trader-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.trader-head { display: flex; align-items: flex-start; gap: 12px; }
.avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2b3139, #474d57);
  color: var(--yellow);
  font-weight: 700;
  font-size: 16px;
}
.trader-id { min-width: 0; }
.trader-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trader-meta { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; }

.tag {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}
.tag.live { border-color: rgba(14, 203, 129, .45); color: var(--green); }
.tag.stale { border-color: rgba(252, 213, 53, .45); color: var(--yellow); }
.tag.err { border-color: rgba(246, 70, 93, .45); color: var(--red); }

.trader-numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.kv-label { color: var(--muted); font-size: 11px; margin-bottom: 4px; }
.kv-value { font-family: var(--mono); font-size: 14px; font-variant-numeric: tabular-nums; }

.pos-list { display: flex; flex-direction: column; gap: 8px; }
.pos-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.pos-symbol { display: flex; align-items: center; gap: 8px; min-width: 0; }
.pos-symbol b { font-weight: 600; }
.pos-qty { color: var(--muted); font-family: var(--mono); }
.pos-pnl { font-family: var(--mono); text-align: right; }

.pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.pill.long { background: rgba(14, 203, 129, .12); color: var(--green); }
.pill.short { background: rgba(246, 70, 93, .12); color: var(--red); }

.up { color: var(--green); }
.down { color: var(--red); }
.flat { color: var(--muted); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.panel {
  margin-top: 26px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.filter-select {
  height: 32px;
  padding: 0 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font-size: 12px;
  outline: none;
}
.filter-select:focus { border-color: var(--yellow); }

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 16px; font-weight: 600; }
.panel-body { padding: 0; }

.tabs { display: flex; gap: 6px; }
.tab {
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab.active { color: #181a20; background: var(--yellow); font-weight: 600; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 680px; }
thead th {
  padding: 12px 16px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}
tbody tr:hover { background: var(--panel-2); }
tbody tr:last-child td { border-bottom: 0; }
.ta-r { text-align: right; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}
.pager-note { color: var(--muted-2); font-size: 11px; }
.pager b { color: var(--text); font-weight: 600; }
.pager-btns { display: flex; gap: 8px; }
.pager .btn { height: 30px; padding: 0 12px; font-size: 12px; }
.pager .btn:disabled { opacity: .4; cursor: not-allowed; border-color: var(--border); color: var(--muted); }

.empty { padding: 44px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; margin-bottom: 6px; color: var(--text); font-weight: 500; }

.skeleton {
  height: 120px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #181a20 25%, #1e2329 37%, #181a20 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

.breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
.breadcrumb a:hover { color: var(--yellow); }

.detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.detail-id { display: flex; align-items: center; gap: 14px; }
.detail-id h1 { margin: 0; font-size: 24px; }
.detail-id .trader-meta { margin-top: 6px; }
.detail-equity { text-align: right; }
.detail-equity .label { color: var(--muted); font-size: 12px; }
.detail-equity .value { font-family: var(--mono); font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }
.detail-equity .sub { font-size: 12px; color: var(--muted); }

.detail-stats {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  margin-top: 14px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.detail-stats > div { background: var(--panel); padding: 14px 16px; }

.chart-box { padding: 16px 20px 8px; }
.chart-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.chart-tabs .tab { height: 28px; padding: 0 10px; font-size: 12px; }
.chart-svg { width: 100%; height: 220px; display: block; }
.chart-legend { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; padding: 4px 4px 0; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.form-grid input,
.form-grid select {
  height: 36px;
  padding: 0 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.form-grid input:focus,
.form-grid select:focus { border-color: var(--yellow); }

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 13px;
}
.check input { accent-color: var(--yellow); }

.searchbar { display: flex; gap: 8px; flex-wrap: wrap; }
.searchbar input {
  height: 36px;
  width: 360px;
  max-width: 100%;
  padding: 0 12px;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 12px;
  outline: none;
}
.searchbar input:focus { border-color: var(--yellow); }

.profile-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 20px 0;
}
.profile-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }

.notice {
  margin: 24px 0 0;
  padding: 12px 16px;
  border: 1px solid rgba(252, 213, 53, .3);
  border-radius: 10px;
  background: rgba(252, 213, 53, .06);
  color: var(--muted);
  font-size: 12px;
}
.notice b { color: var(--yellow); }

.footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  border-top: 1px solid var(--border);
  color: var(--muted-2);
  font-size: 12px;
}
.footer p { margin: 0 0 6px; }
.muted { color: var(--muted); }
.error-box {
  padding: 18px 20px;
  border: 1px solid rgba(246, 70, 93, .4);
  border-radius: var(--radius);
  background: rgba(246, 70, 93, .08);
  color: var(--red);
}

@media (max-width: 1100px) {
  .profile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 14px 14px 0; }
  .detail-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .topbar { gap: 14px; padding: 0 14px; }
  .nav a { padding: 0 8px; }
  .clock { display: none; }
  .app { padding: 20px 14px 48px; }
  .trader-grid { grid-template-columns: 1fr; }
  .detail-equity { text-align: left; }
}

.toast-box {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}
.toast {
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--yellow);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
}
.toast b { color: var(--text); }
.toast span { color: var(--muted); white-space: pre-line; font-size: 12px; }
.toast.out { opacity: 0; transform: translateY(6px); transition: all .3s; }

.tick-up { animation: tickUp .8s ease-out; }
.tick-down { animation: tickDown .8s ease-out; }
@keyframes tickUp {
  0% { text-shadow: 0 0 12px rgba(14, 203, 129, .9); }
  100% { text-shadow: 0 0 0 rgba(14, 203, 129, 0); }
}
@keyframes tickDown {
  0% { text-shadow: 0 0 12px rgba(246, 70, 93, .9); }
  100% { text-shadow: 0 0 0 rgba(246, 70, 93, 0); }
}
.row-flash { animation: rowFlash 1s ease-out; }
@keyframes rowFlash {
  0% { background: rgba(252, 213, 53, .12); }
  100% { background: transparent; }
}

.kind-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.kind-pill {
  height: 34px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  transition: all .15s;
}
.kind-pill:hover { color: var(--text); border-color: var(--yellow); }
.kind-pill.active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #181a20;
  font-weight: 600;
}
