:root {
  color-scheme: dark;
  --bg: #0c1216;
  --panel: #121b20;
  --panel-soft: #172229;
  --nav-bg: rgba(12, 18, 22, 0.9);
  --text: #edf4f6;
  --muted: #91a0aa;
  --line: #26363e;
  --green: #2bc98c;
  --red: #e66d84;
  --cyan: #46bed0;
  --amber: #dda04a;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: linear-gradient(180deg, #102027 0, rgba(24, 112, 126, 0.12) 280px, transparent 580px), var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

h1, h2, p { margin: 0; }

.global-menu {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 58px;
  padding: 8px max(16px, calc((100vw - 1280px) / 2 + 16px));
  border-bottom: 1px solid var(--line);
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
}

.menu-brand {
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.menu-right { display: flex; align-items: center; gap: 8px; }

.menu-right a,
.status-pill,
.sync-pill,
.window-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.menu-right a { border-color: transparent; background: transparent; }
.menu-right a:hover { border-color: var(--line); color: var(--text); }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }
.dot-live { background: var(--green); }
.dot-error { background: var(--red); }

.shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #102029, #17372f 58%, #194b5a);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin-bottom: 7px;
  color: #8de5c2;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

h1 { font-size: clamp(32px, 5vw, 54px); line-height: 1; }
.headline-copy { margin-top: 11px; color: #c6d7dc; font-size: 15px; }

.live-clock {
  display: grid;
  gap: 5px;
  min-width: 130px;
  padding-left: 20px;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
}

.live-clock span,
.metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.live-clock strong { font-size: 20px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.metrics article {
  min-height: 92px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metrics strong { display: block; margin-top: 10px; font-size: 24px; overflow-wrap: anywhere; }

.panel {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  container-type: inline-size;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--panel-soft));
}

.panel-head h2 { font-size: 19px; }
.panel-head p { margin-top: 5px; color: var(--muted); font-size: 13px; }

.table-head,
.trade-row {
  display: grid;
  grid-template-columns: 54px minmax(130px, 1fr) minmax(150px, 1fr) minmax(130px, .8fr) minmax(130px, .8fr) minmax(150px, .9fr);
  gap: 12px;
  align-items: center;
}

.table-head {
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255,255,255,.02);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.trade-row {
  min-height: 72px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}

.trade-row:last-child { border-bottom: 0; }
.trade-row:hover { background: var(--panel-soft); }
.rank { color: #657984; font-variant-numeric: tabular-nums; }
.market-cell strong { font-size: 16px; }
.market-cell span,
.side-cell span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }
.trade-count { font-size: 20px; font-variant-numeric: tabular-nums; }
.buy-cell strong, .positive { color: var(--green); }
.sell-cell strong, .negative { color: var(--red); }

.imbalance-cell { min-width: 0; }
.imbalance-cell strong { font-size: 14px; }
.imbalance-bar { width: 100%; height: 4px; margin-top: 8px; overflow: hidden; border-radius: 2px; background: #25343b; }
.imbalance-bar span { display: block; height: 100%; border-radius: inherit; }
.bar-positive { background: var(--green); }
.bar-negative { background: var(--red); }
.empty { padding: 34px 18px; color: var(--muted); }

@container (max-width: 800px) {
  .table-head { display: none; }
  .trade-row { grid-template-columns: 44px minmax(0, 1fr) minmax(100px, .6fr); }
  .side-cell, .imbalance-cell { grid-column: auto; }
}

@media (max-width: 720px) {
  .global-menu { align-items: flex-start; gap: 10px; }
  .menu-brand { padding-top: 11px; }
  .menu-right { overflow-x: auto; }
  .shell { width: calc(100% - 20px); padding-top: 14px; }
  .hero { align-items: flex-start; flex-direction: column; padding: 20px; }
  .live-clock { padding-left: 0; border-left: 0; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-head { align-items: flex-start; }
  .trade-row { grid-template-columns: 36px minmax(0, 1fr); gap: 10px; padding: 14px 12px; }
  .trade-count { text-align: right; }
  .side-cell, .imbalance-cell { grid-column: 2; }
}
