:root {
  color-scheme: light;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --surface-soft: #eceff1;
  --ink: #171717;
  --muted: #656b70;
  --line: #d9dde0;
  --accent: #0b8f82;
  --accent-soft: #d9f2ee;
  --good: #08753f;
  --good-soft: #dff3e8;
  --warn: #9a6a00;
  --warn-soft: #fff0c2;
  --bad: #b93632;
  --bad-soft: #f9dddd;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.07);
}

* {
  box-sizing: border-box;
}

html {
  letter-spacing: 0;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  align-items: center;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 68px;
  padding: 12px 20px;
  position: sticky;
  top: 0;
  z-index: 10;
}

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

.topbar h1 {
  font-size: 24px;
  line-height: 1.05;
}

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

.creator-line a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}

.creator-line a:hover {
  text-decoration: underline;
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.auto-toggle {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  min-height: 40px;
  padding: 8px 11px;
  user-select: none;
}

.auto-toggle input {
  accent-color: var(--accent);
  height: 16px;
  width: 16px;
}

.auto-toggle span {
  font-size: 13px;
  font-weight: 800;
}

.sync-pill {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid rgba(11, 143, 130, 0.28);
  border-radius: 999px;
  color: #075c54;
  display: inline-flex;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 12px;
}

.button {
  align-items: center;
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  text-decoration: none;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button.secondary {
  background: var(--surface);
  color: var(--ink);
}

main {
  display: grid;
  gap: 14px;
  padding: 14px 18px 24px;
}

.notice-band {
  align-items: center;
  background: #202020;
  color: #ffffff;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 9px 20px;
}

.notice-band div:last-child {
  color: #cfd3d5;
  font-size: 13px;
}

.workspace {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr) 330px;
}

.table-panel,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section-head {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px;
}

.section-head h2 {
  font-size: 18px;
}

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

.section-head.compact {
  padding: 0;
}

.section-head.compact h3 {
  font-size: 17px;
}

.section-head.compact span {
  color: var(--muted);
  font-size: 13px;
}

.legend {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 12px;
}

.legend span {
  align-items: center;
  display: inline-flex;
  gap: 6px;
}

.dot {
  border-radius: 999px;
  display: inline-block;
  height: 8px;
  width: 8px;
}

.dot.good {
  background: var(--good);
}

.dot.warn {
  background: var(--warn);
}

.dot.bad {
  background: var(--bad);
}

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

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

th,
td {
  border-top: 1px solid var(--line);
  padding: 9px 10px;
  text-align: right;
  white-space: nowrap;
  font-size: 12px;
}

th {
  background: #f9fafb;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

th:first-child,
td:first-child {
  text-align: left;
}

tbody tr {
  cursor: pointer;
  transition:
    background 140ms ease,
    transform 140ms ease;
}

tbody tr:hover,
tbody tr.selected {
  background: #f4fbfa;
}

tbody tr:hover {
  transform: translateX(2px);
}

.asset-cell {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 170px;
}

.asset-logo,
.detail-token img {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 50%;
  flex: 0 0 auto;
  object-fit: cover;
}

.asset-logo {
  height: 28px;
  width: 28px;
}

.asset-cell strong {
  display: block;
  font-size: 12px;
}

.asset-cell span {
  color: var(--muted);
  display: block;
  font-size: 10px;
  margin-top: 2px;
}

.status {
  border-radius: 999px;
  display: inline-flex;
  font-size: 10px;
  font-weight: 800;
  justify-content: center;
  min-width: 70px;
  padding: 5px 7px;
}

.status.good {
  background: var(--good-soft);
  color: var(--good);
}

.status.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.status.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.status.loading {
  background: var(--accent-soft);
  color: #075c54;
}

.loading-value {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-height: 1em;
  min-width: 18px;
  vertical-align: -2px;
}

.spinner {
  animation: spin 800ms linear infinite;
  border: 2px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  display: inline-block;
  height: 14px;
  width: 14px;
}

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

.table-link {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.address-link {
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 11px;
  text-decoration: none;
}

.address-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

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

.positive {
  color: var(--good);
}

.negative {
  color: var(--bad);
}

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

.detail-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100svh - 118px);
  min-height: 0;
  overflow: hidden;
  padding: 12px;
  position: sticky;
  top: 82px;
}

.detail-token {
  align-items: center;
  display: flex;
  gap: 12px;
}

.detail-token img {
  height: 42px;
  width: 42px;
}

.detail-token h2 {
  font-size: 19px;
}

.detail-token p:last-child {
  color: var(--muted);
  font-size: 14px;
  margin-top: 2px;
}

.address-line {
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
  overflow: hidden;
  padding: 10px;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-action {
  width: 100%;
}

.detail-tabs {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 4px;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
}

.detail-tab {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  min-height: 30px;
}

.detail-tab.active {
  background: var(--surface);
  color: var(--ink);
}

.detail-pages {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.detail-page {
  display: none;
  gap: 12px;
  height: 100%;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.detail-page.active {
  display: grid;
}

.detail-stat-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.detail-stat-row div,
.source-block div {
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.detail-stat-row span,
.source-block span,
.withdrawal-card > span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-stat-row strong {
  display: block;
  font-size: 17px;
  margin-top: 5px;
}

.source-block {
  display: grid;
  gap: 10px;
}

.source-block strong {
  display: block;
  font-size: 13px;
  line-height: 1.35;
  margin-top: 5px;
}

.withdrawal-card {
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 11px;
}

.withdrawal-card > strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.withdrawal-card p {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
}

.withdrawal-lines {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding-top: 8px;
}

.withdrawal-lines span {
  color: var(--muted);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
}

.withdrawal-lines b {
  color: var(--ink);
  font-weight: 800;
}

.withdrawal-options {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding-top: 8px;
}

.withdrawal-option {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 8px;
}

.withdrawal-option.active {
  border-color: rgba(11, 143, 130, 0.42);
  box-shadow: inset 3px 0 0 var(--accent);
}

.withdrawal-option strong,
.withdrawal-option b {
  display: block;
  font-size: 12px;
}

.withdrawal-option span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  margin-top: 2px;
}

.withdrawal-option > div:last-child {
  text-align: right;
}

.chart-block,
.risk-block {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  padding-top: 16px;
}

.detail-page > .chart-block:first-child {
  border-top: 0;
  padding-top: 0;
}

.ladder-chart {
  display: grid;
  gap: 9px;
}

.ladder-row {
  align-items: center;
  display: grid;
  gap: 9px;
  grid-template-columns: 62px minmax(0, 1fr) 72px;
}

.ladder-row span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.ladder-track {
  background: var(--surface-soft);
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
}

.ladder-bar {
  border-radius: 999px;
  height: 100%;
  min-width: 3px;
}

.ladder-bar.good {
  background: var(--good);
}

.ladder-bar.bad {
  background: var(--bad);
}

.risk-block h3 {
  font-size: 17px;
}

.risk-block ul {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.risk-block li {
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
  padding-left: 10px;
}

.risk-block li.critical {
  border-left-color: var(--bad);
  color: var(--bad);
  font-weight: 700;
}

.pool-list {
  display: grid;
  gap: 8px;
}

.pool-list a {
  background: #fbfcfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: grid;
  gap: 3px;
  padding: 11px;
  text-decoration: none;
  transition:
    border-color 140ms ease,
    transform 140ms ease;
}

.pool-list a:hover {
  border-color: rgba(11, 143, 130, 0.45);
  transform: translateY(-1px);
}

.pool-list span {
  font-size: 13px;
  font-weight: 800;
}

.pool-list strong {
  color: var(--good);
  font-size: 15px;
}

.pool-list small,
.pool-list p {
  color: var(--muted);
  font-size: 12px;
  margin: 0;
}

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

  .detail-panel {
    max-height: none;
    overflow: visible;
    position: static;
  }
}

@media (max-width: 720px) {
  .topbar,
  .notice-band,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar,
  main,
  .notice-band {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topbar h1 {
    font-size: 26px;
  }

  .topbar-actions,
  .legend {
    width: 100%;
  }

  .button {
    flex: 1;
  }

  .detail-stat-row {
    grid-template-columns: 1fr;
  }
}
