:root {
  color-scheme: light;
  --page: #f3f5ef;
  --panel: #fff;
  --ink: #172923;
  --muted: #54645c;
  --line: #dce3da;
  --green: #216144;
  --soft-green: #e3f2e8;
  --red: #923e2f;
  --soft-red: #f8e9e4;
  --body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono-font: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 400 15px/1.5 var(--body-font);
}

h1, h2, h3, p, dl, dd { margin: 0; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid #276f50;
  outline-offset: 3px;
}

.shell {
  width: min(1140px, calc(100% - 72px));
  margin-inline: auto;
}

.tabs {
  display: flex;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px;
  background: var(--panel);
}

.tabs button {
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  background: transparent;
  color: var(--muted);
  font: 700 14px/1.4 var(--body-font);
  cursor: pointer;
}

.tabs button:hover { background: #edf2eb; }

.tabs button[aria-selected="true"] {
  background: var(--soft-green);
  color: var(--green);
}

.address, .query-heading, .metric-card h3, .pool-details {
  display: flex;
  align-items: center;
}

.query-panel {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--panel);
  padding: 23px 25px;
}

.pool-details {
  flex-wrap: wrap;
  gap: 3px 8px;
  margin-top: 9px;
}

.minor-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.address {
  width: fit-content;
  max-width: 100%;
  gap: 5px;
  color: #305744;
  font: 500 12px/1.4 var(--mono-font);
  text-decoration: none;
}

.address:hover { text-decoration: underline; }

.address span { overflow-wrap: anywhere; }

.address svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.query-heading {
  gap: 9px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.query-heading h2 {
  font-size: 14px;
  font-weight: 700;
}

.timezone {
  padding: 2px 6px;
  border-radius: 4px;
  background: #edf2eb;
  color: #496053;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.query-fields {
  display: grid;
  max-width: 560px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.date-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.date-control { position: relative; }

.date-text {
  min-width: 0;
  width: 100%;
  height: 40px;
  border: 1px solid #ccd7ce;
  border-radius: 8px;
  padding: 0 36px 0 9px;
  background: #fff;
  color: var(--ink);
  font: 600 14px var(--body-font);
  font-variant-numeric: tabular-nums;
}

.date-text:focus { border-color: var(--green); }

.date-calendar {
  position: absolute;
  inset: 1px 1px 1px auto;
  width: 34px;
  display: grid;
  place-items: center;
  border-radius: 0 7px 7px 0;
  color: var(--muted);
}

.date-calendar:focus-within {
  outline: 2px solid var(--green);
  outline-offset: -2px;
}

.date-calendar svg {
  width: 17px;
  height: 17px;
}

.date-calendar input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.date-calendar input::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.range-divider {
  display: grid;
  height: 40px;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

.query-fields button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: #1f503c;
  color: #fff;
  font: 700 14px var(--body-font);
  white-space: nowrap;
  cursor: pointer;
}

.query-fields button:hover { background: #28684c; }

.query-fields button:disabled {
  background: #456c59;
  cursor: wait;
}

.query-fields button svg {
  width: 17px;
  height: 17px;
}

.query-status {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.query-status:empty { display: none; }
.query-status[data-state="error"] { color: var(--red); }

.results {
  margin-top: 29px;
  padding-bottom: 32px;
}

.results-heading {
  margin-bottom: 11px;
  font-size: 21px;
  font-weight: 740;
  letter-spacing: -.025em;
}

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

.metric-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 19px 20px 18px;
  background: var(--panel);
}

.metric-card h3 {
  gap: 8px;
  font-size: 15px;
  font-weight: 750;
}

.metric-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 7px;
  background: var(--soft-green);
  color: var(--green);
}

.metric-icon svg {
  width: 17px;
  height: 17px;
}

.sell .metric-icon {
  background: var(--soft-red);
  color: var(--red);
}

.total {
  border-color: #254e3c;
  background: #214634;
  color: #fff;
  --muted: #d2e4d8;
  --line: #486b57;
}

.total .metric-icon {
  background: #3a614d;
  color: #dcf4e2;
}

.metric-card dl { margin-top: 14px; }

.metric-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.metric-card dt span {
  margin-left: 2px;
  font-size: 11px;
  letter-spacing: .01em;
}

.metric-card dd {
  margin-top: 4px;
  font-weight: 730;
  font-variant-numeric: tabular-nums;
  line-height: 1.28;
  overflow-wrap: anywhere;
}

.primary-metric dd {
  min-height: 1.28em;
  font-size: clamp(17px, 1.75vw, 22px);
  letter-spacing: -.035em;
}

.other-metrics {
  display: grid;
  grid-template-columns: .75fr 1.25fr;
  gap: 8px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.other-metrics dd { font-size: 15px; }

.daily-panel {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 19px 20px;
  background: var(--panel);
}

.daily-panel h2 { font-size: 16px; }

.daily-panel p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.table-scroll {
  margin-top: 12px;
  overflow-x: auto;
}

.daily-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.daily-panel th, .daily-panel td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.daily-panel thead th {
  background: #edf2eb;
  color: var(--muted);
  font-size: 12px;
}

.daily-panel th:first-child { text-align: left; }
.daily-panel tbody tr:last-child > * { border-bottom: 0; }

@media (max-width: 920px) {
  .metric-card { padding-inline: 15px; }
}

@media (max-width: 650px) {
  .shell { width: calc(100% - 32px); }
  .tabs { margin-top: 16px; }
  .query-panel { padding: 17px; }
  .query-fields { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 8px; }
  .query-fields button { grid-column: 1 / -1; margin-top: 3px; }
  .results { margin-top: 23px; }
  .metrics { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .metric-card { padding-inline: 17px; }
  .daily-panel { padding: 17px; }
  .primary-metric dd { font-size: 21px; }
}

@media (max-width: 390px) {
  .query-fields { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .range-divider { display: none; }
}
