:root {
  color-scheme: dark;
  --bg: #060708;
  --panel: #0c0e10;
  --panel-2: #101316;
  --panel-3: #15191d;
  --line: #252a30;
  --line-strong: #3b424a;
  --text: #eef2f5;
  --muted: #8c96a0;
  --faint: #626b74;
  --green: #19d58b;
  --green-soft: rgba(25, 213, 139, 0.12);
  --red: #ff6674;
  --amber: #efbb55;
  font-family: Inter, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 13px;
}

* { box-sizing: border-box; }

html,
body {
  min-width: 1200px;
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
select {
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #0b0e11;
  color: var(--text);
  font: inherit;
  letter-spacing: 0;
}

button { padding: 0 12px; cursor: pointer; }
button:hover { background: var(--panel-3); }
select { min-width: 158px; padding: 0 26px 0 8px; }

.shell {
  width: min(1580px, calc(100% - 44px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 260px 1fr auto;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 10, 12, 0.96);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 16px;
}

.brand strong { font-size: 15px; }
.brand span { color: var(--muted); font-size: 11px; }

.summary-strip {
  display: flex;
  justify-content: center;
  gap: 22px;
  color: var(--muted);
  font-size: 12px;
}

.summary-strip b {
  margin-left: 5px;
  color: var(--text);
  font-weight: 600;
}

.top-actions {
  display: flex;
  justify-content: end;
  gap: 8px;
  padding: 0 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 14px;
  margin-top: 14px;
}

.radar-panel,
.detail-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.section-head,
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: #0f1215;
}

.section-head div,
.detail-head div {
  display: grid;
  gap: 3px;
}

.section-head strong,
.detail-head strong {
  font-size: 14px;
}

.section-head span,
.detail-head span,
.detail-metrics span,
.book-grid span {
  color: var(--muted);
  font-size: 11px;
}

.opportunity-table { width: 100%; }

.exchange-status {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.exchange-status article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px;
  min-height: 48px;
  padding: 9px 11px;
  background: #0b0e11;
}

.exchange-status article span {
  grid-column: 1 / -1;
}

.exchange-status strong {
  font-size: 12px;
}

.exchange-status label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.exchange-status input {
  accent-color: var(--green);
}

.exchange-status span {
  color: var(--muted);
  font-size: 11px;
}

.exchange-status .ok strong { color: var(--green); }
.exchange-status .warn strong { color: var(--amber); }
.exchange-status .fail strong { color: var(--red); }

.table-row {
  display: grid;
  grid-template-columns: 0.65fr 0.85fr 90px 1.1fr 1.1fr 84px 58px;
  align-items: center;
  min-height: 48px;
  border-bottom: 1px solid var(--line);
}

.table-row > span {
  min-width: 0;
  padding: 0 10px;
}

.table-head {
  min-height: 34px;
  color: var(--muted);
  font-size: 11px;
  background: #090b0d;
}

.opportunity-row {
  width: 100%;
  height: auto;
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
}

.opportunity-row:hover,
.opportunity-row.active {
  background: #12161a;
}

.opportunity-row.active {
  box-shadow: inset 3px 0 0 var(--text);
}

.pair-cell,
.exchange-cell,
.book-cell,
.path-cell,
.formula-cell {
  display: grid;
  gap: 3px;
}

.copy-asset {
  width: fit-content;
  border-bottom: 1px solid transparent;
}

.copy-asset:hover {
  border-bottom-color: var(--text);
}

.pair-cell strong,
.mono,
.book-cell,
.value-positive,
.value-negative,
.value-muted {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.pair-cell small,
.exchange-cell small,
.book-cell small,
.path-cell small,
.formula-cell small,
.fresh-cell {
  color: var(--muted);
  font-size: 11px;
}

.path-cell strong {
  width: fit-content;
  padding: 3px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #0b0e11;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
}

.formula-cell strong,
.formula-cell small {
  font-family: "SFMono-Regular", Consolas, monospace;
  white-space: nowrap;
}

.value-positive {
  color: var(--green);
  font-weight: 700;
}

.value-negative {
  color: var(--red);
  font-weight: 700;
}

.value-muted {
  color: var(--muted);
}

.stale { color: var(--amber); }

.empty {
  display: grid;
  min-height: 240px;
  place-items: center;
  color: var(--muted);
}

.detail-panel {
  position: sticky;
  top: 90px;
  align-self: start;
}

#detailBadge {
  padding: 4px 7px;
  border: 1px solid #2e7458;
  border-radius: 4px;
  background: var(--green-soft);
  color: #bff4dc;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.detail-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.detail-metrics div {
  display: grid;
  gap: 5px;
  padding: 12px;
}

.detail-metrics div + div { border-left: 1px solid var(--line); }

.detail-metrics b {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 14px;
}

.chart-wrap {
  position: relative;
  height: 310px;
  border-bottom: 1px solid var(--line);
}

#spreadChart {
  display: block;
  width: 100%;
  height: 100%;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  min-width: 132px;
  padding: 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #050607;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 11px;
  pointer-events: none;
}

.book-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.book-grid article {
  display: grid;
  gap: 5px;
  padding: 13px;
}

.book-grid article + article { border-left: 1px solid var(--line); }

.book-grid strong,
.book-grid small {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.book-grid small { color: var(--muted); }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #050607;
  color: var(--text);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
