:root {
  color-scheme: dark;
  --canvas: #101312;
  --surface: #161b19;
  --surface-alt: #1c2320;
  --line: #303a35;
  --line-soft: #252d29;
  --text: #f0f3eb;
  --muted: #98a198;
  --amber: #f2b842;
  --amber-soft: #4f3d16;
  --green: #63d199;
  --red: #ff817a;
  --blue: #75b9ff;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--canvas);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1480px, calc(100% - 48px)); margin: 0 auto; padding: 42px 0 28px; }
.masthead { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--amber); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; margin: 0 0 10px; }
h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1; letter-spacing: 0; margin: 0; font-weight: 740; }
.subtitle { margin: 12px 0 0; color: var(--muted); font-size: 15px; }
.header-actions { display: flex; align-items: center; gap: 11px; padding-top: 2px; }
.updated-at { color: var(--muted); white-space: nowrap; font-size: 12px; }

.icon-button, .page-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 5px; }
.icon-button:hover, .page-button:hover:not(:disabled) { border-color: var(--amber); color: var(--amber); }
.icon-button svg, .page-button svg, .sort-button svg, .primary-button svg, footer svg, .search-field svg { width: 16px; height: 16px; stroke-width: 1.8; }
.icon-button.is-loading svg { animation: rotate 0.9s linear infinite; }
@keyframes rotate { to { transform: rotate(360deg); } }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 24px 0; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.metric { min-height: 124px; padding: 22px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.metric:last-child { border-right: 0; }
.attention-metric { background: var(--surface-alt); }
.metric-label { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 25px; letter-spacing: 0; }
.metric-detail { color: var(--muted); font-size: 12px; }

.workspace { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.toolbar { display: flex; gap: 10px; padding: 15px; border-bottom: 1px solid var(--line); align-items: center; }
.search-field { min-width: 270px; flex: 1; display: flex; gap: 8px; align-items: center; padding: 0 11px; min-height: 38px; border: 1px solid var(--line); background: var(--canvas); color: var(--muted); border-radius: 4px; }
.search-field:focus-within { border-color: var(--amber); }
.search-field input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.select-field select { min-height: 38px; max-width: 150px; border: 1px solid var(--line); border-radius: 4px; color: var(--text); background: var(--canvas); padding: 0 28px 0 10px; }
.select-field select:focus { outline: 1px solid var(--amber); border-color: var(--amber); }
.primary-button { min-height: 38px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--amber); border-radius: 4px; padding: 0 14px; background: var(--amber); color: #191405; font-weight: 700; white-space: nowrap; }
.primary-button:hover:not(:disabled) { background: #ffd069; }
.primary-button:disabled, .page-button:disabled { opacity: 0.42; cursor: not-allowed; }

.status-row { display: flex; justify-content: space-between; gap: 18px; padding: 11px 15px; border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; }
.method-note { color: #b0a37f; text-align: right; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 1320px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { color: var(--muted); text-align: left; font-size: 11px; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; padding: 0; height: 42px; border-bottom: 1px solid var(--line); background: #141815; position: sticky; top: 0; }
th:not(:nth-child(2)), td:not(:nth-child(2)) { text-align: right; }
td { height: 66px; padding: 0 15px; border-bottom: 1px solid var(--line-soft); font-size: 13px; white-space: nowrap; }
tbody tr:hover { background: #1a201d; }
.rank-column { width: 52px; }
.sort-button { border: 0; color: inherit; background: transparent; padding: 0 15px; width: 100%; min-height: 42px; display: inline-flex; align-items: center; justify-content: flex-start; gap: 6px; font-size: inherit; font-weight: inherit; letter-spacing: inherit; text-transform: inherit; }
.sort-button.numeric { justify-content: flex-end; }
.sort-button:hover, .sort-button.active { color: var(--amber); }
.sort-button.active svg { color: var(--amber); }
.asset { display: flex; min-width: 260px; align-items: center; gap: 10px; text-align: left; }
.asset-icon { flex: 0 0 32px; width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: #28312c; }
.token-image { display: block; }
.asset-empty { background: transparent; }
.asset-copy { min-width: 0; }
.asset-symbol { overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 780; }
.asset-meta { color: var(--muted); font-size: 11px; margin-top: 3px; }
.chain { color: var(--blue); }
.metric-value { color: var(--text); font-weight: 600; }
.value-muted { color: var(--muted); }
.drawdown { color: var(--red); font-weight: 720; }
.drawdown.near-high { color: var(--green); }
.ath-tag { display: inline-block; margin-left: 6px; padding: 2px 4px; color: #d8bd73; background: var(--amber-soft); border-radius: 2px; font-size: 9px; letter-spacing: 0.04em; vertical-align: middle; }
.pending-ath { color: var(--muted); font-size: 12px; }
.period-change { font-weight: 720; }
.period-change.positive { color: var(--green); }
.period-change.negative { color: var(--red); }
.contract-badge { display: inline-block; min-width: 34px; padding: 4px 7px; border-radius: 3px; font-size: 11px; text-align: center; }
.contract-badge.yes { color: var(--green); background: rgba(99, 209, 153, 0.12); }
.contract-badge.no { color: var(--muted); background: var(--surface-alt); }
.empty-cell { height: 180px; text-align: center !important; color: var(--muted); }

.footer-row { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; color: var(--muted); font-size: 12px; }
.footer-row p { margin: 0; }
.pagination { display: flex; gap: 10px; align-items: center; }
#page-label { min-width: 52px; text-align: center; }
footer { display: flex; justify-content: space-between; gap: 18px; padding: 18px 1px 0; color: var(--muted); font-size: 12px; }
footer a { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
footer a:hover { color: var(--amber); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 860px) {
  .shell { width: min(100% - 28px, 1480px); padding-top: 24px; }
  .masthead { flex-direction: column; gap: 16px; }
  .header-actions { width: 100%; justify-content: space-between; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric:nth-child(2) { border-right: 0; }
  .metric:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
  .toolbar { flex-wrap: wrap; }
  .search-field { min-width: 100%; flex-basis: 100%; }
  .select-field { flex: 1; }
  .select-field select { width: 100%; max-width: none; }
  .primary-button { flex: 1; justify-content: center; }
  .status-row { flex-direction: column; gap: 5px; }
  .method-note { text-align: left; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 1480px); padding-top: 18px; }
  h1 { font-size: 31px; }
  .subtitle { font-size: 13px; line-height: 1.5; }
  .metrics { margin: 16px 0; }
  .metric { min-height: 104px; padding: 16px; }
  .metric strong { font-size: 20px; }
  .primary-button { font-size: 13px; padding: 0 10px; }
  .footer-row, footer { align-items: flex-start; flex-direction: column; }
}
