/* OTC Deal Scanner — page-specific styles.
 *
 * The search/progress chrome reuses the .fsc-* classes from fundingscan.css
 * (snake-border card, filter grid, terminal log, task bars) so the scan UX
 * is visually identical to the funding scanners. Everything here styles the
 * bits unique to this page: the scan-universe controls and the token-grouped
 * results cards. All selectors are namespaced .ods-* to avoid collisions.
 */

/* ── Scan-universe controls (window · chains · toggles) ──────────────── */
.ods-scan-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px 22px;
  padding: 2px 0 14px;
  margin-bottom: 12px;
  border-bottom: 1px dashed var(--border);
}
.ods-field-sm { max-width: 150px; }
.ods-field-sm select {
  width: 100%;
  background: transparent;
  border: 0;
  color: var(--foreground);
  font: inherit;
  outline: none;
}

.ods-chains { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; max-width: 560px; }
.ods-chains .fsc-venues-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted-foreground);
  margin-right: 4px;
}
.ods-chain-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 11.5px;
  cursor: pointer;
  user-select: none;
  transition: background .12s, border-color .12s, opacity .12s;
}
.ods-chain-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.ods-chain-toggle:hover { background: color-mix(in srgb, var(--foreground) 7%, transparent); }
.ods-chain-toggle:has(input:not(:checked)) { opacity: .42; border-style: dashed; }
.ods-chain-toggle:has(input:checked) { border-color: color-mix(in srgb, var(--foreground) 35%, var(--border)); }

.ods-toggles { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; }
.ods-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--muted-foreground);
  cursor: pointer;
  user-select: none;
}
.ods-toggle input { accent-color: var(--accent, #3eb489); }
.ods-toggle:hover { color: var(--foreground); }

/* ── Results: token-grouped cards ───────────────────────────────────── */
.ods-groups { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.ods-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 13px;
}

/* Sort control in the results toolbar (native select, not a filter pill) */
.ods-sort-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted-foreground);
  white-space: nowrap;
}
.ods-sort-control select {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--foreground);
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
}
.ods-sort-control select:hover { border-color: var(--border-strong); }
.fsc-results-toolbar #ods-results-count { margin-left: 4px; }

.ods-group {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-elevated);
  overflow: hidden;
  transition: border-color .12s, box-shadow .12s;
}
.ods-group:hover { border-color: var(--border-strong); }
.ods-group.is-open { border-color: color-mix(in srgb, var(--foreground) 28%, var(--border)); }

/* Head = one table-like row shared across every card: token · chain · source
   rails · 9 metric columns · shape chips · actions. It's a GRID with fixed
   column tracks, and .ods-metrics uses display:contents (below) so its children
   drop straight into these tracks. That's what makes the columns line up
   vertically from card to card: every head shares ONE template at the same
   width. (The old flex layout let .ods-metrics size itself from whatever space
   the variable-width shape chips left over, so each card's columns landed at a
   different x.)

   Every metric renders unconditionally — including "revocable", which is "—"
   on rails that can't answer it. A conditional column would shift every metric
   to its right on the cards that have it, breaking the shared alignment. */
.ods-group-head {
  display: grid;
  grid-template-columns:
    minmax(168px, 1.3fr)            /* token identity */
    auto                            /* chain badge */
    auto                            /* source rail badges */
    repeat(9, minmax(58px, 1fr))    /* 9 metric columns */
    minmax(92px, 1.4fr)             /* deal-shape chips */
    auto;                           /* aside: contract link + chevron */
  align-items: center;
  gap: 8px 14px;
  padding: 12px 14px;
  cursor: pointer;
}

/* Token identity */
.ods-token { display: inline-flex; align-items: center; gap: 10px; min-width: 168px; }
.ods-token-icon {
  position: relative;
  width: 30px; height: 30px;
  flex: 0 0 30px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-grid;
  place-items: center;
  background: color-mix(in srgb, var(--c, #888) 22%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c, #888) 45%, transparent);
}
.ods-token-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Fallback initials, shown beneath the resolver slot. */
.ods-token-icon-text {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--c, #888) 85%, var(--foreground));
}
/* CG-by-symbol resolver slot — fills the circle; painted by attachTickerIcons
   for tokens the mcap snapshot doesn't ship an image for. */
.ods-token-icon-slot {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  background: transparent;
  border-radius: inherit;
}
.ods-token-icon-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Once the icon paints, hide the initials beneath it (logos have transparent
   corners; leaving the letters would bleed through). */
.ods-token-icon:has(.ods-token-icon-slot[data-icon-painted]:not(.ticker-icon--missing)) .ods-token-icon-text { display: none; }
.ods-token-id { display: flex; flex-direction: column; line-height: 1.2; }
.ods-token-name {
  font-size: 12px;
  color: var(--foreground);
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ods-token-sym { font-size: 13px; font-weight: 700; font-family: 'Geist Mono', ui-monospace, monospace; }

/* Chain pill — now the chain logo (same badge as the /funds wallet
   pills) rather than a text label; chain name lives in the title tooltip. */
.ods-chain-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
/* Shared chain-badge sizing. The .fund-chain-badge chrome (border, text
   fallback, absolutely-positioned icon slot) comes from funds.css; here we
   only pin the size per surface. */
.ods-chain-chip .ods-chain-badge { width: 20px; height: 20px; border-radius: 5px; }
.ods-chain-toggle .ods-chain-badge { width: 15px; height: 15px; border-radius: 4px; flex: none; }
.ods-chain-badge { flex: none; }
.ods-chain-badge .fund-chain-badge-text { font-size: 8px; }

/* Metric columns — display:contents lifts the 8 .ods-metric children out of
   this wrapper and into the head grid above, so they occupy the 8 shared metric
   tracks. That's the whole alignment fix: the values + captions now line up into
   clean columns across every card, regardless of how wide any single value is. */
.ods-metrics { display: contents; }
.ods-metric { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.ods-metric b {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--foreground);
}
.ods-metric i {
  font-style: normal;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted-foreground);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Notional stands out by color + weight; keep it the same size as its peers
   so the 8-column grid reads as one tidy row. */
.ods-metric.ods-m-strong b { color: #3eb489; font-weight: 700; }

/* Deal-shape chips */
.ods-shapes { display: inline-flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.ods-shape-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 6px;
  color: var(--foreground);
  background: color-mix(in srgb, var(--foreground) 9%, transparent);
  border: 1px solid var(--border);
}
.ods-shape-n { font-size: 9.5px; color: var(--muted-foreground); }

.ods-group-aside { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.ods-ext, .ods-streams a {
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--muted-foreground);
  text-decoration: none;
  white-space: nowrap;
}
.ods-ext:hover, .ods-streams a:hover { color: var(--foreground); text-decoration: underline; }
.ods-chev { color: var(--muted-foreground); transition: transform .15s; font-size: 11px; }
.ods-group.is-open .ods-chev { transform: rotate(180deg); }

/* Tone helpers inside cards */
.ods-group .pos { color: #3eb489; }
.ods-group .neg { color: #e57373; }
.ods-group .neutral { color: #f29c4f; }

/* Expanded stream list */
.ods-streams { display: none; border-top: 1px solid var(--border); padding: 4px 14px 12px; }
.ods-group.is-open .ods-streams { display: block; }
.ods-streams-head {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted-foreground);
  padding: 8px 0 6px;
}
.ods-streams-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Geist Mono', ui-monospace, monospace;
  font-size: 11.5px;
}
.ods-streams-table th {
  text-align: left;
  font-weight: 500;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .03em;
  color: var(--muted-foreground);
  padding: 4px 10px 4px 0;
  border-bottom: 1px solid var(--border);
}
.ods-streams-table th.num, .ods-streams-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ods-streams-table td {
  padding: 5px 10px 5px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  color: var(--foreground);
  white-space: nowrap;
}
.ods-streams-table tr:last-child td { border-bottom: 0; }
.ods-streams-table tr.ods-canceled td { opacity: .5; text-decoration: line-through; }
/* Claimed-vs-unclaimed donut: green arc = withdrawn, red track = still locked. */
.ods-donut-th, .ods-donut-cell { width: 28px; padding-right: 6px !important; text-align: center; }
.ods-donut-cell { line-height: 0; }
.ods-donut { display: inline-block; vertical-align: middle; }
.ods-streams-table tr.ods-canceled .ods-donut { text-decoration: none; }
/* Shape cell: structure label + bracketed vesting-end date + cadence tags. */
.ods-shape-cell { white-space: nowrap; }
.ods-row-shape { color: var(--foreground); }
.ods-row-vest-end { color: var(--muted-foreground); margin-left: 5px; }
.ods-row-shape-tags { color: var(--muted-foreground); }

/* Below the 12-track grid's comfortable width, fall back to a flex row and let
   the metrics wrap onto their own line as a self-contained 4-col (then 3-col)
   grid — overriding display:contents so .ods-metrics is a grid box again. */
@media (max-width: 1080px) {
  .ods-group-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
  .ods-token { min-width: 140px; order: 1; }
  .ods-chain-chip { order: 2; }
  .ods-shapes { order: 3; }
  .ods-group-aside { order: 4; }
  .ods-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
    gap: 6px 12px;
    order: 5;
    flex: 1 1 100%;
    min-width: 0;
  }
}
@media (max-width: 480px) {
  .ods-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ── Source rails ─────────────────────────────────────────────────────
 *
 * Sablier / Hedgey pills. Multi-select, and at least one always stays on —
 * .is-locked marks the last active rail so its "can't switch this off" state
 * is visible rather than just unresponsive.
 *
 * Both protocol marks are single-path <symbol>s instanced from index.html and
 * painted with `fill: currentColor`, so ONE glyph serves the idle pill, the
 * filled active pill and the small per-deal badges without a second asset.
 * Their viewBoxes differ a lot in aspect (Sablier's hourglass is tall,
 * Hedgey's H is wide), so each gets its own box to keep optical weight even.
 */
.ods-sources { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ods-sources .fsc-venues-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted-foreground);
  margin-right: 4px;
}
.ods-source-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 11px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--muted-foreground);
  font: inherit;
  font-size: 12px;
  line-height: 1.5;
  cursor: pointer;
  opacity: .5;
  transition: background .12s, border-color .12s, color .12s, opacity .12s;
}
.ods-source-pill:hover { background: color-mix(in srgb, var(--foreground) 7%, transparent); opacity: .8; }
.ods-source-pill.is-on {
  opacity: 1;
  color: var(--foreground);
  border-color: color-mix(in srgb, var(--foreground) 38%, var(--border));
  background: color-mix(in srgb, var(--foreground) 6%, transparent);
}
/* The last rail standing: still clearly ON, but signalled as not togglable. */
.ods-source-pill.is-locked { cursor: default; }
.ods-source-pill.is-locked:hover { background: color-mix(in srgb, var(--foreground) 6%, transparent); }
.ods-source-name { font-weight: 600; letter-spacing: .01em; }
.ods-source-count {
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  color: var(--muted-foreground);
}
.ods-source-count:empty { display: none; }
.ods-source-mark { width: 13px; height: 15px; fill: currentColor; flex: none; }
.ods-source-mark--hedgey { width: 17px; height: 14px; }

/* Chains the selected rails can't reach. Kept visible (so the user can see
 * the chain exists and which rail would cover it) but clearly inert — the
 * checkbox keeps its state so re-enabling the rail restores the pick. */
.ods-chain-toggle.is-unavailable {
  opacity: .28;
  border-style: dotted;
  cursor: not-allowed;
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--muted-foreground) 60%, transparent);
}
.ods-chain-toggle.is-unavailable:hover { background: transparent; }

/* ── Per-token source badges (card head) ─────────────────────────────── */
.ods-src-badges { display: inline-flex; align-items: center; gap: 4px; }
.ods-src-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-foreground);
  font-size: 10px;
  line-height: 1.4;
}
.ods-src-badge-n { font-variant-numeric: tabular-nums; font-weight: 600; }
.ods-src-mark { width: 9px; height: 11px; fill: currentColor; flex: none; }
.ods-src-mark--hedgey { width: 12px; height: 10px; }

/* ── Counterparty-risk chips (deal rows) ──────────────────────────────
 *
 * The fields a desk actually underwrites on, and the main reason the Hedgey
 * rail earns its place: REV (the issuer can claw back everything unvested)
 * and OBO (the admin can move the position out of the buyer's wallet) have no
 * Sablier analogue. BOUND is the opposite signal — the position is
 * non-transferable, so it can't be resold. */
.ods-risk-cell { white-space: nowrap; }
.ods-risk {
  display: inline-block;
  padding: 1px 5px;
  margin-right: 3px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: help;
}
.ods-risk--revocable {
  color: var(--loss, #e40014);
  background: color-mix(in srgb, var(--loss, #e40014) 14%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--loss, #e40014) 32%, transparent);
}
.ods-risk--obo {
  color: #d98324;
  background: color-mix(in srgb, #d98324 15%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #d98324 34%, transparent);
}
.ods-risk--bound {
  color: var(--muted-foreground);
  background: color-mix(in srgb, var(--foreground) 8%, transparent);
  box-shadow: inset 0 0 0 1px var(--border);
}

/* Position link: protocol mark + the rail's own id for the position. */
.ods-link-cell a { display: inline-flex; align-items: center; gap: 5px; }

/* The revocable metric is "—" on rails that can't answer it, so it must read
 * as absent rather than as zero risk. */
.ods-m-risk i { white-space: nowrap; }
