:root {
  --bg: #050711;
  --surface: #0b0d19;
  --surface-2: #101321;
  --surface-3: #151827;
  --line: #22283a;
  --line-soft: #161b2b;
  --text: #f2f6ff;
  --muted: #7f8aa3;
  --muted-2: #a7b0c4;
  --cyan: #00e0ad;
  --cyan-soft: rgba(0, 224, 173, 0.12);
  --blue: #3b82f6;
  --green: #00e0ad;
  --amber: #facc15;
  --red: #ff5d6c;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top left, rgba(0, 224, 173, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button {
  font: inherit;
}

.shell {
  width: min(1720px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 14px 0 18px;
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
  align-items: center;
  gap: 18px;
  min-height: 48px;
  margin-bottom: 14px;
}

.eyebrow,
h1,
h2,
h3,
p {
  margin: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

h1 {
  grid-column: 2;
  text-align: center;
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
}

h2 {
  font-size: 15px;
}

h3 {
  font-size: 14px;
}

.exchange-tabs,
.trade-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.topbar .exchange-tabs {
  grid-column: 3;
}

.seg {
  min-width: 72px;
  height: 36px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted-2);
  border-radius: 8px;
  cursor: pointer;
}

.seg:hover {
  border-color: rgba(0, 224, 173, 0.55);
  color: var(--text);
}

.seg.active {
  background: var(--cyan-soft);
  border-color: rgba(0, 224, 173, 0.7);
  color: var(--cyan);
  box-shadow: inset 0 0 0 1px rgba(0, 224, 173, 0.08);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.metric,
.panel,
.trade-column {
  background: rgba(11, 13, 25, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  position: relative;
  min-height: 80px;
  padding: 14px 18px;
  overflow: hidden;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0.7;
}

.label,
.metric small,
.panel-head p,
.subhead small {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin: 5px 0 3px;
  color: var(--cyan);
  font-size: 24px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.panel {
  min-width: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.board-head {
  align-items: center;
}

.board-head h2,
.subhead h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.board-head h2::before,
.subhead h3::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--cyan);
  box-shadow: 0 0 14px rgba(0, 224, 173, 0.75);
}

.trade-board {
  overflow: hidden;
}

.trade-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 19, 33, 0.86);
}

.stat-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.stat-pill small {
  color: var(--muted);
  font-size: 12px;
}

.stat-pill strong {
  color: var(--text);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.trade-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
}

.trade-column {
  box-shadow: none;
  overflow: hidden;
}

.subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 19, 33, 0.72);
}

.subhead div {
  min-width: 0;
}

.pager {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
}

.pager-button {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-3);
  color: var(--muted-2);
  cursor: pointer;
}

.pager-button:disabled {
  cursor: default;
  color: #4d576f;
  background: #0d101c;
}

.page-indicator {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.order-list {
  display: grid;
  gap: 0;
  max-height: calc(100vh - 260px);
  overflow: auto;
  padding: 0;
}

.order-list::-webkit-scrollbar {
  width: 8px;
}

.order-list::-webkit-scrollbar-thumb {
  background: #283047;
  border-radius: 999px;
}

.order {
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  padding: 12px 12px;
  background: transparent;
}

.order:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}

.order-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.order-main strong {
  font-size: 14px;
}

.side-long,
.side-short {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 22px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 800;
}

.side-long {
  color: var(--cyan);
  background: rgba(0, 224, 173, 0.12);
  border: 1px solid rgba(0, 224, 173, 0.4);
}

.side-short {
  color: var(--red);
  background: rgba(255, 93, 108, 0.12);
  border: 1px solid rgba(255, 93, 108, 0.4);
}

.pnl-positive {
  color: var(--green);
  font-weight: 800;
}

.pnl-negative {
  color: var(--red);
  font-weight: 800;
}

.pnl-flat {
  color: var(--muted);
  font-weight: 800;
}

.order-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 12px;
  color: var(--muted-2);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.order-grid span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.order-grid .wide {
  grid-column: 1 / -1;
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 44px 12px;
}

@media (max-width: 980px) {
  .topbar {
    grid-template-columns: 1fr;
  }

  h1,
  .topbar .exchange-tabs {
    grid-column: auto;
    text-align: left;
  }

  .panel-head,
  .board-head {
    display: grid;
  }

  .exchange-tabs,
  .trade-tabs {
    justify-content: start;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

  .order-list {
    max-height: none;
  }
}

@media (max-width: 640px) {
  .shell {
    width: calc(100vw - 20px);
    padding-top: 12px;
  }

  h1 {
    font-size: 18px;
  }

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

  .seg {
    min-width: 64px;
  }

  .trade-grid {
    padding: 10px;
  }

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