/* Backpack Dashboard — brand-aligned redesign
   Monochrome-dominant · Backpack red (#E33E3F) used sparingly (logo, CTAs, $BP/Backpack data)
   Space Grotesk + Inter + JetBrains Mono (tabular numerals) */

:root {
  color-scheme: dark;

  /* Surfaces — near-black, faintly warm */
  --bg: #0b0a0b;
  --bg-2: #0e0d0f;
  --panel: #151318;
  --panel-2: #1b1822;
  --panel-3: #221e2b;
  --sunken: #0a090c;

  /* Lines */
  --border: #2a2630;
  --border-soft: rgba(255, 255, 255, .07);
  --hair: rgba(255, 255, 255, .045);

  /* Ink */
  --text: #f3f1ee;
  --muted: #a39daa;
  --muted-2: #6f6878;

  /* Accent = coral / red-orange — used sparingly: CTAs, $BP/Backpack data.
     Fill tone is slightly deeper so white button text stays legible (3.3:1);
     brighter tone is reserved for strokes on the near-black background.
     (The Backpack logo itself stays its native red #E33E3F.) */
  --bp: #f15c34;          /* CTA / fill — white text on this passes for bold */
  --bp-strong: #ff6a45;   /* hover + on-dark data, the chosen coral */
  --bp-bright: #ff7d5c;   /* thin strokes on dark where luminance helps */
  --bp-deep: #d44a26;
  --bp-ink: #1c0708;
  --bp-glow: rgba(241, 92, 52, .2);

  /* Neutral interactive states (monochrome-dominant, like backpack.exchange) */
  --pill-on: #f3f1ee;
  --pill-on-ink: #16141a;
  --focus-ring: rgba(255, 255, 255, .1);
  --hover-line: rgba(255, 255, 255, .24);

  /* Data series (kept distinct from brand red) */
  --blue: #5b9dff;     /* xStocks / stake-adjacent */
  --violet: #8aa0ff;   /* stake-ratio line */
  --green: #36d39a;    /* Ondo / positive */
  --red: #ff5c5c;      /* negative */

  --shadow: 0 22px 60px rgba(0, 0, 0, .5);
  --shadow-card: 0 12px 30px rgba(0, 0, 0, .28);

  --radius: 4px;
  --radius-lg: 6px;

  --font-display: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

html { background: var(--bg); scroll-behavior: smooth; }

/* Anchor targets clear the sticky masthead when jumped to from the nav. */
#sec-price, #insights-panel, #volume-panel, #sec-stocks, #sec-about {
  scroll-margin-top: 104px;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 50% -12%, rgba(255, 255, 255, .035), transparent 34rem),
    linear-gradient(180deg, #0c0b0d 0%, #0b0a0b 56%, #0a090c 100%);
  color: var(--text);
  font: 14px/1.55 var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* Quality floor: a single, consistent keyboard-focus ring across all controls. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--bp-strong);
  outline-offset: 2px;
  border-radius: var(--radius);
}

/* Tabular mono numerals for all financial data */
.metric-row strong,
.metric-row em,
.rank-value,
.rank-row strong,
.issuer-summary strong,
.volume-card-value,
.volume-card-head strong,
.calc-results strong,
.stock .px,
.stock .ref,
.health-row em,
.updated {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

/* --------------------------------------------------------------- masthead */
/* Topbar + section nav travel together as one sticky unit, so anchor jumps
   never hide under it (sections use scroll-margin-top = --masthead-h). */
.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(11, 10, 11, .82);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-soft);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 24px;
}

.section-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 16px;
  border-top: 1px solid var(--hair);
  overflow-x: auto;
  scrollbar-width: none;
}

.section-nav::-webkit-scrollbar { display: none; }

.section-nav a {
  position: relative;
  flex: none;
  padding: 11px 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: .02em;
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s ease;
}

.section-nav a:hover { color: var(--text); }

.section-nav a.active { color: var(--text); }

.section-nav a.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--bp-strong);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: max-content;
  gap: 11px;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.01em;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
}

.brand-mark img {
  width: 28px;
  height: 28px;
  display: block;
}

.top-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.top-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
}

.top-links a:hover { color: var(--text); }

.top-links .top-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  background: #ffffff;
  color: #16141a;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}

.top-links .top-cta:hover {
  color: #16141a;
  background: #ece8e2;
}

.top-links .made-by { color: var(--muted); }
.top-links .made-by:hover { color: var(--text); }

/* The language picker is styled exactly like the chart range selects —
   it only overrides visibility (.range-select is desktop-hidden; the
   extra `select` in the selector outweighs that rule regardless of
   order) and pins a narrow width: without it the closed control sizes
   to the longest option ("Español (Latinoamérica)"). The open list
   still shows full labels. */
select.lang-select {
  display: inline-flex;
  width: 84px;
  min-width: 0;
  text-overflow: ellipsis;
}

.updated {
  color: var(--muted-2);
  font-size: 12px;
  white-space: nowrap;
}

main {
  width: min(100%, 1360px);
  margin: 0 auto;
  padding: 12px 24px 24px;
}

/* ------------------------------------------------------------------ hero */
.dashboard-hero {
  display: block;
  padding: 6px 0 22px;
}

/* Live ticker board — the hero as the subject's own vernacular */
.ticker {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0)), var(--panel);
  padding: 20px 22px 18px;
  box-shadow: var(--shadow-card);
}

/* First-paint loading: real values are masked as shimmer bars until data lands.
   The placeholder text sets each bar's width; reduced-motion drops the shimmer. */
.ticker.loading .ticker-price,
.ticker.loading .ticker-change,
.ticker.loading .ticker-stat span,
.ticker.loading .ticker-stat strong {
  color: transparent;
  border-radius: 4px;
  background: linear-gradient(100deg, var(--panel-2) 30%, var(--panel-3) 50%, var(--panel-2) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { background-position: 130% 0; }
  100% { background-position: -130% 0; }
}

.ticker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ticker-pair {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--text);
}

.ticker-pair-quote { color: var(--muted-2); }

.ticker-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .1em;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.ticker-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2.4s ease-out infinite;
}

.ticker-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px 36px;
  margin: 18px 0 0;
}

.ticker-price-block {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px 18px;
  min-width: 0;
}

.ticker-price {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(22px, 3.5vw, 40px);
  font-weight: 600;
  line-height: .9;
  letter-spacing: -.03em;
  color: var(--text);
}

/* Price tick: the number itself flashes up/down on each live update, then
   settles back to white — the print-flash vernacular of an exchange ticker. */
.ticker-price.tick-up { animation: tickUp .7s ease-out; }
.ticker-price.tick-down { animation: tickDown .7s ease-out; }

@keyframes tickUp {
  0%, 18% { color: var(--green); }
  100% { color: var(--text); }
}

@keyframes tickDown {
  0%, 18% { color: var(--red); }
  100% { color: var(--text); }
}

.ticker-change {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
}

.ticker-change.up { color: var(--green); }
.ticker-change.down { color: var(--red); }

.ticker-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 26px;
}

.ticker-stat {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.ticker-stat + .ticker-stat {
  padding-left: 26px;
  border-left: 1px solid var(--hair);
}

.ticker-stat span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
}

.ticker-stat strong {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 19px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .ticker-stat + .ticker-stat { padding-left: 0; border-left: 0; }
  .ticker-stats { gap: 12px 22px; }
}

@media (max-width: 480px) {
  .ticker { padding: 16px; }
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.conversion h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -.025em;
}

.lead {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(54, 211, 154, .45); }
  70% { box-shadow: 0 0 0 7px rgba(54, 211, 154, 0); }
  100% { box-shadow: 0 0 0 0 rgba(54, 211, 154, 0); }
}

.insight-box,
.issuer-summary,
.volume-card,
.stock,
.calculator,
.conversion-copy,
.notice {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, .025), rgba(255, 255, 255, 0)), var(--panel);
}

.up { color: var(--green); }
.down { color: var(--red); }

/* ------------------------------------------------------------------ panel */
.panel {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(21, 19, 24, .8);
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.panel-head h2,
.comparison-title {
  margin: 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
}

.sub {
  color: var(--muted);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
}

.range,
.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chart-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.range button,
.counts span {
  min-height: 31px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}

.range button { cursor: pointer; transition: border-color .15s ease, color .15s ease, background .15s ease; }

.range button:hover {
  border-color: var(--hover-line);
  color: var(--text);
}

.range button.active {
  border-color: transparent;
  background: var(--pill-on);
  color: var(--pill-on-ink);
}

.range-select {
  display: none;
  height: 34px;
  min-width: 62px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 650;
  outline: none;
  padding: 0 8px;
}

.counts span { cursor: default; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.icon-button:hover,
.icon-button[aria-expanded="true"] {
  border-color: var(--hover-line);
  color: var(--text);
}

.tweet-copy-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 106, 69, .42);
  border-radius: var(--radius);
  background: rgba(255, 106, 69, .12);
  color: #ffd1c4;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.tweet-copy-button:hover {
  border-color: rgba(255, 106, 69, .72);
  color: #fff2ed;
}

.tweet-copy-button:disabled {
  cursor: wait;
  opacity: .72;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 28px));
  padding: 12px 14px;
  border: 1px solid rgba(54, 211, 154, .4);
  border-radius: var(--radius);
  background: rgba(17, 15, 20, .96);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .36);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
}

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

.toast.ok {
  border-color: rgba(54, 211, 154, .44);
}

.toast.error {
  border-color: rgba(255, 92, 92, .5);
}

.axis-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(116px, 1fr)) auto auto minmax(120px, .8fr);
  gap: 8px;
  align-items: end;
  margin: -2px 0 16px;
}

.axis-controls[hidden] { display: none; }

.axis-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .03em;
}

.axis-controls input,
.calculator input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--sunken);
  color: var(--text);
  font-family: var(--font-mono);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

.axis-controls input { padding: 8px 9px; }

.axis-controls input:focus,
.calculator input:focus {
  border-color: rgba(255, 255, 255, .32);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.axis-controls button {
  min-height: 37px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.axis-controls button:hover { border-color: var(--hover-line); }

.axis-controls #axis-apply {
  border-color: transparent;
  background: var(--pill-on);
  color: var(--pill-on-ink);
}

.axis-controls #axis-apply:hover { filter: brightness(.94); }

.axis-status {
  min-height: 20px;
  padding-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
}

.axis-status.error { color: var(--red); }

.chart-wrap,
.volume-chart-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(10, 9, 12, .5), rgba(10, 9, 12, .2));
}

.chart-wrap canvas,
.volume-chart-wrap canvas {
  display: block;
  max-width: 100%;
}

.chart-wrap {
  height: 380px;
  padding: 10px;
}

.unstake-panel {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}

.unstake-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.unstake-head h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.unstake-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.unstake-head-follow {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border-soft);
}

.unstake-method {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid rgba(138, 160, 255, .28);
  border-radius: var(--radius);
  background: rgba(138, 160, 255, .1);
  color: #c6d0ff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.unstake-controls {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.unstake-range {
  flex-wrap: nowrap;
}

.unstake-range button {
  min-width: 38px;
  min-height: 29px;
  padding: 0 9px;
}

.unstake-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  height: 312px;
}

.unstake-kpis {
  display: grid;
  min-height: 100%;
  grid-auto-rows: 1fr;
  gap: 8px;
}

.unstake-kpi {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: rgba(17, 15, 20, .72);
}

.unstake-kpi span,
.unstake-kpi em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
}

.unstake-kpi strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.unstake-kpi em { margin-top: 4px; }

.unstake-kpi strong.kpi-up { color: #36d39a; }
.unstake-kpi strong.kpi-down { color: #ff5c5c; }

.unstake-chart-wrap {
  position: relative;
  min-width: 0;
  height: 100%;
  padding: 10px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(10, 9, 12, .5), rgba(10, 9, 12, .2));
}

.risk-note {
  margin: -4px 0 16px;
  padding-left: 11px;
  border-left: 2px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.bucket-title {
  margin: 20px 0 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ stocks */
.stock-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.stock-actions {
  display: flex;
  grid-column: 1 / -1;
  justify-content: center;
  padding-top: 2px;
}

.more-button {
  min-height: 34px;
  padding: 0 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.more-button:hover {
  border-color: var(--hover-line);
  color: var(--text);
}

.stock {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 10px;
  color: inherit;
  text-decoration: none;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.stock:hover {
  transform: translateY(-1px);
  border-color: var(--hover-line);
  background: var(--panel-2);
}

.stock img,
.stock-logo-fallback {
  flex: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--sunken);
  object-fit: cover;
}

.stock-logo-fallback {
  display: inline-grid;
  place-items: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.stock .meta { min-width: 0; }

.sym-row {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
}

.stock .sym {
  font-family: var(--font-display);
  font-weight: 600;
}

/* Issuer tag (all are Backpack Securities) — shown on mobile, where the full
   name line is hidden, so the compact card still names the issuer. */
.stock-issuer {
  display: none;
  flex: none;
  padding: 1px 5px;
  border: 1px solid rgba(227, 62, 63, .4);
  border-radius: 3px;
  color: var(--bp-strong);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
}

.stock .nm,
.volume-card-name,
.volume-card-meta,
.issuer-summary em,
.rank-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stock .nm {
  color: var(--muted);
  font-size: 12px;
}

.stock .px {
  margin-top: 3px;
  font-size: 13px;
}

.stock .ref {
  color: var(--muted);
  font-size: 11px;
}

.liq-badge,
.issuer {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--muted);
  white-space: nowrap;
}

.liq-badge {
  padding: 3px 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.liq-badge.deep,
.liq-badge.good {
  border-color: rgba(54, 211, 154, .45);
  color: var(--green);
}

.liq-badge.thin,
.liq-badge.very-thin {
  border-color: var(--border);
  color: var(--muted);
}

.liq-badge.inactive { color: var(--muted-2); }

.empty {
  padding: 10px 0;
  color: var(--muted);
  font-style: italic;
}

/* --------------------------------------------------------- volume / TVL */
/* Issuer-markets tabs — one dense panel split into Volume / TVL / History. */
.volume-tabs {
  display: flex;
  gap: 2px;
  margin: -2px 0 16px;
  border-bottom: 1px solid var(--border-soft);
}

.vtab {
  position: relative;
  padding: 9px 14px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
}

.vtab:hover { color: var(--text); }
.vtab.active { color: var(--text); }

.vtab.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--bp-strong);
}

.tab-pane { display: none; }

.tab-pane.is-active {
  display: grid;
  gap: 14px;
}

.volume-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
}

.volume-chart-wrap {
  height: 360px;
  padding: 10px;
}

.history-chart-wrap { height: 360px; }

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

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
}

.legend-item i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

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

.issuer-summary {
  min-width: 0;
  padding: 13px;
  border-left-width: 2px;
}

.issuer-summary span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .03em;
}

.issuer-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.1;
}

.issuer-summary em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
}

.issuer-summary.backpack,
.volume-card.backpack { border-left-color: var(--bp); }
.issuer-summary.xstocks,
.volume-card.xstocks { border-left-color: var(--blue); }
.issuer-summary.ondo,
.volume-card.ondo { border-left-color: var(--green); }

.volume-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.volume-card {
  min-width: 0;
  padding: 12px;
  color: inherit;
  text-decoration: none;
  border-left-width: 2px;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.volume-card:hover {
  transform: translateY(-1px);
  background: var(--panel-2);
  border-color: var(--hover-line);
}

.volume-card-main {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
}

.volume-logo {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--sunken);
  object-fit: cover;
}

.volume-card-copy { min-width: 0; }

.volume-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.volume-card-head strong {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
}

.volume-card-name {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.volume-card-value {
  margin-top: 10px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.1;
}

.volume-card-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.issuer {
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .02em;
}

.issuer.backpack {
  border-color: rgba(255, 106, 69, .5);
  color: var(--bp-strong);
}

.issuer.xstocks {
  border-color: rgba(91, 157, 255, .45);
  color: var(--blue);
}

.issuer.ondo {
  border-color: rgba(54, 211, 154, .45);
  color: var(--green);
}

.history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.history-range { justify-content: flex-end; }

.history-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
  min-width: 0;
  max-width: 100%;
}

.tab-pane,
.history-chart-panel {
  min-width: 0;
  max-width: 100%;
}

/* --------------------------------------------------- market intelligence */
.market-pill {
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.market-pill.open {
  border-color: rgba(54, 211, 154, .45);
  color: var(--green);
}

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

.insight-box {
  min-width: 0;
  padding: 14px;
}

.insight-box h3 {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

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

.metric-row,
.health-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: baseline;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hair);
}

.metric-row:last-child,
.health-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.metric-row span,
.health-row span {
  min-width: 0;
  color: var(--muted);
}

.health-label small {
  display: block;
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.25;
}

.metric-row strong,
.health-row strong {
  font-size: 14px;
  font-weight: 600;
}

.metric-row em,
.health-row em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  white-space: nowrap;
  text-align: right;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--hair);
}

.rank-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.rank-row strong {
  display: block;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
}

.rank-row span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.rank-value {
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.rank-detail {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.health-row .ok { color: var(--green); }
.health-row .warn { color: var(--red); }

.health-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.health-counts span {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ------------------------------------------------------------- two-col */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

#info-body .fact {
  display: flex;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--hair);
  font-size: 13px;
}

#info-body .fact .k {
  flex: none;
  width: 150px;
  color: var(--muted);
}

#info-body .fact .v {
  min-width: 0;
  word-break: break-all;
}

#info-body p { color: var(--text); }

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.links a {
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.links a:hover { color: var(--text); }

.notice {
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* Non-destructive per-panel error banner (toggled by show/clearPanelNotice). */
.panel-error {
  margin: 0 0 14px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 92, 92, .4);
  border-left: 2px solid var(--red);
  border-radius: var(--radius);
  background: rgba(255, 92, 92, .08);
  color: var(--text);
  font-size: 12px;
}

.panel-error[hidden] { display: none; }

.dashboard-hero .panel-error { margin: 0 0 10px; }

/* ---------------------------------------------------------- conversion */
.conversion {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 18px;
}

.bottom-conversion {
  margin-top: 20px;
  margin-bottom: 0;
}

.conversion-copy,
.calculator { padding: 20px; }

.conversion-copy {
  position: relative;
  overflow: hidden;
  border-left: 2px solid var(--bp);
}

.conversion h1 {
  font-size: clamp(24px, 2.5vw, 36px);
  line-height: 1.1;
}

.cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.primary-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: var(--radius);
  background: #ffffff;
  color: #16141a;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .4);
  transition: background .15s ease, transform .15s ease;
}

.primary-cta:hover {
  background: #ece8e2;
  transform: translateY(-1px);
}

.primary-cta.disabled {
  pointer-events: none;
  opacity: .5;
  box-shadow: none;
}

.cta-logo {
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  object-fit: contain;
  vertical-align: -3px;
}

.top-cta .cta-logo {
  width: 16px;
  height: 16px;
}

.disclosure {
  max-width: 460px;
  color: var(--muted);
  font-size: 12px;
}

.calculator {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.calc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.calc-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}

.calc-head span {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.calculator label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.calculator input { padding: 10px; }

.calc-results {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.calc-results div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--sunken);
}

.calc-results span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.calc-results strong {
  display: block;
  margin-top: 3px;
  font-size: 15px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.calc-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

/* --------------------------------------------------------- responsive */
@media (max-width: 1120px) {
  .axis-controls { grid-template-columns: repeat(4, minmax(100px, 1fr)); }
  .axis-status { padding-bottom: 0; }
}

@media (max-width: 940px) {
  .conversion,
  .history-chart-grid,
  .two-col { grid-template-columns: 1fr; }

  .insight-grid { grid-template-columns: 1fr; }

  .chart-wrap,
  .volume-chart-wrap { height: 300px; }

  .history-chart-wrap { height: 300px; }
}

@media (max-width: 720px) {
  .topbar {
    align-items: center;
    padding: 12px 16px;
    gap: 12px;
  }

  .brand {
    min-width: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  .brand [data-i18n="brand"] {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-links {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 0;
  }

  .top-links .top-cta,
  .top-links .made-by,
  .updated {
    display: none;
  }

  main { padding: 6px 14px 18px; }

  .dashboard-hero { padding: 4px 0 16px; }

  #sec-price .panel-head {
    flex-wrap: nowrap;
    gap: 8px;
  }

  #sec-price .panel-head h2 {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
  }

  #sec-price .chart-tools {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 6px;
  }

  #range-buttons {
    display: none;
  }

  #unstake-bucket-range,
  #unstake-flow-range,
  #volume-history-range {
    display: none;
  }

  .range-select {
    display: inline-flex;
  }

  .axis-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  .calc-results { grid-template-columns: 1fr; }

  .axis-status { grid-column: 1 / -1; }

  .panel,
  .conversion-copy,
  .calculator { padding: 15px; }

  .unstake-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
  }

  .unstake-head > div:first-child {
    flex: 1 1 auto;
    min-width: 0;
  }

  .unstake-head h3 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
  }

  .unstake-head p,
  .unstake-method {
    display: none;
  }

  .unstake-controls {
    flex: 0 0 auto;
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
  }

  .history-head {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
  }

  .history-head .comparison-title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
  }

  #tab-history,
  #tab-history .history-chart-grid,
  #tab-history .history-chart-panel,
  #tab-history .volume-chart-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .unstake-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .unstake-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 7px;
  }

  .unstake-kpi {
    padding: 9px;
  }

  .unstake-kpi strong {
    font-size: 13px;
  }

  .unstake-chart-wrap {
    height: 240px;
  }

  .issuer-summary-grid,
  .volume-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

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

  .issuer-summary,
  .stock,
  .volume-card {
    padding: 9px;
  }

  .issuer-summary span,
  .issuer-summary em {
    font-size: 10px;
  }

  .issuer-summary strong {
    font-size: 11px;
    white-space: nowrap;
  }

  .stock {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
    min-height: 0;
    padding: 7px;
  }

  .stock img,
  .stock-logo-fallback,
  .volume-logo {
    width: 24px;
    height: 24px;
  }

  .stock .meta {
    width: 100%;
    min-width: 0;
  }

  .sym-row {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 0;
  }

  .stock-issuer,
  .stock .liq-badge {
    display: none;
  }

  .stock .sym,
  .volume-card-head strong {
    font-size: 12px;
  }

  .stock .sym {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stock .nm,
  .volume-card-name,
  .volume-card-meta {
    display: none;
  }

  .stock .px {
    grid-column: 1 / -1;
    display: block;
    margin-top: 3px;
    color: var(--text);
    font-size: 9px;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .stock .px span {
    display: none;
  }

  .stock .ref {
    display: none;
  }

  .liq-badge,
  .issuer {
    width: fit-content;
    padding: 2px 4px;
    font-size: 8px;
  }

  /* Compact volume/TVL token cards: logo + symbol on one row, value tucked
     under it. The issuer badge is dropped — the card's colored left border
     and the chart legend already encode the issuer. */
  .volume-card {
    padding: 8px;
  }

  .volume-card-main {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 0 7px;
    align-items: center;
  }

  .volume-card-head .issuer {
    display: none;
  }

  .volume-card-value {
    margin-top: 1px;
    font-size: 12px;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }

  #info-body .fact { display: grid; gap: 2px; }

  #info-body .fact .k { width: auto; }
}

@media (max-width: 480px) {
  .topbar {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
  }

  .brand {
    gap: 8px;
    font-size: 13px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
    flex: 0 0 auto;
  }

  .top-links { justify-content: flex-end; }

  .top-links .made-by,
  .updated { display: none; }


  .primary-cta { width: 100%; }

  .chart-wrap,
  .volume-chart-wrap { height: 300px; }
}

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