:root {
  color-scheme: dark;
  --ink: #edf1ed;
  --muted: #8b9690;
  --faint: #59635e;
  --surface: #080b0d;
  --surface-raised: #0d1113;
  --line: #20282a;
  --line-soft: #151b1d;
  --accent: #6df5b5;
  --accent-soft: rgba(109, 245, 181, 0.12);
  --warning: #e6bd67;
  --danger: #f07878;
  --mono: "SFMono-Regular", "Roboto Mono", "Cascadia Code", Consolas, monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--surface);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    var(--surface);
  background-size: 40px 40px;
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.shell {
  width: min(1600px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  border-inline: 1px solid var(--line-soft);
  background: rgba(8, 11, 13, 0.94);
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(8, 11, 13, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-decoration: none;
}

.brand-mark {
  width: 17px;
  height: 17px;
  border: 5px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(109, 245, 181, 0.28);
}

.brand-dim {
  color: var(--faint);
  font-weight: 560;
}

.sync-state {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.refresh-button {
  display: inline-flex;
  min-width: 94px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid rgba(109, 245, 181, 0.38);
  border-radius: 0;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.refresh-button:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(109, 245, 181, 0.18);
}

.refresh-button:disabled {
  border-color: var(--line);
  color: var(--muted);
  background: transparent;
  cursor: default;
}

.refresh-icon {
  display: inline-block;
  font-size: 15px;
  line-height: 1;
}

.refresh-button.scanning .refresh-icon {
  animation: spin 850ms linear infinite;
}

.logout-link {
  padding: 9px 2px;
  color: var(--faint);
  font-size: 10px;
  text-decoration: none;
  transition: color 140ms ease;
}

.logout-link:hover {
  color: var(--ink);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 5px rgba(230, 189, 103, 0.08);
}

.live-dot.ready {
  background: var(--accent);
  box-shadow: 0 0 0 5px var(--accent-soft);
  animation: live-pulse 2.5s ease-in-out infinite;
}

.live-dot.error {
  background: var(--danger);
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

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

main {
  padding: 0 32px 36px;
}

.overview {
  display: grid;
  grid-template-columns: minmax(340px, 1fr) minmax(520px, 1.25fr);
  gap: 64px;
  align-items: end;
  min-height: 260px;
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--line);
  animation: rise-in 500ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 650px;
  margin-bottom: 16px;
  font-size: clamp(34px, 4.1vw, 62px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.lede {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metrics > div {
  min-width: 0;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
}

.metrics > div:last-child {
  border-right: 0;
}

.metrics dt {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 11px;
}

.metrics dd {
  margin: 0;
  overflow: hidden;
  font-family: var(--mono);
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 640;
  letter-spacing: -0.04em;
  text-overflow: ellipsis;
}

.workspace {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 620px;
  border-bottom: 1px solid var(--line);
}

.asset-rail {
  padding: 30px 24px 30px 0;
  border-right: 1px solid var(--line);
}

.section-heading,
.asset-header,
.toolbar,
.method {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading h2,
.asset-header h2 {
  margin: 0;
  letter-spacing: -0.035em;
}

.section-heading h2 {
  font-size: 20px;
}

.asset-list {
  display: grid;
}

.asset-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  width: 100%;
  align-items: center;
  padding: 14px 12px;
  border: 0;
  border-top: 1px solid var(--line-soft);
  color: var(--ink);
  background: transparent;
  text-align: left;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, padding-left 140ms ease;
}

.asset-item:last-child {
  border-bottom: 1px solid var(--line-soft);
}

.asset-item:hover,
.asset-item.active {
  padding-left: 17px;
  background: linear-gradient(90deg, var(--accent-soft), transparent 85%);
}

.asset-item.active::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--accent);
  content: "";
}

.asset-symbol {
  display: block;
  margin-bottom: 4px;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}

.asset-underlying {
  color: var(--muted);
  font-size: 11px;
}

.asset-mini-price {
  display: block;
  margin-top: 5px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.asset-mini-supply {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
}

.asset-pool-count {
  min-width: 24px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
}

.pool-pane {
  min-width: 0;
  padding: 30px 0 30px 28px;
}

.asset-header {
  min-height: 92px;
  gap: 24px;
}

.asset-actions {
  display: flex;
  min-width: 440px;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
}

.asset-quote {
  margin: 0;
  text-align: right;
}

.asset-quote > span,
.asset-quote small {
  display: block;
  color: var(--muted);
  font-size: 9px;
}

.asset-quote strong {
  display: block;
  margin: 4px 0;
  color: var(--accent);
  font-size: 20px;
  font-weight: 680;
  letter-spacing: -0.04em;
}

.supply-quote {
  min-width: 142px;
}

.supply-quote strong {
  color: var(--ink);
  font-size: 17px;
}

.supply-quote[data-status="increased"] strong,
.supply-quote[data-status="increased"] small {
  color: var(--danger);
}

.supply-quote[data-status="decreased"] small {
  color: var(--accent);
}

.supply-quote[data-status="read-failed"] small {
  color: var(--warning);
}

.asset-header h2 {
  margin-bottom: 7px;
  font-family: var(--mono);
  font-size: clamp(26px, 3vw, 42px);
}

.asset-name {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.address-button {
  max-width: 310px;
  overflow: hidden;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease;
}

.address-button:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.toolbar {
  min-height: 56px;
  gap: 18px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  height: 55px;
  gap: 24px;
}

.filters button {
  position: relative;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  cursor: pointer;
}

.filters button::after {
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--accent);
  content: "";
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 140ms ease, transform 140ms ease;
}

.filters button.active {
  color: var(--ink);
}

.filters button.active::after {
  opacity: 1;
  transform: scaleX(1);
}

.coverage {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
}

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

.pool-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.pool-table th {
  padding: 17px 12px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 560;
  letter-spacing: 0.09em;
  text-align: left;
  text-transform: uppercase;
}

.pool-table th:first-child,
.pool-table td:first-child {
  padding-left: 0;
}

.pool-table th:nth-child(1) { width: 14%; }
.pool-table th:nth-child(2) { width: 15%; }
.pool-table th:nth-child(3) { width: 11%; }
.pool-table th:nth-child(4) { width: 12%; }
.pool-table th:nth-child(5) { width: 13%; }
.pool-table th:nth-child(6) { width: 13%; }
.pool-table th:nth-child(7) { width: 22%; }

.pool-table td {
  padding: 18px 12px;
  border-top: 1px solid var(--line-soft);
  vertical-align: middle;
}

.pool-row {
  animation: row-in 320ms ease both;
}

.pool-row:hover {
  background: rgba(255, 255, 255, 0.016);
}

.venue {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
  font-weight: 680;
  text-transform: capitalize;
}

.subvalue,
.source-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.pair-symbols,
.numeric {
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.fee-value {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 650;
}

.fee-value.retryable {
  color: var(--warning);
  font-size: 11px;
}

.fee-value.unsupported {
  color: var(--muted);
  font-size: 11px;
}

.pool-id {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.pool-id span:first-child {
  overflow: hidden;
  font-family: var(--mono);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-glyph {
  color: var(--faint);
  font-size: 12px;
  transition: color 120ms ease;
}

.pool-id:hover .copy-glyph {
  color: var(--accent);
}

.empty-row td {
  height: 180px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.method {
  flex-wrap: wrap;
  gap: 20px;
  padding: 20px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.method p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
}

.source-mark {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.source-mark.onchain { background: var(--accent); }
.source-mark.indexer { background: #6a9fe6; }
.source-mark.retryable { background: var(--warning); }
.source-mark.unsupported { background: var(--faint); }
.method .method-note { margin-left: auto; font-family: var(--mono); }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 30;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  color: var(--ink);
  background: #101816;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes row-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(109, 245, 181, 0.08); }
  50% { box-shadow: 0 0 0 7px rgba(109, 245, 181, 0.02); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes value-in {
  from { opacity: 0.35; transform: translateY(3px); }
  to { opacity: 1; transform: translateY(0); }
}

.snapshot-updated .metrics dd,
.snapshot-updated .asset-quote strong {
  animation: value-in 260ms ease both;
}

.login-body {
  min-height: 100vh;
}

.login-page {
  display: grid;
  width: min(1180px, 100%);
  min-height: 100vh;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  margin: 0 auto;
  padding: 0;
  border-inline: 1px solid var(--line-soft);
  background: rgba(8, 11, 13, 0.95);
}

.login-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: clamp(36px, 8vw, 108px);
  border-right: 1px solid var(--line);
}

.login-brand {
  position: absolute;
  top: clamp(28px, 5vw, 58px);
}

.login-copy {
  max-width: 590px;
}

.login-copy h1 {
  margin-bottom: 24px;
}

.login-copy > p:last-child {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.75;
}

.login-button {
  display: inline-flex;
  width: min(100%, 360px);
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  margin-top: 42px;
  padding: 0 18px;
  border: 1px solid var(--accent);
  color: #07110c;
  background: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 740;
  text-decoration: none;
  transition: background 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.login-button::after {
  content: "→";
  font-size: 17px;
}

.login-button:hover {
  background: #8affc8;
  box-shadow: 0 0 36px rgba(109, 245, 181, 0.14);
  transform: translateY(-1px);
}

.login-note {
  margin: 14px 0 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
}

.login-aside {
  position: relative;
  display: flex;
  min-height: 100vh;
  align-items: flex-end;
  overflow: hidden;
  padding: clamp(30px, 5vw, 64px);
  background:
    radial-gradient(circle at 50% 42%, rgba(109, 245, 181, 0.11), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.018), transparent 58%);
}

.login-aside::before,
.login-aside::after {
  position: absolute;
  inset: 9% 12%;
  border: 1px solid var(--line);
  content: "";
  transform: rotate(12deg);
}

.login-aside::after {
  inset: 18% 24%;
  border-color: rgba(109, 245, 181, 0.2);
  transform: rotate(-18deg);
}

.login-index {
  position: absolute;
  top: clamp(30px, 5vw, 64px);
  right: clamp(30px, 5vw, 64px);
  color: var(--accent);
  font-size: 10px;
}

.login-aside > p {
  position: relative;
  z-index: 2;
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: clamp(18px, 2.5vw, 30px);
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: 0.08em;
}

.login-orbit,
.login-orbit span {
  position: absolute;
  border: 1px solid rgba(109, 245, 181, 0.18);
  border-radius: 50%;
}

.login-orbit {
  top: 50%;
  left: 50%;
  width: min(64vw, 440px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.login-orbit span:nth-child(1) { inset: 14%; }
.login-orbit span:nth-child(2) { inset: 30%; }
.login-orbit span:nth-child(3) {
  inset: 45%;
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 32px rgba(109, 245, 181, 0.32);
}

@media (max-width: 1080px) {
  .overview {
    grid-template-columns: 1fr;
    gap: 34px;
  }

  .workspace {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .pool-table {
    min-width: 1020px;
  }
}

@media (max-width: 760px) {
  .shell {
    border: 0;
  }

  .topbar,
  main {
    padding-inline: 18px;
  }

  .brand-dim,
  #sync-label {
    display: none;
  }

  .topbar-actions {
    gap: 9px;
  }

  .logout-link {
    padding-inline: 0;
  }

  .refresh-button {
    min-width: 82px;
    padding-inline: 9px;
  }

  .overview {
    min-height: auto;
    padding: 34px 0 28px;
  }

  h1 {
    font-size: 38px;
  }

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

  .metrics > div:nth-child(2) {
    border-right: 0;
  }

  .metrics > div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    display: block;
  }

  .asset-rail {
    padding: 26px 0 12px;
    border-right: 0;
  }

  .asset-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scrollbar-width: none;
  }

  .asset-list::-webkit-scrollbar {
    display: none;
  }

  .asset-item {
    flex: 0 0 118px;
    border: 1px solid var(--line);
  }

  .asset-item:last-child {
    border-bottom: 1px solid var(--line);
  }

  .asset-item:hover,
  .asset-item.active {
    padding-left: 12px;
    border-color: rgba(109, 245, 181, 0.45);
  }

  .pool-pane {
    padding: 24px 0;
  }

  .asset-header {
    display: block;
  }

  .asset-actions {
    display: grid;
    min-width: 0;
    grid-template-columns: 1fr;
    margin-top: 20px;
  }

  .asset-quote {
    text-align: left;
  }

  .address-button {
    width: 100%;
    max-width: none;
    margin-top: 0;
    text-align: left;
  }

  .toolbar {
    display: block;
    margin-top: 24px;
  }

  .filters {
    justify-content: space-between;
    gap: 16px;
  }

  .coverage {
    padding: 12px 0;
    border-top: 1px solid var(--line-soft);
  }

  .method {
    align-items: flex-start;
    flex-direction: column;
  }

  .method .method-note {
    margin-left: 0;
  }

  .login-page {
    display: block;
    padding: 0;
    border: 0;
  }

  .login-panel {
    min-height: 100vh;
    padding: 98px 24px 42px;
    border-right: 0;
  }

  .login-brand {
    top: 34px;
  }

  .login-copy h1 {
    font-size: clamp(38px, 12vw, 54px);
  }

  .login-aside {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
