/* ════════════════════════════════════════════════════════════════════
   Token DD tab — ticker search, risk-card layout, per-CEX table.
   Reuses the shared `.card` / `.datatable` / `.chart-wrap` primitives;
   only the search-row + KPI tile + chip styling are new.
   ════════════════════════════════════════════════════════════════════ */

/* Search row: ticker badge (mirrors the deal-card pattern) + button +
   status pill on one line, suggest box hangs underneath. */
.tdd-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* Bigger than the in-card deal badge so it carries the visual weight of
   a primary search input. The .ticker-input / .symbol-input styles from
   css/pages/deals.css already do the typography + color binding via the
   `--ticker-color` variable we set in JS. */
.tdd-ticker-badge {
  padding: 8px 12px;
  gap: 10px;
}
.tdd-ticker-badge .ticker-input {
  width: 120px;
  font-size: 18px;
}
.tdd-ticker-badge .symbol-arrow {
  font-size: 16px;
}
.tdd-ticker-badge .symbol-input {
  width: 140px;
  font-size: 13px;
}

.tdd-search-row #tdd-status.err  { color: var(--neg); }
.tdd-search-row #tdd-status.warn { color: var(--warn, var(--muted-foreground)); }
.tdd-search-row #tdd-status.ok   { color: var(--pos); }

/* Search hint — sits below the badge to communicate the live-search
   affordance without fighting the badge's uppercase styling. */
.tdd-search-hint {
  margin-top: 6px;
  font-style: italic;
}

/* ── Pipeline progress: snake-border on the search card ─────────────
   The multi-provider fetch streams ndjson per-task events (~17 calls,
   ~10-15s cold cache). Instead of a separate progress bar, we trace
   the search card's perimeter clockwise from top-left — at 100% the
   stroke wraps fully around. Color ramps red→orange→green via a CSS
   variable JS sets per tick. On completion the line pulses once
   (brightness flash), then fades out gracefully. */
.tdd-search-card {
  /* Required for the absolute-positioned SVG overlay below. The base
     .card class doesn't always set position:relative, so we pin it. */
  position: relative;
}
.tdd-snake-border {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* Hidden by default; .is-loading toggles it on, .is-complete fades
     it back out after the pulse. Opacity is the only thing animating
     during the fade — the path's stroke-dashoffset is held at "fully
     drawn" until the fade is fully complete (handled in JS), so we
     never see a "snake retracting" residue while the overlay fades. */
  opacity: 0;
  transition: opacity 600ms ease-out;
  /* Sit above the card's background but below interactive content
     (the input, the suggest dropdown). The overlay is pointer-events:
     none anyway so this is just paint order. */
  z-index: 1;
  /* Path coords are pixel-accurate (set via viewBox in JS); no aspect
     stretching. */
  overflow: visible;
}
/* Card-agnostic — any card can host the snake by getting `.is-loading`
   or `.is-complete` toggled on its root. Originally scoped to
   .tdd-search-card; generalised so the funding scanner's pipeline
   progress bento (`.fsc-progress-card`) gets the same chrome. */
.is-loading > .tdd-snake-border,
.is-complete > .tdd-snake-border {
  opacity: 1;
}
.is-complete > .tdd-snake-border {
  /* Pulse is brief; fade kicks in after it via JS removing .is-complete. */
  animation: tdd-snake-pulse 700ms ease-out;
}
.tdd-snake-fill {
  fill: none;
  /* Default to red; updated via JS on each progress tick. The CSS
     custom property makes the JS update side-effect-free (no inline
     style accumulation). */
  stroke: var(--snake-color, #e57373);
  stroke-width: 2.5;
  stroke-linecap: round;
  /* pathLength=100 on the rect makes these values readable as percent. */
  stroke-dasharray: 100;
  stroke-dashoffset: calc(100 - var(--snake-progress, 0));
  /* Smooth fill advance — matches the 220ms cadence we used on the
     old strip so users who saw both feel the same rhythm. */
  transition: stroke-dashoffset 220ms ease-out, stroke 220ms linear;
  /* Soft glow that intensifies with the brighter green at completion —
     drop-shadow on currentColor would need a filter chain, so we use
     stroke-painted glow via the SVG itself. Browsers without filter
     support gracefully degrade to a flat line. */
  filter: drop-shadow(0 0 4px var(--snake-color, #e57373));
}
@keyframes tdd-snake-pulse {
  /* One brightness flash + a hair-stroke-width bump so the wrap-around
     completion reads as a "yep, done" beat rather than just stopping.
     Brightness 1 → 1.6 → 1 over the duration; stroke widens slightly
     at peak. */
  0%   { filter: drop-shadow(0 0 4px var(--snake-color, #3eb489)) brightness(1); stroke-width: 2.5; }
  40%  { filter: drop-shadow(0 0 12px var(--snake-color, #3eb489)) brightness(1.6); stroke-width: 3.5; }
  100% { filter: drop-shadow(0 0 4px var(--snake-color, #3eb489)) brightness(1); stroke-width: 2.5; }
}

/* Suggest dropdown — renders below the input. Cap height at ~5 rows.
   Explicit scrollbar styling makes the "scroll for more" affordance
   discoverable even on macOS where overlay scrollbars hide by default. */
.tdd-suggest {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-elevated);
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.tdd-suggest::-webkit-scrollbar { width: 8px; }
.tdd-suggest::-webkit-scrollbar-track { background: transparent; }
.tdd-suggest::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
.tdd-suggest::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); background-clip: padding-box; border: 2px solid transparent; }
.tdd-suggest-item {
  display: grid;
  grid-template-columns: 24px 70px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  color: var(--text);
  /* Snappy interaction feedback. Background + box-shadow hint at the
     hover, transform gives a tactile click response. Short durations
     (90ms hover-in / 60ms click-down) so the row feels responsive
     rather than easing in lazily. */
  transition:
    background-color 90ms ease-out,
    box-shadow 90ms ease-out,
    transform 60ms ease-out;
  position: relative;
}
.tdd-suggest-item:last-child { border-bottom: 0; }
.tdd-suggest-item:hover {
  background: var(--surface-elevated, rgba(127,127,127,.10));
  /* Inset accent rail on hover — same visual shape as the persistent
     "is-active" highlight but in a subtler tint, so hovering a row
     telegraphs "this is what'll load if you click" without competing
     with the currently-loaded selection. */
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--foreground) 35%, transparent);
}
.tdd-suggest-item:hover .tdd-suggest-sym {
  color: var(--foreground);
}
/* Click-down feedback: subtle press-in + a brief darker background so
   the user feels the row "accepting" the click. Without this the row
   reads as static at the moment of activation, which is what made the
   interaction feel flat. */
.tdd-suggest-item:active {
  transform: translateY(1px);
  background: color-mix(in srgb, var(--foreground) 14%, transparent);
  transition-duration: 30ms;
}
/* Keyboard focus (when the user tabs in) — same visual as hover so
   keyboard nav feels consistent with mouse. Drop the default outline
   in favor of the inset rail. */
.tdd-suggest-item:focus-visible {
  outline: none;
  background: var(--surface-elevated, rgba(127,127,127,.10));
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--foreground) 50%, transparent);
}
/* Active selection — persistent highlight while the same token remains
   loaded, so reopening the dropdown shows which item is "current".
   Note: `--accent` from tokens.css is a button-fill token (near-white in
   light mode, near-black in dark mode), so it's NOT a safe text color
   on a tinted-elevated background — would render the symbol invisible
   in light mode (white-on-white). The rail uses --foreground for the
   inset accent stripe and --foreground for the text so contrast is
   preserved across themes. */
.tdd-suggest-item.is-active {
  background: var(--surface-elevated, rgba(127,127,127,.14));
  box-shadow: inset 3px 0 0 var(--foreground);
}
.tdd-suggest-item.is-active .tdd-suggest-sym {
  color: var(--foreground);
}
.tdd-suggest-sym { font-family: 'Geist Mono', monospace; font-weight: 600; }
.tdd-suggest-name { color: var(--muted-foreground); }

/* Coin-image circle — the wrapper is always a solid circle (acting as
   the empty-state placeholder), the inner <img> is hidden when there's
   no src so the browser never paints a broken-image glyph. Used by both
   the header logo and the dropdown thumbnails (sm variant). */
.tdd-img-circle {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--surface-elevated);
  overflow: hidden;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tdd-img-circle-sm { width: 24px; height: 24px; }
.tdd-img-circle img {
  width: 100%; height: 100%;
  display: block;
  object-fit: cover;
}
.tdd-img-circle img:not([src]),
.tdd-img-circle img[src=""] {
  display: none;
}

/* Card stack — top-down sections with normal spacing between cards. */
.tdd-card { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }

/* Token header inside the metrics bento — image · name · price in one
   row, Arkham link on a second row underneath. Compact so it doesn't
   eat too much of the bento's vertical real estate. */
.tdd-hdr {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
/* Header circle sizing comes from .tdd-img-circle (no rule needed here). */
.tdd-hdr-text h2 { margin: 0; font-size: 16px; line-height: 1.2; }
.tdd-hdr-text .muted { font-size: 11px; }
.tdd-hdr-price { text-align: right; }
.tdd-px-now { font-family: 'Geist Mono', monospace; font-size: 18px; font-weight: 600; }
.tdd-hdr-actions {
  margin: 12px 0 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
/* Provider link bubbles — each carries a brand color via inline
   `--prov-color`. The glyph is tinted with that color, the hover halo
   pulls a soft tint of it, and a subtle bottom-edge accent appears on
   hover. Rest state is intentionally restrained so the cluster doesn't
   shout louder than the price. */
.tdd-prov-link {
  --prov-tint: color-mix(in srgb, var(--prov-color) 12%, transparent);
  --prov-tint-strong: color-mix(in srgb, var(--prov-color) 22%, transparent);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-elevated, var(--bg-elev));
  color: var(--foreground);
  font-size: 12px;
  font-family: 'Geist Mono', monospace;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
  isolation: isolate;
}
.tdd-prov-link:hover {
  border-color: var(--prov-tint-strong);
  background: var(--prov-tint);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px -8px var(--prov-tint-strong);
}
.tdd-prov-link:focus-visible {
  outline: 2px solid var(--prov-color);
  outline-offset: 2px;
}
.tdd-prov-glyph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--prov-color);
  flex-shrink: 0;
}
.tdd-prov-glyph svg,
.tdd-prov-glyph img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
/* Arkham's logo SVG ships pure black (no fill attr → defaults to black).
   We can't recolor an <img>-loaded SVG via CSS color, so flip it with
   filter: invert(1) by default (dark theme) and unset the filter when
   light theme is active. The data-theme attribute lives on <html>. */
.tdd-prov-glyph--invert img { filter: invert(1); }
:root[data-theme="light"] .tdd-prov-glyph--invert img { filter: none; }
.tdd-prov-label { white-space: nowrap; }
.tdd-prov-arrow {
  display: inline-flex;
  width: 11px;
  height: 11px;
  color: var(--muted-foreground);
  opacity: 0.6;
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease;
}
.tdd-prov-arrow svg { width: 100%; height: 100%; }
.tdd-prov-link:hover .tdd-prov-arrow {
  opacity: 1;
  color: var(--prov-color);
  transform: translate(1px, -1px);
}

/* KPI tiles — auto-fitting grid like the overview KPIs. */
.tdd-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.tdd-kpi {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-elev);
}
.tdd-kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted-foreground); }
.tdd-kpi-value { font-family: 'Geist Mono', monospace; font-size: 16px; font-weight: 600; margin-top: 4px; }
/* Token-symbol suffix and USD subline inside a KPI tile — pairs the raw
   token count with an at-spot $ reference so the trader doesn't have to
   multiply in their head. */
.tdd-kpi-sym { font-size: 11px; color: var(--muted-foreground); font-weight: 400; margin-left: 2px; }
.tdd-kpi-usd { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--muted-foreground); font-weight: 400; margin-top: 2px; }

/* Rich stat panels — replaces the flat 7-tile KPI grid with
   narrative groupings: Valuation (MC → FDV + dilution multiplier +
   supply progress bar), Drawdown (% from ATH + bar), Revenue
   (30d fees + annualized + P/F multiple), Age (days since TGE).
   The derived metrics (dilution, supply%, drawdown, P/F) are why
   we redesigned this — raw numbers become judgments. */
.tdd-stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
}
.tdd-stat-full { grid-column: 1 / -1; }
.tdd-stat-thin {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
}

.tdd-stat-label {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  line-height: 1.2;
}
.tdd-stat-value {
  font-family: 'Geist Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-top: 2px;
}
/* Tone variants on the headline number — drawdown reads red when the
   token is well off its ATH, green when at/above, amber in-between. */
.tdd-stat-value-pos     { color: var(--profit); }
.tdd-stat-value-loss    { color: var(--loss); }
.tdd-stat-value-warn    { color: var(--chart-3); }
.tdd-stat-value-neutral { color: var(--foreground); }

.tdd-stat-sub {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.tdd-stat-sub-right { text-align: right; }

/* Headline row used in the Valuation panel — MC, an arrow glyph, FDV,
   then an auto-pushed badge on the right. flex-wrap so a narrow
   bento cell folds the badge to a second line instead of pushing
   past the card edge. */
.tdd-stat-headline {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}
.tdd-stat-block { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tdd-stat-block-secondary .tdd-stat-value {
  font-size: 14px;
  color: var(--muted-foreground);
  font-weight: 600;
}
.tdd-stat-arrow {
  font-family: 'Geist Mono', monospace;
  color: var(--muted-foreground);
  font-size: 14px;
  margin-bottom: 4px;
  user-select: none;
}

/* Pill badge for derived multiples (dilution, P/F). Tone variants
   match the rest of the app's good/neutral/warn/risk grammar so a
   risky-graded token's dilution badge reads in the same red as its
   OTC scorecard. */
.tdd-stat-badge {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  border: 1px solid;
  white-space: nowrap;
  align-self: center;
}
.tdd-stat-badge-good {
  color: var(--profit);
  border-color: color-mix(in srgb, var(--profit) 35%, transparent);
  background: color-mix(in srgb, var(--profit) 10%, transparent);
}
.tdd-stat-badge-neutral {
  color: var(--foreground);
  border-color: var(--border);
  background: color-mix(in srgb, var(--foreground) 5%, transparent);
}
.tdd-stat-badge-warn {
  color: var(--chart-3);
  border-color: color-mix(in srgb, var(--chart-3) 40%, transparent);
  background: color-mix(in srgb, var(--chart-3) 12%, transparent);
}
.tdd-stat-badge-risk {
  color: var(--loss);
  border-color: color-mix(in srgb, var(--loss) 40%, transparent);
  background: color-mix(in srgb, var(--loss) 12%, transparent);
}
/* Multi-badge row inside a stat panel — used for the MC/F + FDV/F
   pair on the Revenue panel. align-self: flex-start so the row hugs
   the left edge of the panel rather than getting auto-pushed by the
   single-badge `margin-left: auto` above. */
.tdd-stat-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.tdd-stat-badges-row .tdd-stat-badge {
  margin-left: 0;
  align-self: flex-start;
}

/* Inline progress bar — used by Valuation (supply % emitted) and
   Drawdown (current price as % of ATH). Same component, different
   tints via the *-fill-{tone} variants. */
.tdd-stat-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tdd-stat-progress-bar {
  height: 5px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--foreground) 8%, transparent);
  overflow: hidden;
}
.tdd-stat-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--profit) 80%, transparent),
    var(--profit)
  );
  transition: width .35s ease;
}
.tdd-stat-progress-fill-pos {
  background: linear-gradient(to right,
    color-mix(in srgb, var(--profit) 80%, transparent), var(--profit));
}
.tdd-stat-progress-fill-warn {
  background: linear-gradient(to right,
    color-mix(in srgb, var(--chart-3) 80%, transparent), var(--chart-3));
}
.tdd-stat-progress-fill-loss {
  background: linear-gradient(to right,
    color-mix(in srgb, var(--loss) 80%, transparent), var(--loss));
}
.tdd-stat-progress-fill-neutral {
  background: linear-gradient(to right,
    color-mix(in srgb, var(--foreground) 30%, transparent),
    color-mix(in srgb, var(--foreground) 60%, transparent));
}
.tdd-stat-progress-caption {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--muted-foreground);
}
.tdd-stat-progress-caption strong {
  color: var(--foreground);
  font-weight: 700;
}

/* Events table toggle — Upcoming/Past tabs above a body that swaps
   visibility based on the selected mode. */
.tdd-events-tabs {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin: 14px 0 8px;
}
.tdd-events-tab {
  background: transparent;
  border: 0;
  padding: 6px 14px;
  color: var(--muted-foreground);
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.tdd-events-tab:last-child { border-right: 0; }
.tdd-events-tab:hover { background: var(--surface-2); color: var(--foreground); }
.tdd-events-tab.is-active {
  background: var(--surface-2);
  color: var(--foreground);
  font-weight: 600;
}

/* Side-by-side row for the unlocks chart + schedule. Chart is a fixed
   height; schedule is the same height with its body internally scrollable
   so the bottoms of both cards align even with hundreds of events. */
.tdd-unlocks-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
  align-items: stretch;
}
.tdd-unlocks-row > .card { margin: 0; display: flex; flex-direction: column; }
@media (max-width: 1280px) {
  .tdd-unlocks-row { grid-template-columns: 1fr; }
}

.tdd-unlock-chart-wrap {
  height: 360px;
  flex-shrink: 0;
}

/* Schedule scroll body. Tabs sit above; the table scrolls inside the
   remaining space. max-height pinned to chart height so the two cards
   look like a true bento pair. */
.tdd-unlock-schedule-card #tdd-unlock-schedule {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tdd-events-toggle {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.tdd-events-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.tdd-events-body[hidden] { display: none; }
.tdd-events-scroll {
  flex: 1;
  min-height: 0;
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.tdd-events-scroll::-webkit-scrollbar { width: 8px; }
.tdd-events-scroll::-webkit-scrollbar-track { background: transparent; }
.tdd-events-scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

/* Pin column widths so expanding/collapsing month rows can't reflow the
   whole table. `<colgroup>` widths in JS are honored only with this. */
.tdd-events-table {
  table-layout: fixed;
  width: 100%;
}
.tdd-events-table th,
.tdd-events-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Make the header row sticky so column titles stay visible while scrolling. */
.tdd-events-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-card, var(--bg-elev));
}

/* Month-grouped events table — month rows are clickable to expand
   their child events. Chevron rotates when expanded. Child rows are
   indented + slightly muted so the hierarchy is obvious. */
.tdd-events-table .tdd-month-row {
  cursor: pointer;
  user-select: none;
}
.tdd-events-table .tdd-month-row:hover {
  background: var(--surface-2);
}
.tdd-events-table .tdd-month-row:focus-visible {
  outline: 2px solid var(--accent, var(--foreground));
  outline-offset: -2px;
}
.tdd-month-chev {
  display: inline-block;
  width: 12px;
  color: var(--muted-foreground);
  transition: transform 0.15s ease;
  margin-right: 4px;
}
.tdd-events-table .tdd-month-row.is-expanded .tdd-month-chev {
  transform: rotate(90deg);
}
.tdd-events-table .tdd-event-child {
  background: var(--surface-elevated);
}
.tdd-events-table .tdd-event-child td:first-child {
  padding-left: 32px;
}
.tdd-event-date {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--muted-foreground);
}

/* Chain chips. */
.tdd-chains { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tdd-chains-label { white-space: nowrap; }
.tdd-chains-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tdd-chip {
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  background: var(--bg-elev);
  font-family: 'Geist Mono', monospace;
}

/* Unlocks bento — three side-by-side cards: token-supply stats,
   allocation donut, and unlock-progress (Unlocked/Locked/Untracked) donut.
   Falls back to a 2-up grid (stats + donuts row) on medium screens, then
   single column on narrow viewports. */
.tdd-unlocks-bento {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 24px;
}
.tdd-unlocks-bento > .card { margin: 0; display: flex; flex-direction: column; }
@media (max-width: 1280px) {
  .tdd-unlocks-bento { grid-template-columns: 1fr 1fr; }
  .tdd-unlocks-bento > .tdd-unlock-stats-card { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .tdd-unlocks-bento { grid-template-columns: 1fr; }
  .tdd-unlocks-bento > .tdd-unlock-stats-card { grid-column: auto; }
}

/* Donut + legend layout used inside both the Allocation and Unlock-progress
   cards. Donut floats on top, legend rows beneath it. */
.tdd-donut-wrap {
  position: relative;
  height: 180px;
  margin-bottom: 12px;
}
.tdd-donut-wrap canvas { max-height: 180px; }

.tdd-alloc { width: 100%; }

/* CEX badge in the coverage table — venue logo + proper-cased name.
   Inline-grid so the logo and label baseline-align cleanly. */
.tdd-cex-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
/* Logo wrapper — rounded-square card with overflow:hidden so the
   border-radius clips the logo. Two fit modes:
     • --cover:   no padding; image fills edge-to-edge so the wrapper's
                  rounded corners clip native square logos (Bitget, OKX,
                  Binance, HL) into a uniform rounded silhouette.
     • --contain: small padding + letterboxed image so wordmarks (Bybit)
                  stay readable. */
.tdd-cex-logo-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-elevated, var(--bg-elev));
  flex-shrink: 0;
  box-sizing: border-box;
  overflow: hidden;
}
.tdd-cex-logo-wrap--cover { padding: 0; }
.tdd-cex-logo-wrap--contain { padding: 2px; }
.tdd-cex-logo {
  display: block;
  width: 100%;
  height: 100%;
}
.tdd-cex-logo--cover { object-fit: cover; }
.tdd-cex-logo--contain { object-fit: contain; }
/* Binance + Hyperliquid source SVGs fill the artboard edge-to-edge, so
   under `cover` they butt against the wrapper border. Inset them ~13%
   so the rounded square frames the mark with a little breathing room. */
.tdd-cex-logo[src$="Binance_Logo.svg"],
.tdd-cex-logo[src$="HL_Logo.svg"] { transform: scale(0.87); }
/* Theme-aware logo invert. Black-fill brand marks (OKX, Lighter)
   disappear on the dark surface, so we render them inverted by
   default (dark theme) and unset the filter in light mode. Same
   pattern Token DD uses for the Arkham external-link glyph. */
.tdd-cex-logo--invert { filter: invert(1); }
:root[data-theme="light"] .tdd-cex-logo--invert { filter: none; }
.tdd-cex-name { font-family: 'Geist Mono', monospace; }
/* Optional secondary label appended to a brand badge — used by the
   Stock Basis Scanner to mark HIP-3 builder DEXs (HL logo + "xyz",
   "flx", etc.) without minting a separate logo for every builder. */
.tdd-cex-suffix {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  line-height: 1;
  letter-spacing: 0.02em;
  color: var(--muted-foreground);
  padding: 2px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--vc, var(--foreground)) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--vc, var(--foreground)) 25%, transparent);
  text-transform: uppercase;
  font-weight: 600;
}

/* Allocation list under the donut — colored swatch + category + numbers.
   Numbers cell is a baseline-aligned flex row: tokens (with sym) and USD
   share the left of the right-anchored block, percent stays bold and
   right-pinned so eyes can scan the column straight down. */
.tdd-alloc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.tdd-alloc-row {
  display: grid;
  grid-template-columns: 12px minmax(70px, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  font-family: 'Geist Mono', monospace;
  padding: 2px 0;
}
.tdd-alloc-swatch {
  width: 10px; height: 10px; border-radius: 2px;
}
.tdd-alloc-cat { color: var(--foreground); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tdd-alloc-num {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  text-align: right;
  justify-content: flex-end;
}
.tdd-alloc-tokens { color: var(--foreground); }
.tdd-alloc-tokens .muted { color: var(--muted-foreground); font-size: 10.5px; }
.tdd-alloc-usd { color: var(--muted-foreground); }
.tdd-alloc-pct {
  font-weight: 600;
  color: var(--foreground);
  min-width: 3.6em;
  text-align: right;
}

/* Inline color dot — used in the schedule's Tokens cell when there's only
   one category (donut would degenerate to a solid ring otherwise). Same
   color encoding as the chips so the eye reads "this row = that color". */
.tdd-cat-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  vertical-align: middle;
}

/* Aggregate-unlocks fallback — shown in the unlocks card when DefiLlama
   has list-level data but no per-cohort schedule. Headline KPIs sit at
   the top, then "next event" callout, then upcoming/past event tables. */
.tdd-agg-headline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

/* ── Token supply bento — visual rebuild ─────────────────────────────
   Big circulating-% headline, stacked horizontal supply bar (circ /
   locked / untracked, same palette as the Unlock Progress donut), then
   compact stat tiles for max / locked / emissions / dilution. The Next
   unlock callout reuses .tdd-agg-next from the OTC card. */
.tdd-supply-headline {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 4px;
}
.tdd-supply-headline-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.tdd-supply-headline-pct {
  font-family: 'Geist Mono', monospace;
  font-size: 36px;
  font-weight: 700;
  color: var(--profit, #3eb489);
  line-height: 1;
  letter-spacing: -0.02em;
}
.tdd-supply-headline-pct-suffix {
  font-size: 18px;
  font-weight: 600;
  margin-left: 2px;
  color: var(--profit, #3eb489);
}
.tdd-supply-headline-label {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.tdd-supply-headline-sub {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--foreground);
}

.tdd-supply-bar {
  display: flex;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-card-2, var(--surface-card));
  margin-top: 4px;
}
.tdd-supply-bar-seg {
  height: 100%;
  transition: width 0.3s ease;
}
.tdd-supply-bar-seg-circ      { background: #3eb489; }
.tdd-supply-bar-seg-locked    { background: #e57373; }
.tdd-supply-bar-seg-untracked { background: #888; }

.tdd-supply-bar-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--muted-foreground);
  margin-top: 4px;
}
.tdd-supply-bar-legend > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tdd-supply-bar-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.tdd-supply-bar-dot-circ      { background: #3eb489; }
.tdd-supply-bar-dot-locked    { background: #e57373; }
.tdd-supply-bar-dot-untracked { background: #888; }

.tdd-supply-tiles {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 4px;
}
.tdd-supply-tile {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-elevated, var(--bg-elev));
}
.tdd-supply-tile-k {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.tdd-supply-tile-v {
  font-family: 'Geist Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.tdd-supply-tile-suffix {
  font-size: 10px;
  font-weight: 500;
  color: var(--muted-foreground);
  margin-left: 2px;
}
.tdd-supply-tile-sub {
  font-family: 'Geist Mono', monospace;
  margin-top: 2px;
}

/* Next-unlock chip header — show countdown alongside the label so
   "imminent unlock" reads at a glance. */
.tdd-agg-next-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.tdd-next-countdown {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--accent, var(--foreground)) 14%, transparent);
  color: var(--foreground);
  border: 1px solid color-mix(in srgb, var(--accent, var(--foreground)) 38%, transparent);
}

/* Stats / donut card bodies — flex-fill the card so the next-event pill
   can stick to the bottom edge and the donut sits proportionally. */
#tdd-unlock-stats,
#tdd-unlock-allocation,
#tdd-unlock-progress {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 12px;
}
.tdd-agg-next {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent, var(--foreground));
  border-radius: 6px;
  background: var(--surface-elevated);
  margin-top: auto; /* sticks to the bottom of the stats card */
}
.tdd-next-line {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  font-family: 'Geist Mono', monospace;
  font-size: 13px;
  color: var(--foreground);
}
.tdd-next-line strong { font-size: 14px; }
.tdd-next-sep { color: var(--muted-foreground); }
.tdd-next-date { margin-top: 4px; font-family: 'Geist Mono', monospace; }

/* Category chip — tinted background + colored text, used in both the
   allocation list and the schedule's Categories column. Matches the
   ticker-tag pattern but bound to categoryColor() rather than tickerColor. */
.tdd-cat-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 10.5px;
  font-family: 'Geist Mono', monospace;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.tdd-cat-chips {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Inline mini-donut + number layout in the schedule's Tokens cell. The
   donut sits flush-left of the count so the eye picks up "how many parties"
   at the same glance as "how many tokens". */
.tdd-tokens-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.tdd-mini-donut {
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.tdd-agg-table-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted-foreground);
  margin: 14px 0 6px;
}

/* Errors card — keep visual weight low; the user might shrug at one warning. */
.tdd-errors { border-left: 3px solid var(--warn, #f7c948); }
.tdd-errors ul { margin: 0; padding-left: 18px; font-family: 'Geist Mono', monospace; font-size: 12px; }
.tdd-errors li { margin: 2px 0; color: var(--text-muted); }
.tdd-errors li strong { color: var(--text); }

/* Bento rows — two equal columns by default. Specific bentos override
   widths if they need to (none currently do). */
.tdd-bento {
  display: grid;
  /* minmax(0, 1fr) instead of `1fr` — without the explicit 0 minimum, a
     grid track's min size is `auto` (intrinsic content), so wide
     children (the 6-tile OTC backtest row, the chart canvas, the
     external-link row) inflate the column past 50% and push the whole
     bento off-screen. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 24px;
}
.tdd-bento > .card {
  margin: 0;
  /* Same overflow guard at the flex/card level — without min-width: 0,
     the card's flex children can intrinsic-size past the grid track. */
  min-width: 0;
}
@media (max-width: 1100px) {
  .tdd-bento { grid-template-columns: 1fr; }
}
/* Metrics card flex-fills its bento cell so the source tag sits flush
   with its sibling card's bottom edge. */
/* Metrics card — high-density layout. The entire token summary now lives
   in this single card alongside the chart, so every section is compressed
   to keep total height in check (the OTC card on the right matches it).
   Specific compression vs. defaults: padding-bottom on the header is
   halved, KPI tiles use 7×10 padding instead of 10×14, the chart embed
   trims its top margin, and the trailing source caption uses minimal
   spacing. */
.tdd-metrics-card { display: flex; flex-direction: column; padding: 18px 20px; }
.tdd-metrics-card .tdd-hdr { padding-bottom: 8px; }
.tdd-metrics-card .tdd-hdr-actions { margin: 8px 0 10px; gap: 6px; }
.tdd-metrics-card .tdd-kpis {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
.tdd-metrics-card .tdd-kpi { padding: 6px 10px; }
.tdd-metrics-card .tdd-kpi-label { font-size: 10px; letter-spacing: 0.4px; }
.tdd-metrics-card .tdd-kpi-value { font-size: 13px; margin-top: 2px; }
/* Inside the (compact) metrics-card half-bento, dial the rich-stat
   panels back: smaller headline numbers, tighter padding. The visual
   hierarchy survives because the relative sizes of label / value /
   sub stay proportional. */
.tdd-metrics-card .tdd-stat { padding: 8px 10px; gap: 6px; }
.tdd-metrics-card .tdd-stat-thin { padding: 6px 10px; }
.tdd-metrics-card .tdd-stat-value { font-size: 16px; }
.tdd-metrics-card .tdd-stat-block-secondary .tdd-stat-value { font-size: 13px; }
.tdd-metrics-card .tdd-chains { gap: 8px; }
.tdd-metrics-card .tdd-source { margin-top: 6px; padding-top: 6px; }

/* Embedded spot+funding chart inside the metrics card. Sits below the
   "Deployed on:" chips so the leftover whitespace there carries weight,
   freeing the row beneath the bento for full-width CEX coverage. Kept
   compact (200px) so the summary card doesn't dominate the page. */
.tdd-pxchart-embed {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.tdd-pxchart-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 6px;
}
.tdd-pxchart-embed .tdd-pxchart-wrap {
  height: 200px;
  position: relative;
  min-width: 0;
}

/* Mid-bento: CEX coverage takes 2/3 width (it's the dense per-venue
   grid that needs breathing room for spot+perp side-by-side blocks);
   the spot+funding chart gets the remaining 1/3. `min-width: 0` on grid
   children is required so the chart canvas can SHRINK below its
   intrinsic width — without it Chart.js measures the natural canvas
   width and the card overflows the column. */
.tdd-mid-bento {
  grid-template-columns: 2fr 1fr;
  align-items: stretch;
}
@media (max-width: 1280px) {
  .tdd-mid-bento { grid-template-columns: 1fr; }
}
.tdd-mid-bento > .card {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
/* CEX coverage as a per-venue card grid. Each card has the venue logo at
   the top and two side-by-side blocks (Spot, Perp), labelled and visually
   distinct so a PM can answer "where can I trade this?" in one glance.
   Empty sides (venue not listed for that side) collapse to a centered
   muted note instead of dashed-out cells. Aggregate totals strip below
   the grid surfaces the across-venue sums. */
.tdd-cex-grid {
  display: grid;
  /* Force 6 venues into a single row at full-width — each gets ~1/6 of
     the card. Drops to 2 columns at medium widths and 1 column on
     narrow viewports so cards never get crushed. minmax(0,1fr) lets
     flex/grid children shrink without overflowing. */
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}
@media (max-width: 1280px) {
  .tdd-cex-grid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
}
.tdd-cex-venue {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-elevated, var(--bg-elev));
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
}
/* Brand-color top accent bar — venue color (set inline as `--cex-color`)
   reads as a thin stripe across the card's top edge, plus a faint matching
   tint dialed to ~6% as the card background-blend so the cards feel
   visually "owned" by their venue without shouting. */
.tdd-cex-venue::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--cex-color, var(--border));
}
.tdd-cex-venue {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--cex-color, transparent) 7%, transparent) 0, transparent 60%),
    var(--surface-elevated, var(--bg-elev));
}
.tdd-cex-venue.is-empty { opacity: 0.55; }
.tdd-cex-venue-head {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--border);
}
.tdd-cex-venue-head .tdd-cex-name { font-size: 12px; }
.tdd-cex-venue-head .tdd-cex-badge { display: inline-flex; align-items: center; gap: 8px; }
.tdd-cex-venue-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tdd-cex-side {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--surface-card-2, var(--surface-card));
  min-width: 0;
}
.tdd-cex-side-spot { border-left: 2px solid color-mix(in srgb, var(--chart-2, #00bb7f) 60%, transparent); }
.tdd-cex-side-perp { border-left: 2px solid color-mix(in srgb, var(--chart-1, #1447e6) 60%, transparent); }
.tdd-cex-side.is-empty {
  background: transparent;
  border: 1px dashed var(--border);
  border-left-style: dashed;
  justify-content: space-between;
}
.tdd-cex-side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}
.tdd-cex-side-label {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.tdd-cex-side-pair {
  font-size: 10px;
  font-family: 'Geist Mono', monospace;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.tdd-cex-side-pair .ext-link { padding: 0 2px; gap: 2px; }
.tdd-cex-side-pair .ext-link-ico { width: 9px; height: 9px; }
.tdd-cex-side-empty {
  font-size: 11px;
  font-style: italic;
  color: var(--muted-foreground);
  text-align: center;
  padding: 6px 0;
}
.tdd-cex-metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
  font-size: 11px;
  font-family: 'Geist Mono', monospace;
}
.tdd-cex-metric-k { color: var(--muted-foreground); font-size: 10px; }
.tdd-cex-metric-v { color: var(--foreground); font-variant-numeric: tabular-nums; }
.tdd-cex-metric-v.pos { color: var(--profit); }
.tdd-cex-metric-v.neg { color: var(--loss); }

/* Aggregate totals strip — single horizontal row of compact tiles.
   Symmetric dashed rules above and below so the strip reads as a
   distinct band (not a half-trapped footer). The .tdd-source caption
   below has its own dashed top rule we suppress here to avoid stacking
   two dashed lines. */
.tdd-cex-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 12px;
  border-top: 1px dashed var(--border);
  border-bottom: 1px dashed var(--border);
  margin: 12px 0 0;
}
.tdd-cex-card .tdd-cex-totals + .tdd-source {
  margin-top: 8px;
  padding-top: 0;
  border-top: 0;
}
.tdd-cex-total-label {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-right: 6px;
}
.tdd-cex-total-tile {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-elevated);
  min-width: 90px;
}
.tdd-cex-total-k { font-size: 9px; color: var(--muted-foreground); text-transform: uppercase; letter-spacing: 0.05em; }
.tdd-cex-total-v { font-family: 'Geist Mono', monospace; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tdd-cex-total-v.pos { color: var(--profit); }
.tdd-cex-total-v.neg { color: var(--loss); }
.tdd-pxchart-wrap {
  flex: 1;
  min-height: 280px;
  min-width: 0;
  position: relative;
}

/* ── OTC Deal Risk scorecard ─────────────────────────────────────────
   Sits to the right of the token-summary in the top bento. Layout:
     · card-title row (with embedded score + grade chip flush right)
     · radar chart (flex-grows so the card matches metrics-card height)
     · 2-column pillar list (label · score/5 · raw detail)
     · caption + source line at the bottom
   `--otc-color` is set inline by JS based on overall grade and drives
   the score color, the grade chip tint, and the radar fill. */
.tdd-otc-risk-card {
  display: flex;
  flex-direction: column;
}
.tdd-otc-risk-card .card-title {
  align-items: center;
  justify-content: flex-start;
}
.tdd-otc-score-row {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.tdd-otc-score {
  font-family: 'Geist Mono', monospace;
  font-size: 28px;
  font-weight: 700;
  color: var(--otc-color, var(--foreground));
  line-height: 1;
}
.tdd-otc-score-denom {
  font-size: 13px;
  color: var(--muted-foreground);
  font-weight: 400;
}
.tdd-otc-grade {
  padding: 3px 10px;
  border-radius: 999px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: color-mix(in srgb, var(--otc-color, var(--foreground)) 14%, transparent);
  color: var(--otc-color, var(--foreground));
  border: 1px solid color-mix(in srgb, var(--otc-color, var(--foreground)) 38%, transparent);
}

.tdd-otc-radar-wrap {
  position: relative;
  height: 240px;
  max-height: 240px;
  margin: 4px 0 12px;
  /* Don't flex-grow with the card. Without this the radar inflates to fill
     whatever vertical space the sibling metrics card occupies, blowing the
     pentagon up to "huge". A fixed-height wrap keeps the geometry honest. */
  flex: 0 0 auto;
}

/* Pillar list — two columns of {color bar} {label} {score} {detail}.
   A dashed top border separates the pillar grid from the radar chart
   above; without it the score column reads as a continuation of the
   radar's labels instead of its own row of metrics. */
.tdd-otc-pillars {
  display: grid;
  /* minmax(0, 1fr) — pillar detail text ("FDV $1.23B" / "−12.4% cum APR")
     is intrinsic-wide enough to inflate `1fr` tracks past 50% and push
     the OTC card past its bento cell. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px 16px;
  margin-bottom: 8px;
  padding-top: 14px;
  border-top: 1px dashed var(--border);
}
.tdd-otc-pillar {
  display: grid;
  /* Score column (col 3) spans BOTH rows so the score number + warning
     triangle have the full pillar height to render in — lets us size
     the score badge and warn icon big enough to read at a glance
     without squashing them into the label row. minmax(0, 1fr) on the
     middle (label/detail) column prevents long detail strings from
     intrinsic-sizing the column past its share. */
  grid-template-columns: 8px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
  min-width: 0;
}
.tdd-otc-pillar:nth-last-child(-n+2) { border-bottom: 0; }
.tdd-otc-pillar-bar {
  grid-row: 1 / 3;
  width: 6px;
  height: 28px;
  border-radius: 2px;
  background: var(--muted-foreground);
}
.tdd-otc-pillar-label {
  color: var(--foreground);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* OTC pillar bands include longer labels than the global rubric pattern
   ("> 100% / yr (more is better — easier to hedge)"), which would otherwise
   bake the entire label into the grid's `max-content` column (see
   hint.css) and overflow the popover. Inside the pillar list, let the
   label wrap to multiple lines and keep the badge top-aligned with the
   start of the label. --hint-accent makes the active-band highlight
   follow the per-card OTC grade color. */
.tdd-otc-pillar {
  --hint-accent: var(--otc-color);
}
.tdd-otc-pillar .hint-tip {
  width: 340px;
}
.tdd-otc-pillar .hint-tip .tip-rows > .tip-row {
  align-items: start;
}
.tdd-otc-pillar .hint-tip .tip-row .k {
  white-space: normal;
  text-align: left;
  word-break: break-word;
}

/* Counterparty Quality tooltip — three deltas vs the OTC card's variant:
   1. Anchored to the LEFT edge of the (?) glyph (not centered) because
      the cpq card is full-width below CEX coverage, so its left-most
      help icons sit close to the sidebar; centering would clip into it.
   2. Width 360px — matches OTC's tooltip footprint, fits the longest
      band label ("30+ commits/6mo or 100k+ social") without truncating.
   3. z-index 100 to clear the sidebar (z-index 60-80 in layout.css) —
      otherwise the sidebar paints over the left edge of the popover. */
.tdd-cpq-card {
  --hint-accent: var(--cpq-color);
}
.tdd-cpq-row .hint-tip {
  width: 360px;
  left: 0;
  transform: translateY(-4px);
  z-index: 100;
}
.tdd-cpq-row .hint:hover .hint-tip,
.tdd-cpq-row .hint:focus-visible .hint-tip,
.tdd-cpq-row .hint.is-open .hint-tip {
  transform: translateY(0);
}
.tdd-cpq-row .hint-tip .tip-row { align-items: center; }
.tdd-cpq-row .hint-tip .tip-row .k {
  white-space: nowrap;
}
.tdd-otc-pillar-score {
  color: var(--foreground);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  /* Span both rows of the pillar (label row + detail row) so the score
     and warning triangle have the full vertical real estate to render
     in — they're the at-a-glance read for the pillar, so they earn the
     space. */
  grid-row: 1 / 3;
  grid-column: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  justify-self: end;
}
/* Warning triangle next to score — flags pillars at 0/5–1/5 (drags score)
   or n/a (pillar dropped from the average). Loss-red by default; muted
   for the n/a variant since "missing data" is a softer alert than "bad".
   Sized big and bold so it's a single-glance "this pillar needs review"
   marker, not a subtle hint. */
.tdd-otc-pillar-warn {
  display: inline-flex;
  align-items: center;
  color: var(--loss);
}
.tdd-otc-pillar-warn.is-na {
  color: var(--chart-3, #f29c4f);
}
.tdd-warn-ico {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  /* Subtle drop-shadow so the triangle reads off both light and dark
     card backgrounds without us having to know which the user picked. */
  filter: drop-shadow(0 0 1px color-mix(in srgb, currentColor 60%, transparent));
}
.tdd-otc-pillar-detail {
  /* Score column now occupies col 3 across both rows, so detail only
     needs col 2 — was previously `2 / 4` to claim the score row's
     residual width. */
  grid-column: 2 / 3;
  color: var(--muted-foreground);
  font-size: 10.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* n/a pillar visual — use color desaturation instead of parent opacity.
   The pillar label contains the (?) help glyph + its tooltip child;
   `opacity: 0.5` on the label cascaded down to the tooltip too (CSS
   opacity is multiplicative through the stacking context), so hovering
   a greyed-out pillar produced a half-transparent popover. Color-only
   greying preserves the tooltip at full opacity. */
.tdd-otc-pillar.is-na .tdd-otc-pillar-label {
  color: var(--muted-foreground);
}
.tdd-otc-pillar.is-na .tdd-otc-pillar-score {
  color: var(--muted-foreground);
  font-weight: 400;
}
.tdd-otc-pillar.is-na .tdd-otc-pillar-detail {
  font-style: italic;
}
.tdd-otc-pillar.is-na .tdd-otc-pillar-bar {
  background: var(--muted-foreground) !important;
  opacity: 0.4;
}
.tdd-otc-caption {
  margin-bottom: 4px;
  font-style: italic;
}

/* ── Counterparty Quality card ──────────────────────────────────────────────
   Informational, table-style. No radar chart — the OTC card already
   carries that visual weight and a second one would be noisy. Each row
   is a {bar | label | evidence | score} stripe so a PM can scan the
   checklist top-to-bottom in a few seconds: did they audit, were they
   hacked, who funded them, etc. The headline 0-100 score in the title
   is the same number that gets piped into the OTC card as its 7th
   pillar — keeping a single source of truth for "project quality". */
.tdd-cpq-card {
  display: flex;
  flex-direction: column;
}
.tdd-cpq-card .card-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.tdd-cpq-score-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-left: auto;
  font-family: 'Geist Mono', monospace;
}
.tdd-cpq-score {
  font-size: 22px;
  font-weight: 700;
  color: var(--cpq-color, var(--foreground));
  font-variant-numeric: tabular-nums;
}
.tdd-cpq-score::after {
  content: ' / 100';
  font-size: 12px;
  color: var(--muted-foreground);
  font-weight: 400;
}
.tdd-cpq-grade {
  padding: 3px 10px;
  border-radius: 999px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: color-mix(in srgb, var(--cpq-color, var(--foreground)) 14%, transparent);
  color: var(--cpq-color, var(--foreground));
  border: 1px solid color-mix(in srgb, var(--cpq-color, var(--foreground)) 38%, transparent);
}
.tdd-cpq-rows {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  margin-bottom: 8px;
  border-top: 1px dashed var(--border);
}
/* Each row: color bar · label · evidence list · score badge.
   Heavier vertical padding than the OTC pillars because evidence text
   sometimes wraps to 2-3 lines (raise lists, audit URLs). */
.tdd-cpq-row {
  display: grid;
  grid-template-columns: 6px minmax(0, 220px) minmax(0, 1fr) auto;
  column-gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
}
.tdd-cpq-row:last-child { border-bottom: 0; }
.tdd-cpq-row-bar {
  width: 4px;
  height: 100%;
  min-height: 24px;
  border-radius: 2px;
  background: var(--muted-foreground);
}
.tdd-cpq-row-label {
  color: var(--foreground);
  font-weight: 600;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tdd-cpq-row-sublabel {
  display: block;
  color: var(--muted-foreground);
  font-size: 10.5px;
  font-weight: 400;
  margin-top: 2px;
}
.tdd-cpq-row-evidence {
  color: var(--muted-foreground);
  font-size: 11.5px;
  line-height: 1.5;
  min-width: 0;
}
.tdd-cpq-row-evidence strong {
  color: var(--foreground);
  font-weight: 600;
}
.tdd-cpq-row-evidence .tdd-cpq-evidence-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* Anchors inside evidence cells use the shared `.ext-link` class
   (the perp-pair link styling defined further down) for theme-aware
   color + the inline ↗ arrow. No bespoke overrides needed here —
   keeping the link surface consistent with the CEX coverage cards. */
.tdd-cpq-row-evidence .ext-link {
  font-size: 11px;
  padding: 0 3px;
}
.tdd-cpq-row-score {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  justify-self: end;
  color: var(--foreground);
  /* Defense against narrow-viewport wrapping: keep "⚠ 1/5" on a single
     line regardless of how cramped the row gets. The grid `auto` column
     normally sizes to content, but if a sibling cell gets squeezed below
     min-content the score can be the one to give — pin it. */
  white-space: nowrap;
}
/* Warning triangle next to the cpq score — mirrors the OTC card's
   `.tdd-otc-pillar-warn` treatment so the visual language stays
   consistent across the two scorecards. Loss-red for low scores
   (≤ 1/5), warning-orange for n/a. Same Lucide triangle-alert SVG,
   same 22px size as the OTC card. */
.tdd-cpq-row-warn {
  display: inline-flex;
  align-items: center;
  color: var(--loss);
}
.tdd-cpq-row-warn.is-na {
  color: var(--chart-3, #f29c4f);
}
.tdd-cpq-row-warn .tdd-warn-ico {
  width: 20px;
  height: 20px;
}
.tdd-cpq-row.is-na .tdd-cpq-row-label,
.tdd-cpq-row.is-na .tdd-cpq-row-score {
  color: var(--muted-foreground);
}
.tdd-cpq-row.is-na .tdd-cpq-row-evidence { font-style: italic; }
.tdd-cpq-row.is-na .tdd-cpq-row-bar { opacity: 0.4; }

/* Pills used inside evidence cells — investor names, chains, hack
   classifications. Tight enough to fit several per line. */
.tdd-cpq-pill {
  display: inline-block;
  padding: 1px 7px;
  margin: 1px 3px 1px 0;
  border-radius: 4px;
  font-size: 10.5px;
  font-weight: 500;
  background: color-mix(in srgb, var(--foreground) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--foreground) 12%, transparent);
  color: var(--foreground);
  white-space: nowrap;
}
.tdd-cpq-pill.is-tier1 {
  /* Tier-1 backers are the headline signal — promote them visually so
     they stand out from the long tail of co-investors. */
  background: color-mix(in srgb, var(--profit, #3eb489) 16%, transparent);
  border-color: color-mix(in srgb, var(--profit, #3eb489) 40%, transparent);
  color: var(--profit, #3eb489);
}
.tdd-cpq-pill.is-warn {
  background: color-mix(in srgb, var(--loss, #e57373) 14%, transparent);
  border-color: color-mix(in srgb, var(--loss, #e57373) 38%, transparent);
  color: var(--loss, #e57373);
}
.tdd-cpq-caption {
  margin-bottom: 4px;
  font-style: italic;
}
@media (max-width: 720px) {
  /* Mobile layout: 3-column × 2-row grid. Each child is placed
     explicitly so CSS Grid's sparse-packing cursor can't dump the
     score onto a phantom third row at col 1 (which is what was
     happening when only evidence carried an explicit position — the
     cursor advanced past evidence at row 2 col 3, wrapped to row 3
     col 1, and the score landed there left-aligned, below the row).
     Mirrors the per-cell explicit-placement pattern that the top
     holders table mobile rule uses for the same reason.
       Row 1: bar(spans) | label+sublabel | score
       Row 2: bar(spans) | evidence (spans cols 2-3) */
  .tdd-cpq-row {
    grid-template-columns: 6px minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    row-gap: 6px;
  }
  .tdd-cpq-row-bar      { grid-column: 1; grid-row: 1 / 3; }
  .tdd-cpq-row > span:nth-child(2) { grid-column: 2; grid-row: 1; min-width: 0; }
  .tdd-cpq-row-score    { grid-column: 3; grid-row: 1; }
  .tdd-cpq-row-evidence { grid-column: 2 / 4; grid-row: 2; }

  /* Card-title row: title text + score badge stack vertically. Without
     this the score's `margin-left: auto` shoves the 22px number off to
     the right edge of a wrapped flex line, leaving the grade pill
     orphaned next to it — looks broken. */
  .tdd-cpq-card .card-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .tdd-cpq-score-row {
    margin-left: 0;
  }
  .tdd-cpq-score { font-size: 18px; }
}

/* Counterparty quality + top holders — 2-column bento. Falls back to
   single column on narrow viewports so the holders table doesn't get
   crushed below ~480px each. */
.tdd-cpq-holders-bento {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 24px;
}
.tdd-cpq-holders-bento > .card { margin: 0; display: flex; flex-direction: column; }
@media (max-width: 1100px) {
  .tdd-cpq-holders-bento { grid-template-columns: 1fr; }
}

/* Top holders card — table-style list of {rank, address, label, %, $}.
   Same monospace + dashed-row aesthetic as the cpq rows so the two
   cards read as a paired set. Each row has a color bar tinted by the
   holder's % of total supply (deeper red = bigger concentration). */
.tdd-holders-card {
  display: flex;
  flex-direction: column;
}
.tdd-holders-card .card-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
/* Score row mirrors the cpq score badge — same 0-100 number + qualitative
   grade pill — so the two paired cards feel symmetric. The big number is
   the OTC Holder Concentration pillar's score (pillar 0-5 × 20). */
.tdd-holders-score-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-left: auto;
  font-family: 'Geist Mono', monospace;
}
.tdd-holders-score {
  font-size: 22px;
  font-weight: 700;
  color: var(--holders-color, var(--foreground));
  font-variant-numeric: tabular-nums;
}
.tdd-holders-score::after {
  content: ' / 100';
  font-size: 12px;
  color: var(--muted-foreground);
  font-weight: 400;
}
.tdd-holders-grade {
  padding: 3px 10px;
  border-radius: 999px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  background: color-mix(in srgb, var(--holders-color, var(--foreground)) 14%, transparent);
  color: var(--holders-color, var(--foreground));
  border: 1px solid color-mix(in srgb, var(--holders-color, var(--foreground)) 38%, transparent);
}
@media (max-width: 720px) {
  /* Same mobile fix as the cpq title — stop the big score from being
     pinned to the right edge of a wrapped flex line, leaving the grade
     pill orphaned. Stack the title vertically and let the score-row
     sit flush-left underneath. */
  .tdd-holders-card .card-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
  .tdd-holders-score-row { margin-left: 0; }
  .tdd-holders-score { font-size: 18px; }
}
.tdd-holders-rows {
  display: flex;
  flex-direction: column;
  margin-top: 10px;
  margin-bottom: 8px;
  border-top: 1px dashed var(--border);
  /* Cap height — 20 rows is a lot of vertical space; let it scroll
     internally so the page below (unlocks bento) stays close. The
     scrollbar is always visible (not just on hover) so the user knows
     up-front there's more content past the visible window. */
  max-height: 540px;
  overflow-y: scroll;
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
/* WebKit / Chromium scrollbar — track stays transparent, thumb picks up
   the project's --border-strong token so it reads as part of the card
   chrome rather than a default-OS overlay. */
.tdd-holders-rows::-webkit-scrollbar { width: 8px; }
.tdd-holders-rows::-webkit-scrollbar-track { background: transparent; }
.tdd-holders-rows::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
.tdd-holders-rows::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}
/* Seven-column grid with the heat bar pulled OUT of the rank cell into
   its own fixed-width column, so the bars line up vertically regardless
   of whether the rank is 1 or 100. Previously the bar lived inline
   inside a right-aligned rank cell, which meant single-digit rows
   pushed the bar 6px further right than double-digit rows.
   Columns: bar · rank · address · label · balance · pct · usd. */
.tdd-holders-row {
  display: grid;
  grid-template-columns: 4px 22px minmax(0, 1.6fr) minmax(0, 0.9fr) auto auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 8px 4px;
  border-bottom: 1px dashed var(--border);
  font-family: 'Geist Mono', monospace;
  font-size: 11.5px;
}
.tdd-holders-row:last-child { border-bottom: 0; }
.tdd-holders-row-rank {
  color: var(--muted-foreground);
  font-size: 10.5px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tdd-holders-row-addr {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tdd-holders-row-addr .ext-link {
  font-size: 11px;
  padding: 0 3px;
}
/* Chain badge — small monospace pill in front of the address. Uses a
   tinted variant of --foreground so it reads as a meta-tag (chain
   indicator), not a clickable link. "+N" suffix appears for addresses
   that hold the token on multiple chains. */
.tdd-holders-chain-badge {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  background: color-mix(in srgb, var(--foreground) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--foreground) 16%, transparent);
  color: var(--muted-foreground);
  white-space: nowrap;
  flex-shrink: 0;
}
.tdd-holders-row-label {
  color: var(--muted-foreground);
  font-size: 10.5px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tdd-holders-row-label .tdd-cpq-pill {
  /* Reuse the cpq pill chrome for entity tags so labeled holders
     (CEX names, big protocols) read identically across both cards. */
  margin: 0;
}
.tdd-holders-row-balance {
  /* Token balance, e.g. "123,456 ARB". Same muted treatment as the
     usd column so the eye lands on % first; balance and usd read as
     paired secondary detail. */
  color: var(--muted-foreground);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 80px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tdd-holders-row-pct {
  color: var(--foreground);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 56px;
}
.tdd-holders-row-usd {
  color: var(--muted-foreground);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 64px;
}
.tdd-holders-row-bar {
  /* First column of the row — concentration heat. Color set inline by
     JS to track the holder's pct_of_total_supply. Fills the column's
     full 4px width so the left edge of every bar aligns vertically. */
  width: 100%;
  height: 14px;
  border-radius: 2px;
  background: var(--muted-foreground);
}
.tdd-holders-caption {
  margin-bottom: 4px;
  font-style: italic;
}
@media (max-width: 720px) {
  /* Three-row layout on mobile to fit the new balance column without
     squeezing addresses. Top row: address + pct (the headline pair).
     Middle row: label spans full secondary width. Bottom row: balance +
     usd (the dollar/token pair). Bar and rank span all three rows on
     the left so each holder reads as a single visual block. */
  .tdd-holders-row {
    grid-template-columns: 4px 22px minmax(0, 1fr) auto;
    grid-template-rows: auto auto auto;
    row-gap: 3px;
    column-gap: 8px;
  }
  .tdd-holders-row-bar     { grid-column: 1; grid-row: 1 / 4; height: 100%; }
  .tdd-holders-row-rank    { grid-column: 2; grid-row: 1 / 4; }
  .tdd-holders-row-addr    { grid-column: 3; grid-row: 1; }
  .tdd-holders-row-pct     { grid-column: 4; grid-row: 1; }
  .tdd-holders-row-label   { grid-column: 3 / 5; grid-row: 2; white-space: normal; }
  .tdd-holders-row-balance { grid-column: 3; grid-row: 3; text-align: left; }
  .tdd-holders-row-usd     { grid-column: 4; grid-row: 3; }
}

/* OTC backtest preset — wraps the suggested deal terms and a primary
   "run backtest" CTA in a card-within-card so the PM can scan
   schedule + economics, see the headline ticket size, and one-click
   into the simulator. The whole block tints with --otc-color (set by
   the grade band) so the visual link to the score above reads
   instantly: a green-graded token gets a green-tinted preset; AVOID
   gets a warm tint. */
.tdd-otc-backtest {
  margin-top: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--otc-color, var(--border)) 28%, var(--border));
  border-radius: var(--radius);
  background:
    linear-gradient(
      to bottom,
      color-mix(in srgb, var(--otc-color, var(--foreground)) 6%, var(--surface)) 0%,
      var(--surface) 100%
    );
}
.tdd-otc-bt-header {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 8px;
  border-bottom: 1px dashed color-mix(in srgb, var(--otc-color, var(--border)) 35%, var(--border));
}
.tdd-otc-bt-title {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--foreground);
}
.tdd-otc-bt-subtitle {
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted-foreground);
}

.tdd-otc-bt-params {
  display: grid;
  /* 5 equal-width term tiles + a wider Size tile on the right. The
     1.4fr last column gives the hero room for its sub-caption (which
     can run long, e.g. "capped · 10% × $25.17M OI") without ellipsis. */
  grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, 1.4fr);
  gap: 8px;
}
.tdd-bt-tile {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-elevated);
  transition: border-color .15s, background .15s;
}
/* Hero treatment for the Size tile — accent border + tinted background
   + accent-colored value, so the headline number reads as the headline
   number and the rest of the row reads as supporting terms. */
.tdd-bt-tile.is-hero {
  border-color: color-mix(in srgb, var(--otc-color, var(--foreground)) 50%, transparent);
  background: color-mix(in srgb, var(--otc-color, var(--foreground)) 10%, var(--surface-elevated));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--otc-color, var(--foreground)) 12%, transparent);
}
.tdd-bt-tile.is-hero .tdd-bt-tile-k {
  color: color-mix(in srgb, var(--otc-color, var(--foreground)) 70%, var(--muted-foreground));
}
.tdd-bt-tile.is-hero .tdd-bt-tile-v {
  color: var(--otc-color, var(--foreground));
  font-size: 15px;
}
.tdd-bt-tile-k {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
.tdd-bt-tile-v {
  font-family: 'Geist Mono', monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tdd-bt-tile-sub {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  line-height: 1.35;
  color: var(--muted-foreground);
}
/* Non-hero tiles only ever carry a short sub ("monthly"), so ellipsize
   to keep tile heights uniform. The hero Size tile's sub can run long
   (cap/floor explanations + OI figure) — let it wrap to a second line
   rather than truncate. */
.tdd-bt-tile:not(.is-hero) .tdd-bt-tile-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Primary CTA — full-width, anchored at the bottom of the card so
   it reads as the action the rest of the block was building toward.
   The trailing chevron reinforces the "this leaves for the Backtest
   tab" semantic without needing copy. */
.tdd-otc-bt-run {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: 'Geist Mono', monospace;
  letter-spacing: 0.04em;
  color: var(--foreground);
  background: color-mix(in srgb, var(--otc-color, var(--foreground)) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--otc-color, var(--foreground)) 42%, transparent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s, box-shadow .15s;
}
.tdd-otc-bt-run:hover {
  background: color-mix(in srgb, var(--otc-color, var(--foreground)) 26%, transparent);
  border-color: color-mix(in srgb, var(--otc-color, var(--foreground)) 65%, transparent);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -8px color-mix(in srgb, var(--otc-color, var(--foreground)) 60%, transparent);
}
.tdd-otc-bt-run:hover .tdd-otc-bt-run-arrow { transform: translateX(2px); }
.tdd-otc-bt-run svg {
  width: 14px;
  height: 14px;
  color: var(--otc-color, var(--foreground));
  flex: none;
}
.tdd-otc-bt-run-arrow {
  width: 14px;
  height: 14px;
  margin-left: 2px;
  opacity: 0.7;
  transition: transform .15s, opacity .15s;
}
.tdd-otc-bt-run:hover .tdd-otc-bt-run-arrow { opacity: 1; }

@media (max-width: 900px) {
  .tdd-otc-bt-params { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .tdd-otc-pillars { grid-template-columns: 1fr; }
  .tdd-otc-bt-params { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Source attribution — small caption below each section's content,
   right-aligned so it doesn't compete with the title row. */
.tdd-source {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 11px;
  color: var(--muted-foreground);
  text-align: right;
  font-family: 'Geist Mono', monospace;
}

/* Totals row — sticky-bottom feel with a top double-border. Slightly
   heavier text so it reads as a footer summary not just another row. */
#tdd-cex-table tbody .tdd-totals td {
  border-top: 2px solid var(--border-strong, var(--border));
  background: var(--surface-elevated, transparent);
  font-family: 'Geist Mono', monospace;
}

/* External link affordance — underline + small ↗ glyph indicates "opens
   in new tab" without needing a separate caption. The icon inherits the
   anchor color so it tints with hover state. */
.ext-link {
  color: var(--foreground);
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 4px;
  border-radius: 3px;
}
/* Hover bg: --surface-2 is the project's "next-elevation" surface — it's
   solid in both themes (dark: #161616, light: #f5f5f5) so the hover
   target is unambiguously visible. Text color stays --foreground; using
   --accent here would produce black-on-black / white-on-white because
   --accent is a button-fill token in this design system, not a link tint. */
.ext-link:hover {
  background: var(--surface-2);
  text-decoration-style: solid;
}
.ext-link-ico { width: 11px; height: 11px; opacity: 0.7; flex-shrink: 0; }
.ext-link:hover .ext-link-ico { opacity: 1; }

/* ════════════════════════════════════════════════════════════════════
   Mobile sweep — Token DD
   ════════════════════════════════════════════════════════════════════
   Mobile-specific overrides consolidated at the end of the file so they
   reliably win the cascade over the per-section overrides above.
   The hint-tip bottom-sheet behaviour itself lives in
   components/hint.css; this block only covers the page's own grids. */

@media (max-width: 720px) {
  /* Re-anchor the per-card overrides to the bottom-sheet defaults so
     `.tdd-cpq-row .hint-tip` doesn't keep its `left: 0` rule and clip
     off the right edge on phones. Other geometry (position: fixed,
     left/right/bottom) inherits from the .hint-tip rule in hint.css. */
  .tdd-cpq-row .hint-tip,
  .tdd-otc-pillar .hint-tip {
    width: auto;
    left: 12px;
    right: 12px;
  }

  /* — Metrics card KPI grid: 2 cols on tablet+, 1 col on phone.
     The metrics card is already inside a bento that collapses to
     single-column at 1100px, but the inner KPI grid stayed 2-col. */
  .tdd-metrics-card .tdd-kpis {
    grid-template-columns: 1fr;
  }

  /* — Stat-thin pairs: stack vertically when there's no room to
     split row-flex into label/value side-by-side without truncation. */
  .tdd-stat-thin {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* — CEX coverage grid: 2 cards/row on phone (was 1280px breakpoint
     auto-fit, which gave 1 card/row on narrow phones — fine, but with
     huge venue cards it scrolled forever. 2 cols compresses the spot+
     perp blocks just enough to scan all six venues at a glance). */
  .tdd-cex-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  /* — Ticker badge: shrink the input widths so the badge + status pill
     don't wrap to two lines on the smallest phones. The badge has
     `flex-wrap: wrap` (search-row), so it'll wrap gracefully if needed,
     but on a 360-414px viewport these widths are the difference between
     a clean one-line search and a stacked layout. */
  .tdd-ticker-badge .ticker-input { width: 88px; font-size: 16px; }
  .tdd-ticker-badge .symbol-input { width: 100px; }

  /* — CEX coverage: collapse to 1 card/row at the very narrow end. */
  .tdd-cex-grid {
    grid-template-columns: 1fr;
  }

  /* — CPQ rows: tighten column gap so the bar+label+score triplet on
     row 1 has more room for a wrapped label. */
  .tdd-cpq-row {
    column-gap: 10px;
    padding: 10px 0;
  }
  .tdd-cpq-row-score {
    /* Slightly smaller score text on tiny screens — the warning triangle
       is already 20px, so combined with "1/5" at 15px the cell ate ~58px
       of a 320px row. Trimming to 14px brings it to ~52px and gives the
       label (col 2) two more characters of breathing room before wrap. */
    font-size: 14px;
    gap: 6px;
  }

  /* — Snake-border stroke: thinner on very narrow viewports so the
     glow doesn't visually drown out compact card content. */
  .tdd-snake-fill {
    stroke-width: 2;
  }
}

/* ── Vesting timeline (DropsTab-style Gantt) ─────────────────────────
   One row per sale round: name + round size | TGE unlock % | a bar
   spanning the vest window. Elapsed portion is the saturated fill,
   future is the light tint, "Cliff" annotates the pre-start gap, and a
   vertical marker pins today across all rows. */
.tdd-unlock-chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.tdd-vest-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.tdd-vest-toggle-btn {
  background: transparent;
  border: 0;
  padding: 4px 12px;
  color: var(--muted-foreground);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.tdd-vest-toggle-btn:last-child { border-right: 0; }
.tdd-vest-toggle-btn:hover { background: var(--surface-2); color: var(--foreground); }
.tdd-vest-toggle-btn.is-active {
  background: var(--surface-2);
  color: var(--foreground);
  font-weight: 600;
}

.tdd-vesting-timeline {
  /* Matches .tdd-unlock-chart-wrap height so the Timeline|Chart toggle
     doesn't reflow the bento pair. Scrolls when a token has many rounds. */
  height: 360px;
  overflow-y: auto;
  flex-shrink: 0;
}
.tdd-vt {
  --vt-left-cols: 304px; /* 190px round col + 90px TGE col + 2×12px gaps */
  font-size: 12px;
}
.tdd-vt-row {
  display: grid;
  grid-template-columns: 190px 90px 1fr;
  gap: 0 12px;
  align-items: center;
  min-height: 56px;
  border-bottom: 1px solid var(--border);
}
.tdd-vt-row:last-child { border-bottom: 0; }
.tdd-vt-head {
  min-height: 34px;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface-card, var(--bg-elev));
}
.tdd-vt-body { position: relative; }
.tdd-vt-round {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.tdd-vt-round-text { min-width: 0; }
.tdd-vt-round-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tdd-vt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.tdd-vt-tge { text-align: left; }
.tdd-vt-track {
  position: relative;
  height: 44px;
  min-width: 0;
}
.tdd-vt-axis { height: 16px; }
.tdd-vt-tick {
  position: absolute;
  top: 0;
  color: var(--muted-foreground);
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  white-space: nowrap;
}
.tdd-vt-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 8px;
  overflow: hidden;
}
.tdd-vt-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 8px 0 0 8px;
}
.tdd-vt-bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2px 10px;
  white-space: nowrap;
  overflow: hidden;
  color: var(--foreground);
  line-height: 1.35;
}
.tdd-vt-bar-label strong { font-size: 11px; }
.tdd-vt-bar-label span { font-size: 10px; opacity: 0.8; }
.tdd-vt-cliff {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  font-weight: 600;
  font-size: 11px;
}
.tdd-vt-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px solid #3b82f6;
  z-index: 1;
  pointer-events: none;
}
.tdd-vt-today::before {
  content: '';
  position: absolute;
  top: 0;
  left: -6px;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid #3b82f6;
}
