:root {
  --bg: #030914;
  --bg2: #071223;
  --panel: rgba(8, 16, 34, 0.82);
  --border: rgba(148, 163, 184, 0.25);
  --text: #e6edf8;
  --muted: #91a3bf;
  --accent: #00d18f;
  --danger: #ff5f80;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1200px 420px at 15% 0%, #132a50 0%, var(--bg2) 45%, var(--bg) 100%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 16px 10vw;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(to bottom, rgba(3, 9, 20, 0.88), rgba(3, 9, 20, 0.5));
  backdrop-filter: blur(8px);
}

.topbar__left {
  display: grid;
  gap: 4px;
}

.topbar__right {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

@media (min-width: 920px) {
  .topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .topbar__right {
    margin-top: 0;
  }
}

.kicker {
  font-size: 11px;
  letter-spacing: 0.28em;
  color: #78eec5;
}

.title {
  margin: 0;
  font-size: 24px;
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

.btn {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  background: rgba(15, 23, 42, 0.45);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
}

.btn-ghost:hover {
  background: rgba(148, 163, 184, 0.12);
}

.container {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 14px 10vw 40px;
  display: grid;
  gap: 12px;
}

.card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}

@media (min-width: 760px) {
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .card-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.card, .panel {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 14px;
}

.card {
  padding: 14px 16px;
}

.label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
}

.sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.panel__header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.panel__title {
  margin: 0;
  font-size: 16px;
}

.whale-select {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(15, 23, 42, 0.6);
  color: var(--text);
  font-size: 12px;
}

.panel__body {
  padding: 12px 16px 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.stats-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: rgba(11, 23, 46, 0.5);
}

.stats-item strong {
  display: block;
  margin-bottom: 6px;
}

.exchange-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(148, 163, 184, 0.18);
}

.exchange-row:last-child {
  border-bottom: 0;
}

.exchange-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
}

@media (min-width: 1024px) {
  .exchange-split {
    grid-template-columns: 1fr 1fr;
  }
}

.exchange-split > * {
  min-height: 260px;
}

#exchange-history {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(11, 23, 46, 0.5);
  height: 100%;
  display: flex;
  align-items: stretch;
}

.exchange-pie-wrap {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  gap: 10px;
  align-items: stretch;
  width: 100%;
  min-height: 100%;
}

.exchange-pie {
  width: 100%;
  height: 100%;
  min-height: 170px;
  max-height: 230px;
  margin: 0 auto;
}

.exchange-pie-legend {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.exchange-pie-item {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 6px;
  align-items: center;
  font-size: 11px;
}

.exchange-pie-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.exchange-pie-name {
  color: var(--muted);
}

.exchange-pie-val {
  color: var(--text);
}

.dist-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 10px;
}

@media (min-width: 900px) {
  .dist-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

.dist-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(11, 23, 46, 0.45);
  padding: 8px;
}

.dist-title {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.dist-pie {
  width: 100%;
  height: 120px;
}

.dist-legend {
  display: grid;
  gap: 4px;
}

.dist-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 5px;
  align-items: center;
  font-size: 10px;
}

.dist-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
}

.dist-name {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dist-val {
  color: var(--text);
}

.flow-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 1200px) {
  .flow-grid {
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    align-items: stretch;
  }
}

.flow-canvas-wrap {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(11, 23, 46, 0.38);
  min-height: 360px;
  overflow: hidden;
}

.flow-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.flow-meta {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(11, 23, 46, 0.5);
  padding: 10px;
  display: grid;
  gap: 10px;
}

.flow-meta__stats {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.flow-chain-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.flow-chain-item {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 7px 8px;
  background: rgba(8, 16, 34, 0.55);
}

.flow-chain-head {
  font-size: 11px;
  color: #c9daff;
}

.flow-chain-path {
  margin-top: 4px;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.35;
}

.flow-filter-pill {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(11, 23, 46, 0.55);
  color: #d7e4fb;
}

.flow-filter-clear {
  padding: 6px 10px;
  font-size: 11px;
}

@media (max-width: 900px) {
  .exchange-pie-wrap {
    grid-template-columns: 1fr;
    min-height: 100%;
  }
  .exchange-pie-legend {
    grid-template-columns: 1fr;
  }
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.table th,
.table td {
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding: 8px 6px;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}

.table th {
  color: var(--muted);
  font-weight: 600;
}

.table-link {
  color: #7dc6ff;
  text-decoration: none;
}

.table-link:hover {
  text-decoration: underline;
}

.table .num {
  text-align: right;
}

.pill {
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  border: 1px solid var(--border);
}

.type-deposit {
  color: var(--accent);
}

.type-withdrawal {
  color: #7dc6ff;
}

.neg {
  color: var(--danger);
}

.pos {
  color: var(--accent);
}
