@import url("assets/tokens/tokens.css");

@font-face {
  font-family: "Geist";
  src: url("assets/fonts/geist/Geist-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Geist Mono";
  src: url("assets/fonts/geist-mono/GeistMono-VariableFont_wght.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bd-black: var(--color-black);
  --bd-900: var(--color-gray-900);
  --bd-850: #1b2023;
  --bd-800: var(--color-gray-800);
  --bd-700: var(--color-gray-700);
  --bd-600: var(--color-gray-600);
  --bd-500: var(--color-gray-500);
  --bd-300: var(--color-gray-300);
  --bd-100: var(--color-gray-100);
  --bd-green: var(--color-green-primary);
  --bd-red: #eb5757;
  --bd-yellow: #f2c94c;
  --bd-blue: #5b8def;
  --radius: 16px;
  --radius-sm: 8px;
  --radius-pill: 16px;
  --gap: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  background: var(--bd-black);
  color: var(--bd-100);
  font-family: "Geist", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0;
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { border: 0; background: transparent; color: inherit; cursor: pointer; }
.mono { font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.pos { color: var(--bd-green); }
.neg { color: var(--bd-red); }
.app { max-width: 1440px; margin: 0 auto; padding: 16px; }
/* Body copy = Inter per brand 3-font system (Geist stays for headings/UI/values) */
.brief, .asset-name p, .api-strip span, footer { font-family: "Inter", system-ui, -apple-system, sans-serif; }

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 12px;
  background: var(--bd-900);
  border: 1px solid var(--bd-800);
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.brand-link {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  flex-shrink: 0;
}
.brand-logo {
  display: block;
  width: 136px;
  max-width: 38vw;
  height: auto;
}
.brand-link:hover { opacity: .86; }
.divider-v { width: 1px; height: 24px; background: var(--bd-800); flex-shrink: 0; }
.topbar h1 {
  margin-right: auto;
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: .01em;
}
.topbar h1 span { color: var(--bd-500); font-weight: 500; margin-left: 4px; }
.status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--bd-300);
  font-size: 11.5px;
  white-space: nowrap;
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--bd-yellow);
  box-shadow: 0 0 6px var(--bd-yellow);
  animation: pulse 1.8s ease-in-out infinite;
}
.dot.ok { background: var(--bd-green); box-shadow: 0 0 8px var(--bd-green); }
.dot.bad { background: var(--bd-red); box-shadow: 0 0 8px var(--bd-red); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

.icon-btn, .data-cta, .api-actions button, .api-actions a, .seg button {
  border: 1px solid var(--bd-700);
  background: transparent;
  color: var(--bd-300);
  border-radius: var(--radius-pill);
  transition: background .15s, color .15s, border-color .15s;
}
/* Actual buttons (Primary/Secondary/icon) = 8px per spec; chips/segs/filters stay pill */
.icon-btn, .data-cta, .api-actions button, .api-actions a { border-radius: var(--radius-sm); }
.icon-btn { display: grid; place-items: center; width: 28px; height: 28px; }
.icon { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.data-cta, .api-actions button, .api-actions a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
/* Primary CTA — solid green per brand button spec */
.data-cta, .api-actions button {
  background: var(--bd-green);
  border-color: var(--bd-green);
  color: #15181A;
  font-weight: 600;
}
.data-cta::before, .api-actions button::before { display: none; }
.data-cta:hover, .api-actions button:hover {
  background: var(--color-green-secondary);
  border-color: var(--color-green-secondary);
  color: #0b0f0d;
}
/* Secondary / ghost buttons */
.icon-btn:hover, .api-actions a:hover, .seg button:hover {
  background: var(--bd-800);
  color: var(--bd-100);
  border-color: var(--bd-600);
}

.api-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: var(--gap);
  padding: 10px 12px;
  background: #101416;
  border: 1px solid var(--bd-800);
  border-radius: var(--radius);
}
.api-strip strong {
  display: block;
  margin-bottom: 3px;
  color: var(--bd-100);
  font-size: 13px;
}
.api-strip span {
  color: var(--bd-500);
  font-size: 12px;
}
.api-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.api-actions input, .table-search {
  min-height: 30px;
  background: var(--bd-black);
  border: 1px solid var(--bd-800);
  border-radius: var(--radius-sm);
  color: var(--bd-100);
  outline: 0;
}
.api-actions input {
  width: min(300px, 42vw);
  padding: 6px 9px;
  font-family: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}
.api-actions input:focus, .table-search:focus { border-color: rgba(0,255,163,.5); }

.banner {
  display: none;
  padding: 10px 14px;
  margin-bottom: var(--gap);
  background: #3d0000;
  color: #ffc8c8;
  border: 1px solid #6a2020;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.banner.show { display: block; }

.grid {
  display: grid;
  gap: var(--gap);
  margin-bottom: var(--gap);
  min-width: 0;
}
.hero-grid { grid-template-columns: minmax(0, .42fr) minmax(0, .58fr); }
.chart-grid { grid-template-columns: minmax(0, .58fr) minmax(0, .42fr); align-items: stretch; }
.grid-3 { grid-template-columns: minmax(0, .32fr) minmax(0, .34fr) minmax(0, .34fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }

.card {
  min-width: 0;
  background: var(--bd-900);
  border: 1px solid var(--bd-800);
  border-radius: var(--radius);
  padding: 14px;
}
.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.card-title > div:first-child {
  flex: 1;
  min-width: 0;
}
.card-title > .endpoint-btn {
  align-self: flex-start;
}
.small-chart .card-title h2 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card h2, .card h3 {
  color: var(--bd-500);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.card-title strong {
  display: block;
  margin-bottom: 4px;
  color: var(--bd-100);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.2;
}

.asset-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px;
}
.asset-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.token-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: #fff;
}
.asset-name h2 {
  color: var(--bd-100);
  font-size: 20px;
  line-height: 1.1;
  margin-bottom: 4px;
}
.asset-name p {
  color: var(--bd-300);
  font-size: 13px;
  line-height: 1.55;
}
.brief {
  color: var(--bd-300);
  font-size: 13px;
  line-height: 1.65;
  max-width: 760px;
  padding-top: 2px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  border: 1px solid var(--bd-700);
  border-radius: var(--radius-pill);
  padding: 5px 11px;
  color: var(--bd-300);
  font-size: 11px;
  white-space: nowrap;
}
.mini-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--bd-green);
  box-shadow: 0 0 8px rgba(0,255,163,.75);
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 62px;
  padding: 10px 12px;
  background: var(--bd-800);
  border: 1px solid rgba(227,231,233,.03);
  border-radius: var(--radius-sm);
  text-align: center;
}
.stat .label {
  color: var(--bd-500);
  font-size: 9px;
  line-height: 12px;
  text-transform: uppercase;
  letter-spacing: .075em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.stat .metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 0;
  width: 100%;
}
.stat .value {
  color: var(--bd-100);
  font-size: clamp(15px, 1.18vw, 17px);
  font-weight: 750;
  line-height: 19px;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
  max-width: 100%;
}
.stat small {
  color: var(--bd-500);
  font-size: 10px;
  line-height: 12px;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  white-space: nowrap;
}
.stat small.empty { visibility: hidden; }

.seg {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--bd-800);
  border-radius: var(--radius-pill);
}
.seg button {
  min-height: 28px;
  padding: 0 10px;
  border-color: transparent;
  font-size: 12px;
}
.seg button.active {
  color: var(--bd-100);
  background: var(--bd-800);
  border-color: var(--bd-700);
}

.chart-card { min-height: 360px; }
.main-chart { min-height: 520px; }
.small-chart {
  min-height: 360px;
  display: flex;
  flex-direction: column;
}
.small-chart .card-title {
  flex-shrink: 0;
}
.chart-wrap {
  position: relative;
  height: 450px;
  border: 1px solid var(--bd-800);
  border-radius: var(--radius-sm);
  background: #101416;
  overflow: hidden;
}
.small-chart .chart-wrap {
  flex: 1;
  height: auto;
  min-height: 290px;
}
.chart-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

.holder-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 12px;
}
.holder-map-wrap {
  position: relative;
  height: 420px;
  border: 1px solid var(--bd-800);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #101416;
}
.holder-map-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.tooltip {
  position: absolute;
  z-index: 5;
  display: none;
  min-width: 210px;
  pointer-events: none;
  background: rgba(9,11,12,.94);
  border: 1px solid var(--bd-700);
  border-radius: var(--radius-sm);
  padding: 9px 10px;
  color: var(--bd-300);
  font-size: 11px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
}
.tooltip strong { display: block; margin-bottom: 5px; color: var(--bd-100); font-size: 12px; }
.tooltip span { display: flex; justify-content: space-between; gap: 18px; margin-top: 3px; }

.summary-stack {
  display: grid;
  gap: 8px;
  align-content: start;
}
.holder-layout .summary-stack {
  align-content: stretch;
  grid-template-rows: repeat(4, 1fr);
}
.summary-item {
  display: grid;
  grid-template-rows: minmax(14px, auto) minmax(22px, auto);
  align-content: center;
  gap: 4px;
  min-height: 64px;
  padding: 11px 12px;
  background: var(--bd-800);
  border: 1px solid rgba(227,231,233,.03);
  border-radius: var(--radius-sm);
}
.holder-layout .summary-item {
  justify-content: center;
  min-height: 0;
}
.summary-item span {
  display: block;
  color: var(--bd-500);
  font-size: 9.5px;
  line-height: 1.25;
  text-transform: uppercase;
  letter-spacing: .075em;
}
.summary-item strong {
  display: block;
  color: var(--bd-100);
  font-size: 16px;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.table-title { align-items: center; }
.table-search {
  width: 170px;
  padding: 6px 9px;
  color: var(--bd-100);
  font-size: 12px;
}
.table-wrap {
  overflow: auto;
  max-height: 420px;
  border: 1px solid var(--bd-800);
  border-radius: var(--radius-sm);
}
table { width: 100%; min-width: 620px; border-collapse: collapse; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--bd-800);
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
}
th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #101416;
  color: var(--bd-500);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .06em;
  text-transform: uppercase;
}
td { color: var(--bd-300); }
tr:last-child td { border-bottom: 0; }
.right { text-align: right; }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  margin: 1px 4px 1px 0;
  padding: 2px 6px;
  color: #09100d;
  background: var(--bd-green);
  border-radius: 3px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.2;
}

.endpoint-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 4px 11px;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: .03em;
  color: var(--bd-blue);
  border: 1px solid rgba(91,141,239,.35);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.endpoint-btn::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bd-blue);
  box-shadow: 0 0 6px rgba(91,141,239,.55);
}
.endpoint-btn:hover {
  background: rgba(91,141,239,.12);
  color: var(--bd-100);
  border-color: var(--bd-blue);
}
.endpoint-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 9px;
}
.title-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 4px;
  color: var(--bd-500);
  font-size: 12px;
}
.footer-link { color: var(--bd-300); transition: color .15s; }
.footer-link:hover { color: var(--bd-green); }
.footer-brand {
  color: var(--bd-green);
  font-weight: 750;
}

/* ── Aggregated Liquidity card ── */
.liq-grid { grid-template-columns: minmax(0, .62fr) minmax(0, .38fr); align-items: stretch; }
.liq-main { display: flex; flex-direction: column; }
.liq-main .liq-chartwrap { flex: 1; height: auto; min-height: 300px; }

.seg button .livedot {
  display: none; width: 6px; height: 6px; border-radius: 50%; background: var(--bd-green);
  margin-right: 5px; vertical-align: middle; box-shadow: 0 0 0 0 rgba(0,255,163,.6); animation: livepulse 1.6s infinite;
}
.seg button.islive .livedot { display: inline-block; }
.seg button .lock { font-size: 9px; margin-left: 3px; opacity: .85; }

.liq-stats { display: flex; align-items: center; flex-wrap: wrap; row-gap: 12px; margin: 4px 0 12px; }
.liq-stat { display: flex; flex-direction: column; gap: 5px; padding: 0 20px; }
.liq-stat:first-child { padding-left: 0; }
.liq-stat .k { font-size: 10px; letter-spacing: .07em; text-transform: uppercase; color: var(--bd-500); display: inline-flex; align-items: center; }
.liq-stat .vrow { display: flex; align-items: center; gap: 10px; }
.liq-stat .v { font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -.01em; color: var(--bd-100); font-variant-numeric: tabular-nums; }
.liq-stat.exit { border-left: 2px solid var(--bd-blue); padding-left: 18px; }
.liq-stat.exit .v { font-size: 20px; color: var(--bd-blue); }
.liq-badges { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.delta { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: var(--radius-pill); }
.delta.pos { color: var(--bd-green); background: rgba(0,255,163,.1); }
.delta.neg { color: var(--bd-red); background: rgba(235,87,87,.12); }
.liq-mode.snap .mini-dot { background: var(--bd-yellow); box-shadow: none; }
.liq-mode.live .mini-dot { background: var(--bd-green); box-shadow: 0 0 0 0 rgba(0,255,163,.6); animation: livepulse 1.6s infinite; }
@keyframes livepulse { 0% { box-shadow: 0 0 0 0 rgba(0,255,163,.5); } 70% { box-shadow: 0 0 0 7px rgba(0,255,163,0); } 100% { box-shadow: 0 0 0 0 rgba(0,255,163,0); } }

.info {
  display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px;
  border-radius: 50%; border: 1px solid var(--bd-600); color: var(--bd-300); font-size: 9px; font-weight: 700;
  cursor: help; position: relative; margin-left: 5px; font-family: "Geist Mono", monospace; letter-spacing: normal; text-transform: none;
}
.info:hover, .info:focus, .info.open { border-color: var(--bd-green); color: var(--bd-green); outline: none; }
.info-pop {
  display: none; position: absolute; top: calc(100% + 10px); left: 50%; transform: translateX(-50%);
  width: 270px; max-width: min(300px, 80vw); background: #0d1012; border: 1px solid var(--bd-700);
  border-radius: var(--radius-sm); padding: 11px 13px; font-family: "Inter", sans-serif; font-size: 11.5px;
  line-height: 1.55; color: var(--bd-300); font-weight: 400; letter-spacing: normal; text-transform: none;
  z-index: 30; box-shadow: 0 12px 30px rgba(0,0,0,.55);
}
.info-pop b { color: var(--bd-green); }
.info-pop .src { display: block; margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--bd-800); color: var(--bd-500); font-size: 10px; }
.info-pop::after { content: ""; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); border: 6px solid transparent; border-bottom-color: var(--bd-700); }
.info:hover .info-pop, .info:focus .info-pop, .info.open .info-pop { display: block; }

.liq-legend { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; margin: 12px 0 0; font-size: 12px; color: var(--bd-300); }
.liq-legend span { display: inline-flex; gap: 7px; align-items: center; cursor: pointer; user-select: none; }
.liq-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.liq-legend span.off { opacity: .4; text-decoration: line-through; }

.keyhint { margin-top: 10px; font-size: 11.5px; color: var(--bd-yellow); background: rgba(242,201,76,.08); border: 1px solid rgba(242,201,76,.25); border-radius: var(--radius-sm); padding: 8px 11px; display: none; }
.keyhint.show { display: block; }

.liq-pools { display: flex; flex-direction: column; }
.pool-list { margin-top: 6px; display: flex; flex-direction: column; gap: 14px; flex: 1; justify-content: center; }
.pool-row { display: flex; flex-direction: column; gap: 6px; }
.pool-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pool-meta { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.pool-src { font-size: 12px; color: var(--bd-300); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-addr { font-size: 10.5px; color: var(--bd-500); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; width: max-content; }
.pool-addr:hover { color: var(--bd-green); text-decoration: underline; }
.pool-addr .ext { font-size: 9px; opacity: .7; }
.pool-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--bd-100); white-space: nowrap; }
.pool-bar { height: 8px; background: var(--bd-black); border: 1px solid var(--bd-800); border-radius: 999px; overflow: hidden; }
.pool-bar span { display: block; height: 100%; border-radius: 999px; transition: width .35s ease; }

@media (max-width: 1180px) {
  .hero-grid, .chart-grid, .liq-grid, .grid-3, .grid-2, .api-strip { grid-template-columns: 1fr; }
  .api-actions { justify-content: flex-start; }
  .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app { padding: 12px; }
  .topbar { align-items: flex-start; }
  .brand-logo { width: 128px; }
  .asset-head { grid-template-columns: auto minmax(0, 1fr); }
  .asset-head .chip { grid-column: 1 / -1; justify-self: start; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-title {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .card-title > .endpoint-btn,
  .card-title > .title-actions {
    justify-self: start;
  }
  .title-actions {
    flex-wrap: wrap;
  }
  .holder-layout { grid-template-columns: 1fr; }
  .holder-map-wrap { height: 380px; }
  .chart-wrap { height: 360px; }
  .small-chart .chart-wrap { height: 280px; }
  .api-actions input, .table-search { width: 100%; }
}

@media (max-width: 460px) {
  .stat-row { grid-template-columns: 1fr; }
  .holder-map-wrap { height: 330px; }
}
