/* ════════════════════════════════════════════════════════════════════
   Deals tab — toolbar, deal cards, sections, fields, summary row
   ════════════════════════════════════════════════════════════════════ */

/* ── Obfuscation: hide leaky deal-card columns under price obf ──────
   The redactor nulls live_spot / price_at_deal_date / effective_mp /
   total_value / tokens etc. under price obf. Rather than rendering
   "$0.000000" or em-dashes (which read as "missing" instead of
   "redacted"), hide the whole tile / pill so the user sees a clean
   layout. Uses :has() — modern browser only, but the entire app
   already requires Chromium 105+ for other features. */
:root[data-obf-active][data-obf-flags~="prices"] .deal-card .stat-tile:has(.head-live),
:root[data-obf-active][data-obf-flags~="prices"] .deal-card .stat-tile:has(.head-deal-date-px),
:root[data-obf-active][data-obf-flags~="prices"] .deal-card .stat-tile:has(.head-mp),
:root[data-obf-active][data-obf-flags~="prices"] .deal-card .head-value:has(.deal-purchase-head),
:root[data-obf-active][data-obf-flags~="prices"] .deal-card .head-value:has(.deal-notional-head),
:root[data-obf-active][data-obf-flags~="prices"] .deal-card .head-value:has(.deal-value-head),
:root[data-obf-active][data-obf-flags~="prices"] .deal-card .pill:has(.deal-spot),
:root[data-obf-active][data-obf-flags~="prices"] .deal-card .pill:has(.deal-mp),
:root[data-obf-active][data-obf-flags~="prices"] .deal-card .pill:has(.deal-value) {
  display: none !important;
}

.deals-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.deals-toolbar input {
  flex: 1; max-width: 380px;
  background: var(--input); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 12px; font-size: 13px;
  font-family: var(--font-mono);
}
.deals-toolbar input:focus { outline: none; border-color: var(--ring); }
/* Push the expand/collapse pair to the right edge — keeps the search +
   count grouped on the left, controls on the right. margin-left:auto on
   the wrapper consumes any leftover space. */
.deal-collapse-controls { display: flex; gap: 6px; margin-left: auto; }
.deal-collapse-controls .ghost { padding: 6px 10px; font-size: 12px; }


.deal-list { display: flex; flex-direction: column; gap: 16px; }

/* ── Deal card ────────────────────────────────────────────────────── */
.deal-card {
  background: var(--surface-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  position: relative;
}
.deal-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }
/* Unsaved-edit state — same visual treatment as the report-preview-card
   stale border (amber line + outer glow), minus the corner pill since deal
   cards don't need a verbal nudge. */
.deal-card.dirty {
  border-color: var(--status-dev);
  box-shadow: 0 0 0 1px var(--status-dev), 0 0 24px rgba(248, 168, 0, 0.22);
}
/* Completed deals — nothing left to vest. The JS partitions these to the
   bottom of the list; the visual mute keeps the active rows above as the
   focal point. Hover lifts the opacity so the operator can still read the
   numbers without an extra click. Mirrors .liveov-otc-deal-card--complete
   on the Live Overview cards so the two surfaces feel consistent. */
.deal-card--complete {
  opacity: .55;
  filter: saturate(.45);
}
.deal-card--complete:hover {
  opacity: .9;
  filter: saturate(.9);
}

/* Ticker stripe on the left edge — set via --ticker-color from JS. */
.deal-card .deal-stripe {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 3px;
  background: var(--ticker-color, var(--foreground));
  opacity: .8;
}

/* ── Head row ─────────────────────────────────────────────────────── */
.deal-head-row {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-elevated);
}
.ticker-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 4px 8px;
}

/* Deal-card icon — overrides the base .ticker-icon size. Inherits the
 * circle frame + theme backfill from components/cards.css. Width AND
 * height are both pinned so the slot is square from mount, no
 * paint-time width animation.
 * The head-row variant is small (sits next to the TKR input); the Fund
 * Admin variant is larger because it sits next to the deal name "title". */
.deal-card-icon {
  width: 18px; height: 18px;
  margin-right: 6px;
}

.deal-admin-wrap {
  display: flex; align-items: center; gap: 8px;
}
.deal-admin-wrap .deal-admin { flex: 1 1 auto; }
.deal-admin-icon {
  width: 28px; height: 28px;
  margin-right: 0;
}
.ticker-input {
  background: transparent; border: none; outline: none;
  color: var(--ticker-color, var(--foreground));
  font-family: var(--font-mono); font-weight: 600; font-size: 14px;
  width: 84px; padding: 2px 4px;
  text-transform: uppercase; letter-spacing: .05em;
}
.ticker-input:focus { background: rgba(255,255,255,.04); border-radius: 2px; }
.symbol-arrow { color: var(--muted-foreground); font-size: 12px; }
.symbol-input {
  background: transparent; border: none; outline: none;
  color: var(--muted-foreground);
  font-family: var(--font-mono); font-size: 11px;
  width: 100px; padding: 2px 4px; text-transform: uppercase;
}
.symbol-input[readonly] {
  cursor: default; pointer-events: none;
  user-select: none;
}

/* Live stats strip in deal head */
.head-stats {
  display: flex; align-items: center; gap: 24px;
  flex: 1;
  padding: 0 20px; margin: 0 4px;
  border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  min-width: 0;
}
.stat-tile { display: flex; flex-direction: column; gap: 2px; min-width: 64px; }
.stat-label {
  font-size: 9px; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: .1em; font-weight: 500;
}
.stat-value {
  font-family: var(--font-mono); font-size: 13px; color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.stat-value.up    { color: var(--profit); }
.stat-value.down  { color: var(--loss); }
.stat-value.muted { color: var(--muted-foreground); }

.head-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 10px; font-family: var(--font-mono);
  padding: 4px 10px; border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--secondary);
  text-transform: uppercase; letter-spacing: .08em; font-weight: 500;
}
.head-status.mtm  { color: var(--profit);    border-color: rgba(81,193,72,.3);  background: rgba(81,193,72,.06); }
.head-status.disc { color: var(--chart-3);   border-color: rgba(249,156,0,.3);  background: rgba(249,156,0,.06); }
.head-status.ovr  { color: var(--otc-hedge); border-color: rgba(98,126,234,.3); background: rgba(98,126,234,.06); }
.head-status.complete {
  color: var(--muted-foreground);
  border-color: color-mix(in srgb, var(--muted-foreground) 35%, transparent);
  background: color-mix(in srgb, var(--muted-foreground) 18%, transparent);
}

.head-value {
  display: inline-flex; flex-direction: column; align-items: flex-end;
  font-family: var(--font-mono); padding-left: 14px;
  border-left: 1px solid var(--border);
}
.head-value .hv-label {
  font-size: 10px; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: .1em;
}
.head-value .hv-amt { font-size: 16px; font-weight: 600; color: var(--foreground); }
.head-value .hv-amt.pos { color: var(--profit); }
.head-value .hv-amt.neg { color: var(--loss); }

.deal-head-actions { display: flex; gap: 6px; margin-left: auto; align-items: center; }

/* Per-deal "Backtest" shortcut — height-matched to the ✕ delete button. */
.deal-backtest {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: .02em;
  color: var(--muted-foreground);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.deal-backtest:hover {
  color: var(--foreground);
  border-color: var(--border-strong);
  background: var(--hover-tint, rgba(255, 255, 255, 0.04));
}
.deal-backtest svg { width: 12px; height: 12px; opacity: 0.85; }
.deal-backtest:hover svg { opacity: 1; }

/* ── Body / sections ──────────────────────────────────────────────── */
.deal-body { padding: 4px 0; }

.deal-section {
  display: grid; grid-template-columns: 160px 1fr; gap: 20px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.deal-section:last-of-type { border-bottom: none; }

.section-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: .12em;
  padding-top: 6px;
}
.section-head .section-icon {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--secondary); border: 1px solid var(--border);
  color: var(--foreground);
  border-radius: var(--radius); font-size: 12px;
}
.section-head .section-icon svg { width: 13px; height: 13px; }
/* All section icons inherit the deal's ticker color (set on the card via
   --ticker-color in applyTickerColor). Keeps visual identity consistent —
   one card, one color — instead of five hand-picked accents per card. */
.deal-section .section-icon { color: var(--ticker-color, var(--foreground)); }

.section-body { display: grid; gap: 12px; }

.section-head-wrap {
  display: flex; flex-direction: column; gap: 12px;
  align-items: flex-start;
}
.section-toggle {
  display: inline-flex; gap: 0;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--secondary); padding: 2px;
  width: fit-content;
}
.seg-btn {
  background: none; border: none; color: var(--muted-foreground);
  padding: 4px 10px; font-size: 10px; border-radius: 2px;
  letter-spacing: .1em; text-transform: uppercase; font-weight: 500;
  font-family: var(--font-mono);
  transition: all .15s;
  /* Block accidental text selection from a fast double-click on a filter
     pill. Selected text becomes a drag source — once selected, the next
     mousedown anywhere can kick off a native HTML5 text drag, which
     starves the scrubber's pointer events and shows the (/) no-drop
     cursor. */
  user-select: none;
  -webkit-user-select: none;
}
.seg-btn.active { background: var(--foreground); color: var(--background); }
.seg-btn:hover:not(.active) { color: var(--foreground); }

/* Icon-only segment buttons — used by the Deals view switcher
   (handshake + Lucid icon). Slightly bigger touch target so the
   silhouette has breathing room, and the SVG/mask inherits color
   from .seg-btn so .active inversion (foreground bg, background ink)
   reads correctly on both themes. */
.seg-btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  min-width: 48px;
}
.seg-btn-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}
/* Match handshake SVG's optical weight to the Lucid mask icon — the
   wordmark glyphs render slightly heavier visually than line strokes. */
.lucid-tab-icon {
  display: inline-block;
  width: 18px;
  height: 16px;
  background-color: currentColor;
  -webkit-mask-image: url('/lucid-icon.svg');
          mask-image: url('/lucid-icon.svg');
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
}
/* Slight vertical optical alignment between the two icons — the
   handshake hangs a touch lower than the Lucid eye glyph because of
   its drawing baseline; this nudges the pair so they sit on the same
   visual axis. */
.deals-view-switcher .seg-btn-icon[data-deals-view="lucid"] .lucid-tab-icon {
  margin-top: -1px;
}

/* ── Field grid ───────────────────────────────────────────────────── */
.field-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.field-grid.five-col { grid-template-columns: repeat(5, 1fr); }
.field-grid > .field { display: flex; flex-direction: column; }
.field > label {
  font-size: 10px; color: var(--muted-foreground);
  text-transform: uppercase; letter-spacing: .1em;
  margin-bottom: 6px; font-weight: 500;
}
.field > input,
.field > select,
.field > .input-pct > input,
.field > .input-dollar > input {
  background: var(--input); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 8px 10px; font-size: 13px; font-family: var(--font-mono);
  transition: border-color .15s, background .15s;
}
/* Decorated inputs need extra side-padding so the value doesn't collide
   with the ghost prefix/suffix. Declared after the unified rule so
   source-order specificity wins. */
.field > .input-pct > input    { padding-right: 26px; }
.field > .input-dollar > input { padding-left: 22px; }
.field > input:focus,
.field > select:focus,
.field > .input-pct > input:focus,
.field > .input-dollar > input:focus {
  outline: none; border-color: var(--ring); background: var(--secondary);
}
.field > input[type="date"] { color-scheme: dark; }
:root[data-theme="light"] .field > input[type="date"] { color-scheme: light; }
.field > select { cursor: pointer; }

.field .field-caption {
  margin-top: 6px; font-size: 11px; color: var(--muted-foreground);
  font-family: var(--font-mono);
  display: flex; align-items: center; gap: 4px;
  height: 16px;
  white-space: nowrap;
}
.field .field-caption .arrow { color: var(--muted-foreground); }

/* Hedged checkbox styled as a chip */
.field-checkbox label.cb-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--input); border: 1px solid var(--border); border-radius: var(--radius);
  cursor: pointer; font-size: 13px; user-select: none;
  align-self: flex-start;
  transition: all .15s;
}
.field-checkbox label.cb-chip:hover { border-color: var(--ring); }
.field-checkbox label.cb-chip input { accent-color: var(--foreground); width: 14px; height: 14px; margin: 0; }
.field-checkbox label.cb-chip:has(input:checked) {
  background: var(--surface-tinted);
  border-color: var(--border-strong);
  color: var(--foreground);
}

/* Admin reference input full width */
.deal-admin {
  width: 100%; background: var(--input); color: var(--foreground);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px;
  font-size: 13px; font-family: var(--font-mono);
}
.deal-admin:focus { outline: none; border-color: var(--ring); }

/* Fund Admin grid — fund-admin name (wide) + broker fees (narrow). */
.s-admin-grid { grid-template-columns: minmax(0, 3fr) minmax(140px, 1fr); }

.cadence-help, .discount-help {
  margin-top: 6px; padding: 8px 12px; border-radius: var(--radius);
  background: var(--surface-elevated);
  font-size: 11px; color: var(--muted-foreground); line-height: 1.5;
  border: 1px solid var(--border);
}

.num-tranches.disabled { opacity: .35; pointer-events: none; }

/* Hedge section: Hedge Price is always visible — it's the negotiated
   reference (≡ spot at deal date) that anchors both the discount calc
   and, when hedged, the actual short entry. The old pct-mode vs
   hedge-price-mode toggle is gone now that effective_discount is
   derived rather than entered. */
.deal-card .discount-hedge-field { display: flex; }

/* Hedge % field — visually identical to "Override discount" (.input-pct
   ghost-suffix). When the position isn't hedged the input is disabled and
   greyed out, matching the 0% vest-tranche treatment. */
.deal-card:not(.hedged-mode) .hedge-pct-field .input-pct input {
  color: var(--muted-foreground);
  background: var(--surface-tinted);
  cursor: not-allowed;
}
.deal-card:not(.hedged-mode) .hedge-pct-field .pct-suffix {
  opacity: .55;
}
.deal-card:not(.hedged-mode) .hedge-pct-field > label {
  color: var(--muted-foreground);
  opacity: .65;
}

/* Hedge / Reference Price — same disabled treatment as Hedge %. When
   unhedged, the field is read-only and pinned to the at-deal-date
   close (the negotiated reference price), so grey it out to match. */
.deal-card:not(.hedged-mode) .discount-hedge-field .input-dollar input {
  color: var(--muted-foreground);
  background: var(--surface-tinted);
  cursor: not-allowed;
}
.deal-card:not(.hedged-mode) .discount-hedge-field .dollar-prefix {
  opacity: .55;
}
.deal-card:not(.hedged-mode) .discount-hedge-field > label {
  color: var(--muted-foreground);
  opacity: .65;
}

/* ── Live summary row ─────────────────────────────────────────────── */
.deal-summary {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 12px 20px;
  background: var(--surface-tinted);
  border-top: 1px solid var(--border);
}

/* ── Collapsed state ──────────────────────────────────────────────── */
.deal-card.collapsed .deal-body { display: none; }
.deal-card.collapsed .deal-summary { border-top-color: transparent; }

/* ── Responsive ───────────────────────────────────────────────────── */
/* The head row packs ticker badge · 6 stat-tiles · status pill · 4
   dollar amounts · actions — without wrapping, the flex items hit their
   min-width and labels overlap once the viewport drops below the
   ~1500px the row was designed for. Allowing both the row and the inner
   stat-strip to wrap lets items stack onto new lines as space runs out
   — the same vertical-wrapping behaviour the mobile breakpoint uses,
   applied progressively all the way down so every value stays visible.
   The mobile (≤720px) rules below add the final tightening pass. */
.deal-head-row { flex-wrap: wrap; row-gap: 12px; }
.head-stats { flex-wrap: wrap; row-gap: 10px; }

@media (max-width: 1280px) {
  .field-grid { grid-template-columns: repeat(2, 1fr); }
  .field-grid.five-col { grid-template-columns: repeat(2, 1fr); }
  .deal-section { grid-template-columns: 1fr; }
  .section-head { padding-top: 0; }
}
@media (max-width: 900px) {
  .head-stats { display: none; }
}

/* ── Mobile (≤ 720px) ────────────────────────────────────────────────
   At phone widths the 2-column field grid squeezes inputs below their
   readable minimum and the head row's badge + status + value strip
   overflows the viewport (which .main's overflow-x: hidden then clips,
   visually losing the right-most controls). Stack everything to a
   single column and let the head wrap. */
@media (max-width: 720px) {
  /* One field per row — labels stop truncating, inputs get full
     readable width. */
  .field-grid,
  .field-grid.five-col,
  .s-admin-grid { grid-template-columns: 1fr; gap: 10px; }

  /* Tighten the section gutters — every saved pixel goes to the
     control area. */
  .deal-section { padding: 14px 14px; gap: 12px; }
  .deal-head-row {
    padding: 12px 14px;
    gap: 8px;
    flex-wrap: wrap;             /* ticker badge / status pill / value
                                    can move to a second line instead
                                    of overflowing into nowhere */
  }
  .deal-summary { padding: 10px 14px; }

  /* Trim the ticker badge to its minimum readable footprint. */
  .ticker-badge { padding: 3px 6px; gap: 4px; }
  .ticker-input { width: 64px; font-size: 13px; }
  .symbol-input { width: 80px; font-size: 10px; }

  /* When wrapping kicks in, the value strip on the right would
     otherwise still carry its left border — visually broken once the
     row breaks. Drop the divider on mobile and let it sit flush.
     deal-head-actions retains its margin-left:auto so the action
     buttons still pin to the right of whichever line they land on. */
  .head-value {
    padding-left: 0;
    border-left: none;
    align-items: flex-start;
  }
  .head-value .hv-amt { font-size: 14px; }

  /* Per-deal Backtest button label hides on the smallest screens —
     the icon alone is recognizable and the text was the only thing
     pushing the actions row past the right edge on a 360px viewport.
     The title attribute still announces the button to AT. */
  .deal-backtest > span { display: none; }
  .deal-backtest { padding: 6px 8px; }

  /* Toolbar — let the search input fill the row and shrink the
     right-edge "16 deals" counter padding. */
  .deals-toolbar { gap: 8px; }
  .deals-toolbar input { max-width: none; }
}

/* ── Hedge section — Synthetic / Live segmented switcher ─────────────
   The Hedge section's body has two sub-views: .hedge-synthetic-body
   (default — Hedge Price + Hedged + Hedge %) and .hedge-live-body (the
   picker that binds the deal to one or more live CEX positions). The
   .hedge-mode-toggle in the section header switches between them; JS
   sets `data-hedge-mode` on .s-hedge plus toggles `[hidden]` on each
   sub-body. Mirrors the Lock section's Days/Dates pattern — toggle
   sits BELOW the section name (the default .section-head-wrap layout). */
.s-hedge .hedge-live-body {
  display: flex; flex-direction: column; gap: 10px;
}
.s-hedge .live-hedge-help { line-height: 1.5; }
.s-hedge .live-hedge-empty {
  font-style: italic;
  padding: 6px 0;
}
/* Hedged-tokens summary line. Shows Σ(|position_amt| × weight_pct) across
   bound rows vs deal.tokens (the OTC spot purchase qty), updating live as
   sliders move. The bar visually anchors the X% coverage; .over flips it
   to a warning tint when the live hedge has been overshot beyond the
   deal's spot size (legitimate on multi-leg deals — the user just needs
   to see it). */
.live-hedge-totals {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-tinted);
  font-size: 12px;
}
.live-hedge-totals[hidden] { display: none; }
.live-hedge-totals-label {
  color: var(--muted-foreground);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}
.live-hedge-totals-value {
  font-family: var(--font-mono);
  font-size: 12px;
  flex: 0 0 auto;
}
/* The bar IS the segment host — segments are direct children sized
   as % of the bar (= % of deal.tokens). Multi-venue hedges paint each
   venue's brand color from CEX_META; the unfilled tail is the bar's
   own background. .over flips a red glow so an over-hedge is obvious
   without losing the per-venue colors. */
.live-hedge-totals-bar {
  display: flex;
  flex: 1 1 auto;
  height: 6px;
  background: var(--input);
  border-radius: 999px;
  overflow: hidden;
  min-width: 60px;
  position: relative;
}
.live-hedge-totals-seg {
  display: block;
  height: 100%;
  transition: width 80ms linear, background-color 120ms;
  /* Visually separate adjacent venue segments without drawing a hard
     line — a soft inner edge using box-shadow keeps the colors readable
     when they sit next to each other. */
}
.live-hedge-totals-seg + .live-hedge-totals-seg {
  box-shadow: inset 1px 0 0 rgba(0, 0, 0, 0.25);
}
.live-hedge-totals.over .live-hedge-totals-bar {
  box-shadow: 0 0 0 1px var(--danger, #d97706);
}
.live-hedge-totals-pct {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  min-width: 48px;
  text-align: right;
  flex: 0 0 auto;
}
.live-hedge-totals-pct:empty { display: none; }
.s-hedge .live-hedge-links {
  display: flex; flex-direction: column; gap: 6px;
}
.live-hedge-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px) auto;
  gap: 10px; align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-tinted);
}
.live-hedge-row select,
.live-hedge-row input[type="number"] {
  background: var(--input);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  font-family: var(--font-mono); font-size: 12px;
  min-width: 0;
}
.live-hedge-row select[data-lh="position"] {
  width: 100%;
}
/* Bound-position cell: dropdown stacked above a static logo+symbol+qty
   chip. Chip exists so the user reads venue truth even after the
   <select> collapses (option text isn't rich). */
.live-hedge-pos {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.live-hedge-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px;
  color: var(--muted-foreground);
  padding-left: 2px;
}
.live-hedge-chip:empty { display: none; }
.live-hedge-chip .tdd-cex-logo-wrap { width: 16px; height: 16px; flex: 0 0 16px; }

/* Slider + readout. Slider is full-width of its cell; below it a
   two-line readout shows "X%" and "used / available" so the user sees
   both the proportion and the absolute token count without doing the
   math in their head. */
.live-hedge-slider-wrap {
  display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
/* Slider + Max button on one line. Slider stretches; Max sits at the
   right at a fixed width so the user can reach it without finding the
   slider thumb first. */
.live-hedge-slider-line {
  display: flex; align-items: center; gap: 6px;
}
.live-hedge-row input[type="range"] {
  flex: 1 1 auto; margin: 0;
  accent-color: var(--foreground);
}
.live-hedge-max {
  flex: 0 0 auto;
  background: var(--input);
  color: var(--foreground);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 8px;
  font-family: var(--font-mono); font-size: 11px;
  cursor: pointer;
  line-height: 1.4;
}
.live-hedge-max:hover {
  background: var(--surface-tinted);
  border-color: var(--foreground);
}
.live-hedge-max:active {
  transform: translateY(0.5px);
}
.live-hedge-slider-readout {
  display: flex; align-items: baseline;
  font-family: var(--font-mono); font-size: 11px;
  gap: 8px;
}
.live-hedge-slider-readout > span:first-child { font-weight: 600; }
/* "X% remaining" hint sits at the right end. Dimmed so it reads as
   meta-info, not as part of the per-row count. */
.live-hedge-remaining {
  margin-left: auto;
  opacity: 0.85;
}
.live-hedge-remaining:empty { display: none; }
/* Spread the absolute-qty readout to the right when there's no remaining
   hint to push, so the row stays balanced visually. */
.live-hedge-slider-readout > [data-lh="weight-qty"] {
  margin-left: 8px;
}

.live-hedge-row .live-hedge-remove {
  /* Reuses .icon-btn from funds.css for hover/focus styling — keep
     this rule for height alignment on the row. */
  width: 28px; height: 28px;
  align-self: center;
}
.live-hedge-actions {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap;
}

/* ── Mobile (≤ 720px) — live hedge picker ────────────────────────────
   On a phone the position picker takes a full row at top; slider +
   remove sit on row 2. The slider is the wider control (the value
   matters more than the remove button) so it grabs the flexible
   column. */
@media (max-width: 720px) {
  .live-hedge-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "position position"
      "slider remove";
    row-gap: 8px;
  }
  .live-hedge-row > .live-hedge-pos        { grid-area: position; }
  .live-hedge-row > .live-hedge-slider-wrap { grid-area: slider; }
  .live-hedge-row > .live-hedge-remove      { grid-area: remove; justify-self: end; }
  .live-hedge-actions {
    justify-content: stretch;
  }
  .live-hedge-actions button {
    flex: 1 1 auto;
  }
}

/* ── Smart-color picker (s-color section, migration 0023) ────────────
   Five swatches in a row: primary / secondary / tertiary / muted (all
   image-extracted) plus the deterministic calculated fallback. Click
   pins a global color for that token. White / black / greyscale
   candidates are filtered upstream so the picker never shows them.

   Active swatch gets a ring around the circle in the swatch's own color
   (so the affordance reads "this is the selected one" without relying
   on an external accent). */
.deal-card .s-color .color-picker {
  display: flex; flex-direction: column; gap: 8px;
}
.color-swatches {
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: stretch;
}
.color-swatch {
  --swatch: var(--foreground);
  display: inline-flex; flex-direction: column; align-items: center;
  gap: 6px;
  padding: 8px 10px 6px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: transform 80ms ease, border-color 80ms ease, background 80ms ease;
  min-width: 78px;
}
.color-swatch:hover {
  background: var(--surface-tinted);
  border-color: var(--foreground);
}
.color-swatch:active {
  transform: translateY(0.5px);
}
.color-swatch .swatch-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--swatch);
  /* Subtle inner ring so light-on-light swatches still read as a chip
     on light themes and dark-on-dark on dark themes. */
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18),
              0 1px 2px rgba(0, 0, 0, 0.15);
}
.color-swatch .swatch-label {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted-foreground, color-mix(in oklch, var(--foreground) 65%, transparent));
  font-family: var(--font-mono, ui-monospace, monospace);
}
.color-swatch.is-active {
  border-color: var(--swatch);
  background: color-mix(in oklch, var(--swatch) 12%, var(--surface-elevated));
}
.color-swatch.is-active .swatch-circle {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5),
              0 0 0 2px var(--swatch),
              0 0 0 3px var(--surface);
}
.color-swatch.is-active .swatch-label {
  color: var(--foreground);
  font-weight: 600;
}
.color-picker-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px;
}
.color-picker-status .arrow {
  opacity: 0.7;
}

@media (max-width: 720px) {
  .color-swatches { gap: 6px; }
  .color-swatch { min-width: 64px; padding: 6px 8px 4px; }
  .color-swatch .swatch-circle { width: 22px; height: 22px; }
}

/* ── Custom-color swatch + inline picker ────────────────────────────
   The CUSTOM swatch is always present after the preset row. When no
   custom hex is pinned, the circle is filled with a conic rainbow
   (the universal "pick any color" affordance) and overlaid with the
   Lucide pipette glyph. When a custom hex IS pinned, the circle adopts
   that color and the pipette is dropped. Click toggles the inline
   picker below the row. */
.color-swatch--custom .swatch-circle {
  position: relative;
  background: conic-gradient(
    from 0deg,
    #ff5252, #ffb142, #ffe66d, #6bcb77,
    #4ac4d4, #5b8def, #9c64f8, #f56eb3, #ff5252
  );
  /* When a custom color is pinned, the inline style sets --swatch which
     overrides the gradient via the rule below. */
}
.color-swatch--custom[style*="--swatch:"]:not([data-hex=""]) .swatch-circle {
  background: var(--swatch);
}
.color-swatch--custom .swatch-circle svg {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 14px; height: 14px;
  color: rgba(255, 255, 255, 0.95);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.5));
}
.color-swatch--custom[data-hex]:not([data-hex=""]) .swatch-circle svg {
  display: none;
}

/* Inline picker — collapses by default, expands beneath the swatches
   when the user clicks CUSTOM. Single-row layout: native wheel · hex
   input · 3 RGB inputs · close button. Inputs are sized for keyboard
   entry, not mobile thumbs — narrow, monospace, tight. */
.custom-color-picker {
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  /* Live preview of the current pick — used as a subtle inset bar so the
     picker frame agrees with the swatch state at a glance. */
  box-shadow: inset 0 -2px 0 var(--ccp-preview, var(--border));
}
.custom-color-picker[hidden] { display: none; }
.ccp-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
}
.ccp-wheel {
  /* Native <input type="color"> — its swatch UI styling is OS-dependent,
     but the click target is what matters. Strip the browser chrome so it
     reads as part of our row, not as a default form field. */
  appearance: none;
  -webkit-appearance: none;
  width: 36px; height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.ccp-wheel::-webkit-color-swatch-wrapper { padding: 2px; }
.ccp-wheel::-webkit-color-swatch { border: none; border-radius: 6px; }
.ccp-wheel::-moz-color-swatch { border: none; border-radius: 6px; }

.ccp-hex-wrap, .ccp-rgb-wrap {
  display: inline-flex; align-items: center; gap: 6px;
}
.ccp-label {
  font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted-foreground, color-mix(in oklch, var(--foreground) 65%, transparent));
  font-family: var(--font-mono, ui-monospace, monospace);
}
.ccp-hex, .ccp-rgb {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  padding: 5px 8px;
  color: var(--foreground);
}
.ccp-hex { width: 92px; }
.ccp-rgb { width: 56px; text-align: right; }
.ccp-hex:focus, .ccp-rgb:focus {
  outline: none;
  border-color: var(--foreground);
}
.ccp-rgb::-webkit-outer-spin-button,
.ccp-rgb::-webkit-inner-spin-button {
  /* Strip native spinners so the row stays tight — keyboard ↑/↓ still works. */
  -webkit-appearance: none;
  margin: 0;
}
.ccp-rgb { -moz-appearance: textfield; }

.ccp-close {
  margin-left: auto;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 6px;
}

@media (max-width: 720px) {
  .ccp-row { gap: 8px; }
  .ccp-hex { width: 80px; }
  .ccp-rgb { width: 48px; }
}

/* ── LucidLabs sub-tab ─────────────────────────────────────────────────
   Auto-populated bonds for PEAQ + ETH-ERA pulled live from the BondVesting
   contracts. The wallet is hardcoded server-side; the meta strip just
   surfaces which wallet was queried so a future second-wallet onboarding
   doesn't render under the assumption that the existing one is canonical. */
.lucid-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 14px 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.lucid-meta code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 6px;
  background: var(--surface-tinted);
  border-radius: 4px;
}
.lucid-meta-sep { opacity: 0.5; }

.lucid-venue-card { margin-top: 14px; }
.lucid-venue-card .card-title code {
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ── Collapsible venue header ─────────────────────────────────────────
   The whole title bar is the toggle; the action cluster inside it keeps
   its own cursor so the buttons don't read as part of the fold. */
.lucid-venue-title {
  cursor: pointer;
  user-select: none;
}
.lucid-venue-title:focus-visible {
  outline: 2px solid var(--accent, #38bdf8);
  outline-offset: 2px;
  border-radius: 4px;
}
.lucid-venue-actions { cursor: default; }
.lucid-venue-caret {
  display: inline-block;
  width: 12px;
  margin-right: 2px;
  opacity: 0.65;
  font-size: 11px;
}
.lucid-venue-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.lucid-chain-icon {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  overflow: hidden;
  flex: none;
}
.lucid-chain-icon img { width: 100%; height: 100%; object-fit: cover; }
.lucid-venue-tally { margin-left: 6px; }
.lucid-price-chip { margin-left: 6px; font-variant-numeric: tabular-nums; }
.lucid-unpriced-note { margin-left: 6px; font-weight: 400; }

/* Amount-unit segmented control, inline in the Bonds card title next to
   Refresh. .section-toggle is already inline-flex + fit-content; it only
   needs to stop the flex title from stretching it. */
.lucid-unit-toggle {
  margin-left: 10px;
  flex: none;
  align-self: center;
}

/* ── Cross-card column alignment (Lucid bonds + Sablier streams) ──────
   Every venue renders its own <table> — three on the Lucid tab (PEAQ /
   ETH / BSC), one per (wallet, chain) on Sablier. Under auto layout each
   sized to its own content — a 7-char PEAQ allocation beside a 10-char
   LAB one — so the grids never lined up. Fixed layout + explicit widths
   makes the column geometry a property of the PAGE, not of each table's
   data. min-width keeps the columns readable on a narrow viewport;
   .table-scroll then scrolls.

   The two tables have DIFFERENT column counts (Lucid 14, Sablier 15 — it
   carries an extra Created date), so each gets its own width set and the
   Lucid rules explicitly exclude the Sablier table. Widths must sum to
   100: a set that sums to 100 BEFORE the last column starves it to 0px,
   and a 0px cell with wrappable text breaks one character per line and
   stretches the whole row (that is exactly what the first cut of this
   block did to any row carrying a deal chip). */
table.lucid-bond-table {
  font-size: 12.5px;
  table-layout: fixed;
  width: 100%;
  min-width: 1120px;
}
/* Uniform row height: every cell is one line, clipped with an ellipsis.
   The long-text cells (bond/stream label, deal chip) carry a title so the
   full value is a hover away. Without this, one wrapping cell makes its
   row taller than its neighbours and the eye loses the grid. */
.lucid-bond-table th,
.lucid-bond-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.lucid-bond-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Lucid — 14 columns. 3+10+6+6+6+8+7+8+7+8+8+9+6+8 = 100. */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(1),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(1)  { width: 3%; }   /* checkbox      */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(2),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(2)  { width: 10%; }  /* Bond          */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(3),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(3)  { width: 6%; }   /* Start         */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(4),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(4)  { width: 6%; }   /* Cliff         */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(5),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(5)  { width: 6%; }   /* Vest end      */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(6),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(6)  { width: 8%; }   /* Allocation    */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(7),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(7)  { width: 7%; }   /* % vested now  */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(8),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(8)  { width: 8%; }   /* Locked now    */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(9),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(9)  { width: 7%; }   /* % vested @val */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(10),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(10) { width: 8%; }   /* Locked @ val  */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(11),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(11) { width: 8%; }   /* Claimable     */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(12),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(12) { width: 9%; }   /* Held now      */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(13),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(13) { width: 6%; }   /* Status        */
.lucid-bond-table:not(.sablier-stream-table) th:nth-child(14),
.lucid-bond-table:not(.sablier-stream-table) td:nth-child(14) { width: 8%; }   /* Deal          */

/* Sablier — 15 columns (Stream, Created, Start, Cliff, Vest end, …).
   3+10+5.5+5.5+5.5+5.5+8+6+8+6+8+8+8+6+7 = 100. */
.sablier-stream-table th:nth-child(1),
.sablier-stream-table td:nth-child(1)  { width: 3%; }   /* checkbox      */
.sablier-stream-table th:nth-child(2),
.sablier-stream-table td:nth-child(2)  { width: 10%; }  /* Stream        */
.sablier-stream-table th:nth-child(3),
.sablier-stream-table td:nth-child(3)  { width: 5.5%; } /* Created       */
.sablier-stream-table th:nth-child(4),
.sablier-stream-table td:nth-child(4)  { width: 5.5%; } /* Start         */
.sablier-stream-table th:nth-child(5),
.sablier-stream-table td:nth-child(5)  { width: 5.5%; } /* Cliff         */
.sablier-stream-table th:nth-child(6),
.sablier-stream-table td:nth-child(6)  { width: 5.5%; } /* Vest end      */
.sablier-stream-table th:nth-child(7),
.sablier-stream-table td:nth-child(7)  { width: 8%; }   /* Deposit       */
.sablier-stream-table th:nth-child(8),
.sablier-stream-table td:nth-child(8)  { width: 6%; }   /* % vested now  */
.sablier-stream-table th:nth-child(9),
.sablier-stream-table td:nth-child(9)  { width: 8%; }   /* Locked now    */
.sablier-stream-table th:nth-child(10),
.sablier-stream-table td:nth-child(10) { width: 6%; }   /* % vested @val */
.sablier-stream-table th:nth-child(11),
.sablier-stream-table td:nth-child(11) { width: 8%; }   /* Locked @ val  */
.sablier-stream-table th:nth-child(12),
.sablier-stream-table td:nth-child(12) { width: 8%; }   /* Claimable     */
.sablier-stream-table th:nth-child(13),
.sablier-stream-table td:nth-child(13) { width: 8%; }   /* Held now      */
.sablier-stream-table th:nth-child(14),
.sablier-stream-table td:nth-child(14) { width: 6%; }   /* Status        */
.sablier-stream-table th:nth-child(15),
.sablier-stream-table td:nth-child(15) { width: 7%; }   /* Deal          */

/* Held (now) = Locked + Claimable: the tokens still in the contract, i.e.
   the hedge target. Set apart from its neighbours so it reads as the
   answer column rather than one more breakdown figure. */
.lucid-bond-table .lucid-held-cell {
  font-weight: 600;
  color: var(--otc-hedge);
  background: color-mix(in srgb, var(--otc-hedge) 8%, transparent);
  border-left: 1px solid color-mix(in srgb, var(--otc-hedge) 35%, transparent);
}
.lucid-bond-table thead .lucid-held-cell { cursor: help; }
.lucid-bond-table tfoot .lucid-total-row td.lucid-held-cell {
  background: color-mix(in srgb, var(--otc-hedge) 14%, transparent);
}

.lucid-bond-table tfoot .lucid-total-row td {
  font-weight: 600;
  border-top: 1px solid var(--border);
  background: var(--surface-tinted);
}

.lucid-status {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.lucid-status-vesting     { background: rgba(56,189,248,0.12); color: #38bdf8; }
.lucid-status-not-started { background: rgba(148,163,184,0.16); color: #94a3b8; }
.lucid-status-fully-vested{ background: rgba(34,197,94,0.14);  color: #22c55e; }
/* One read leg down — the venue's row list is SHORT. Amber, not red: the
   rows shown are real, it's the absences that lie. */
.lucid-status-partial     { background: rgba(208,139,0,0.16);  color: #d08b00; }

.lucid-partial-warn {
  border-radius: 6px;
  line-height: 1.45;
}
.lucid-partial-warn strong { color: #d08b00; }

.lucid-add-btn {
  font-size: 11.5px;
  padding: 3px 10px;
}

/* ── Selection model ──────────────────────────────────────────────────
   Each bond row carries a checkbox in the first column. Selecting any
   row pins the active "vesting key" (start/cliff/end tuple); rows whose
   key doesn't match get the .is-locked class — visually faded + the
   checkbox sets [disabled] so the user can only bundle co-vesting bonds. */
.lucid-sel-cell {
  width: 28px;
  text-align: center;
  padding-left: 8px !important;
  padding-right: 4px !important;
}
.lucid-sel-cb {
  cursor: pointer;
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--ticker-color, var(--primary));
}
.lucid-sel-cb:disabled { cursor: not-allowed; }

.lucid-bond-row.is-locked { opacity: 0.38; }
.lucid-bond-row.is-locked:hover { background: transparent; }
.lucid-bond-row.is-selected {
  background: rgba(56,189,248,0.06);
}
.lucid-bond-row.is-selected:hover {
  background: rgba(56,189,248,0.10);
}

.lucid-sel-summary {
  font-variant-numeric: tabular-nums;
}
.lucid-venue-actions .ghost {
  font-size: 11.5px;
  padding: 4px 10px;
}
.lucid-venue-actions .ghost[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Envelope preview chip — the shape a mixed-schedule selection will book
   as (e.g. "50.1% at cliff +30d vest · 2 legs"), shown before the user
   commits. Tabular numerals so the percentage doesn't jitter as rows are
   ticked on and off. */
.lucid-env-chip {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  align-self: center;
}

/* "Add to…" merge-into-existing picker. Matches the Sablier sold-input
   metrics so the three controls in the venue action bar line up. */
.lucid-attach-select,
.sablier-attach-select {
  font-size: 11.5px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-card);
  color: var(--foreground);
  max-width: 200px;
}

/* Bond cell — token icon sits inline with the symbol/#idx text. The
   shared .ticker-icon styling already gives it the perfect circle clip;
   we just need a slightly larger size than the body-text 1em default
   so the logo is legible in the dense table row. */
.lucid-bond-table td .ticker-icon {
  width: 16px;
  height: 16px;
  vertical-align: middle;
}

/* ── Lucid byline ─────────────────────────────────────────────────────
   "Vesting via [Lucid Labs logo]" pill in the Lucid card-title — same
   visual treatment as the Formidium .admin-byline elsewhere. The Lucid
   wordmark SVG uses currentColor, but loading via <img> or background-
   image strips that out — masks let us drive ink via background-color
   instead, so the logo follows the foreground color naturally (black
   on light theme, white on dark theme). No two-file swap required. */
.lucid-byline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-elevated);
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.lucid-byline:hover {
  border-color: var(--border-strong);
  background: var(--surface-tinted);
}
.lucid-byline-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}
.lucid-byline-logo {
  display: inline-block;
  /* 153×42 source viewBox → preserve aspect at 18px tall = ~66px wide. */
  width: 66px;
  height: 18px;
  background-color: var(--foreground);
  -webkit-mask-image: url('/lucid-logo.svg');
          mask-image: url('/lucid-logo.svg');
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: left center;
          mask-position: left center;
  -webkit-mask-size: contain;
          mask-size: contain;
}
@media (max-width: 640px) {
  .lucid-byline { margin-left: 0; }
}

/* ── Tied-deal chip in bond rows ─────────────────────────────────────
   Replaces the per-row Add button when a bond is already attached to
   a deal. Reads as an inline link — small mono name + arrow on hover. */
.lucid-deal-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  /* Deal names outrun the Deal column; clip the chip itself so the row
     keeps its one-line height (the full name is in the title attribute). */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--foreground);
  text-decoration: none;
  transition: border-color 0.12s, background 0.12s;
}
.lucid-deal-chip:hover {
  border-color: var(--border-strong);
  background: var(--surface-tinted);
}
.lucid-deal-chip::after {
  content: '↗';
  font-size: 10px;
  opacity: 0.6;
}
.lucid-bond-row.is-tied {
  /* Subtle backdrop on tied rows so the table reads as "these N bonds
     are owned by a deal" at a glance, without overpowering the row text. */
  background: rgba(56,189,248,0.025);
}

/* ── Cross-tab flash highlight ───────────────────────────────────────
   Fires after a deal-chip → card jump (or vice versa) so the user's
   eye lands on the right element after the smooth scroll completes.
   1.5s decay matches the JS removal timer. */
@keyframes lucidFlash {
  0%   { box-shadow: 0 0 0 2px rgba(56,189,248,0.6), 0 0 18px rgba(56,189,248,0.45); }
  100% { box-shadow: 0 0 0 0 rgba(56,189,248,0), 0 0 0 rgba(56,189,248,0); }
}
.lucid-deal-flash {
  animation: lucidFlash 1.5s ease-out;
}
.lucid-row-flash td {
  background: rgba(56,189,248,0.18) !important;
  animation: lucidRowFlash 1.5s ease-out;
}
@keyframes lucidRowFlash {
  0%   { background: rgba(56,189,248,0.30); }
  100% { background: transparent; }
}

/* ── Lucid provenance button on deal-head-actions ────────────────────
   "N× on-chain" pill with the Lucid icon (extracted from the wordmark)
   on the left. Sits between Backtest and Delete in the deal-card head;
   padding + font-size match .deal-backtest so all three buttons share a
   uniform vertical footprint. Mask-image lets background-color drive
   the icon ink so it follows the foreground color across themes. */
.deal-lucid-jump {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s, background 0.12s;
}
.deal-lucid-jump:hover {
  border-color: var(--border-strong);
  color: var(--foreground);
  background: var(--surface-tinted);
}
.deal-lucid-jump-logo {
  display: inline-block;
  width: 14px;
  height: 13px;
  background-color: currentColor;
  -webkit-mask-image: url('/lucid-icon.svg');
          mask-image: url('/lucid-icon.svg');
  -webkit-mask-repeat: no-repeat;
          mask-repeat: no-repeat;
  -webkit-mask-position: center;
          mask-position: center;
  -webkit-mask-size: contain;
          mask-size: contain;
}

/* ── Lucid-synced field visual ───────────────────────────────────────
   Inputs the server-side overlay rewrites on every read. We mark them
   read-only and visually distinct so the user understands these
   numbers come from the chain, not their edit history. The lock
   colour mirrors the cross-tab flash blue so the on-chain provenance
   reads as a coherent visual identity across the Lucid features. */
input.lucid-locked,
select.lucid-locked {
  background: rgba(56,189,248,0.06) !important;
  border-color: rgba(56,189,248,0.35) !important;
  cursor: not-allowed;
  /* The native readOnly contrast is too subtle on dark themes; bump it. */
  color: var(--foreground);
}
input.lucid-locked:focus,
select.lucid-locked:focus {
  outline: none;
  border-color: rgba(56,189,248,0.55) !important;
}

.lucid-sync-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(56,189,248,0.04);
  color: var(--muted-foreground);
}
.lucid-sync-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgb(56,189,248);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.18);
}

/* ── Sablier sub-tab ───────────────────────────────────────────────────
   The Sablier renderer reuses the .lucid-* table / status / selection /
   sync-strip / locked-field visuals (shared class names), so this block
   only carries the Sablier-specific brand chrome + a couple of stream-row
   tweaks. The provenance blue (.lucid-row-flash, .lucid-locked, etc.) is
   deliberately shared so "synced from chain" reads as one visual identity
   across both vesting integrations. */
.sablier-tab-svg {
  display: block;
  width: 13px;
  height: 16px;
  fill: currentColor;
}

/* "Streaming via [mark] Sablier" pill — same shape as the Lucid byline.
   The hourglass mark carries the Sablier brand orange; the wordmark
   follows the foreground colour so it reads on both themes. */
.sablier-byline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-elevated);
  white-space: nowrap;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sablier-byline:hover {
  border-color: var(--border-strong);
  background: var(--surface-tinted);
}
.sablier-byline-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted-foreground);
}
.sablier-byline-logo {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sablier-byline-svg {
  display: block;
  width: 15px;
  height: 18px;
  fill: #f77423;
}
.sablier-byline-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--foreground);
}
@media (max-width: 640px) {
  .sablier-byline { margin-left: 0 !important; }
}

/* Wallet codes in the meta strip — two short addresses sit in one code box. */
#sablier-wallets span { font-family: var(--font-mono); }

/* Sablier provenance badge logo on the deal card — the hourglass mark in
   the button's currentColor, matching .deal-lucid-jump-logo. */
.deal-sablier-jump-svg {
  display: block;
  width: 12px;
  height: 14px;
  fill: currentColor;
}

/* Canceled-stream tag in the Stream cell — a Sablier stream can be
   canceled by the sender; intactAmount still reflects the recipient's
   remaining entitlement, so we surface it rather than hiding the row. */
.sablier-cancel-tag {
  display: inline-block;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(239,68,68,0.14);
  color: #ef4444;
  vertical-align: middle;
}

/* Combine-time "Sold (opt.)" input in the venue actions row — record an
   off-chain resale against the bundle before pushing it to a deal. */
.sablier-sold-input {
  width: 108px;
  font-size: 11.5px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-card);
  color: var(--foreground);
}
.sablier-sold-input::placeholder { color: var(--muted-foreground); opacity: 0.8; }

/* Editable resale row on the Sablier-sourced deal card. The Sablier
   orange echoes the byline/badge so the resale affordance reads as part
   of the same integration; sits above the locked schedule fields. */
.sablier-sold-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(247,116,35,0.05);
  flex-wrap: wrap;
}
.sablier-sold-icon {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f77423;
  box-shadow: 0 0 0 3px rgba(247,116,35,0.18);
  flex-shrink: 0;
}
.sablier-sold-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}
.sablier-sold-field {
  width: 150px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-card);
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}
.sablier-sold-field:focus {
  outline: none;
  border-color: rgba(247,116,35,0.55);
}
.sablier-sold-unit { font-size: 11px; color: var(--muted-foreground); }
.sablier-sold-net { margin-left: auto; font-variant-numeric: tabular-nums; }

/* ════════════════════════════════════════════════════════════════════
   Perps Manager — auto-link engine view + scrubber.
   ════════════════════════════════════════════════════════════════════ */

/* Read-only live-hedge rows on deal cards. The picker controls are
   gone; what remains is the chip + percentage readout, presented as
   a static, slightly de-emphasised list. */
.live-hedge-row.is-readonly {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-card);
}
.live-hedge-row.is-readonly .live-hedge-slider-wrap {
  flex-direction: column;
  align-items: flex-end;
}
.live-hedge-row.is-readonly .live-hedge-slider-readout {
  font-family: var(--font-mono);
  font-size: 12px;
  text-align: right;
  display: flex; gap: 8px; align-items: baseline;
}
.live-hedge-row.is-readonly [data-lh="weight-pct"] {
  font-weight: 600;
  color: var(--foreground);
}

/* Managed-by-engine note on the deal card. Slightly emphasised so the
   user spots the explanation when they expand a live-mode deal. */
.live-hedge-managed-note {
  padding: 10px 12px;
  margin-bottom: 8px;
  border-left: 3px solid color-mix(in srgb, var(--ring) 60%, transparent);
  background: color-mix(in srgb, var(--ring) 6%, transparent);
  border-radius: 0 4px 4px 0;
}
.live-hedge-managed-note .link-jump {
  color: var(--ring);
  text-decoration: underline;
  text-decoration-style: dotted;
  cursor: pointer;
}
.live-hedge-managed-note .link-jump:hover {
  text-decoration-style: solid;
}

/* ── Perps tab layout ─────────────────────────────────────────────── */
.perps-kpi-grid { margin-top: 12px; }

.perps-tickers-host {
  display: grid;
  /* Cap at 3 columns max even on wide viewports — beyond that the cards
     get wider than they're useful and the eye has to track too far
     horizontally to compare. Shrinks down through 2 cols → 1 col as
     the viewport narrows. min(420px, 100%) lets the last card collapse
     gracefully under 540px so it doesn't overflow on mobile. The grid
     itself stretches to the full container width so cards expand to
     fill any leftover horizontal space (no whitespace on the right). */
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  gap: 12px;
  margin-top: 8px;
}
@media (min-width: 1340px) {
  /* Past 1340px the auto-fill would start packing 4+ columns. Force
     3 columns explicitly above this threshold; the `1fr` track sizing
     means each card claims an equal third of the container. */
  .perps-tickers-host {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
/* Inner tables (per-deal allocation + per-leg detail). The cards
   live inside a CSS grid whose tracks can shrink below their
   `minmax(420px, 1fr)` lower bound on narrow viewports — so the
   tables need to scroll horizontally when their columns don't fit.
   The renderer wraps each table in a .perps-ticker-tbl-wrap div
   (acts like .table-scroll). The card itself stays clipped so the
   over-hedge chip doesn't bleed out the right edge. */
.perps-ticker-card {
  min-width: 0;
  overflow: hidden;
}
.perps-ticker-tbl-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.perps-ticker-deals,
.perps-ticker-legs {
  table-layout: auto;
  width: 100%;
}

/* Status filter buttons inside the Perps timeline card. The shared
   timeline component looks for `.${idPrefix}-timeline-status .seg-btn`
   to flip the `active` class on click. The button visuals are inherited
   from .seg-btn but we still need the wrapper layout. */
.perps-timeline-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.perps-empty {
  padding: 24px;
  text-align: center;
  font-style: italic;
}

/* Per-ticker coverage card. Each card carries a --ticker-color
   custom prop (set inline from JS) so the header strip, the ticker
   symbol, and the coverage % all pull from the same accent. */
.perps-ticker-card {
  background: var(--surface-card-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
}
.perps-ticker-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--ticker-color, var(--foreground));
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0.6;
}

.perps-ticker-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
/* Stacks on top of .ticker-icon (cards.css) — that base class already
   handles overflow:hidden, border-radius:50%, and the `img { width:100%;
   height:100% }` rule that crops the icon inside the circle. We just
   bump the size to 22px (vs the inline 1em default) and tint the
   placeholder bg with the ticker brand color while the img loads. */
.perps-ticker-icon {
  width: 22px !important;
  height: 22px !important;
  flex: 0 0 22px;
  margin-right: 0;
  background: var(--ticker-color, var(--muted));
}
.perps-ticker-sym {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  color: var(--ticker-color, var(--foreground));
}
.perps-ticker-ratio {
  font-family: var(--font-mono);
}
.perps-leg-closed-note { font-family: var(--font-mono); }
.perps-ticker-pct {
  margin-left: auto;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  color: var(--foreground);
}
.perps-ticker-pct.is-over {
  color: var(--status-dev, #d97706);
}

/* Coverage bar — same per-venue segmentation as the deal-card
   live-hedge totals bar but in a slimmer container. The container
   itself isn't clipped so the over-hedge chip can sit flush at the
   right edge; the fill region inside IS clipped to the rounded
   pill so per-venue segments respect the rounded corners. */
.perps-bar {
  width: 100%;
  height: 6px;
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
}
.perps-bar-fill {
  display: flex;
  height: 6px;
  flex: 1;
  background: var(--input);
  border-radius: 3px;
  overflow: hidden;
}
.perps-bar-seg {
  display: block;
  height: 100%;
  min-width: 0;
}
/* Over-hedge chip — slim "+45%" pill aligned to the right of the bar.
   Picks up the same warning hue as .perps-ticker-pct.is-over so the
   two surfaces read consistently. */
.perps-bar-overshoot {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--status-dev, #d97706);
  background: color-mix(in srgb, var(--status-dev, #d97706) 14%, transparent);
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Over-hedged deal rows inside the per-ticker deals table. The
   numeric coverage cell gets the warning hue; the row gets a faint
   bg tint so the operator's eye finds it fast. */
.perps-ticker-deals tr.is-over {
  background: color-mix(in srgb, var(--status-dev, #d97706) 5%, transparent);
}
.perps-ticker-deals td.is-over {
  color: var(--status-dev, #d97706);
  font-weight: 600;
}

/* Per-deal + per-leg breakdown tables inside the card. Compact, with
   a divider between deals and legs. */
.perps-ticker-deals, .perps-ticker-legs {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.perps-ticker-deals th, .perps-ticker-legs th {
  font-weight: 500;
  color: var(--muted-foreground);
  padding: 4px 6px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.perps-ticker-deals th.num, .perps-ticker-legs th.num { text-align: right; }
.perps-ticker-deals td, .perps-ticker-legs td {
  padding: 4px 6px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
}
.perps-ticker-deals td.num, .perps-ticker-legs td.num {
  text-align: right;
  font-family: var(--font-mono);
}
.perps-ticker-deals tbody tr:last-child td,
.perps-ticker-legs tbody tr:last-child td { border-bottom: none; }
.perps-ticker-legs { margin-top: 4px; }
.perps-ticker-legs tr.is-closed { opacity: 0.55; }

.perps-deal-name {
  font-weight: 500;
}

/* Scrubber card — sits below the per-ticker cards. Reuses the
   .cex-scrubber-* classes (shared component), with a couple of
   per-page overrides for the breakdown column widths. */
.perps-timeline-card { margin-top: 8px; }

/* Pinned column widths — `table-layout: fixed` with explicit per-column
   widths means the browser can't redistribute fractional pixels between
   cells on each layout pass. Without this, sub-pixel container-width
   wobble during scrub (browser scrollbar toggle, FLIP animations
   re-flowing) walks column boundaries left-to-right with accumulating
   round-off error — visible as columns on the right "breathing" while
   the user drags the scrubber. Mirrors the /cex + /defi pattern.
   The Deal/Position column (3rd) is intentionally unsized so it
   absorbs the remaining space — its content (deal names + symbols)
   is the only column with variable-length text that benefits from
   the flex. */
#perps-timeline-day-table {
  table-layout: fixed;
  width: 100%;
}
#perps-timeline-day-table th:nth-child(1),
#perps-timeline-day-table td:nth-child(1) { width: 100px; }   /* Ticker — icon + symbol */
#perps-timeline-day-table th:nth-child(2),
#perps-timeline-day-table td:nth-child(2) { width: 78px;  }   /* Kind — TICKER/DEAL/PERP tag */
/* col 3 = Deal / Position — flex */
#perps-timeline-day-table th:nth-child(4),
#perps-timeline-day-table td:nth-child(4) { width: 92px;  }   /* Venue — exchange badge */
#perps-timeline-day-table th:nth-child(5),
#perps-timeline-day-table td:nth-child(5) { width: 112px; }   /* Tokens — mono num */
#perps-timeline-day-table th:nth-child(6),
#perps-timeline-day-table td:nth-child(6) { width: 112px; }   /* Hedged — mono num */
#perps-timeline-day-table th:nth-child(7),
#perps-timeline-day-table td:nth-child(7) { width: 90px;  }   /* Coverage % */
#perps-timeline-day-table th:nth-child(8),
#perps-timeline-day-table td:nth-child(8) { width: 78px;  }   /* Weight % */
#perps-timeline-day-table th:nth-child(9),
#perps-timeline-day-table td:nth-child(9) { width: 116px; }   /* Status tag */
/* Truncate the Deal/Position label gracefully when there's no room —
   long deal names (e.g. "PEAQ_Lucid_2025-11-03_x4") get an ellipsis
   instead of pushing into the next column. */
#perps-timeline-day-table td:nth-child(3) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Sortable column header arrows. Same convention /cex + /defi use:
   neutral state shows no glyph (so tight cols don't overflow), active
   asc/desc shows a filled triangle. The timeline component sets
   `data-sort-dir="asc"|"desc"` on the active th via
   refreshSortIndicators() — we just need the CSS pseudo-element. */
.perps-timeline-card thead th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.perps-timeline-card thead th.sortable:hover {
  color: var(--foreground);
}
.perps-timeline-card thead th.sortable[data-sort-dir]::after {
  display: inline-block;
  margin-left: 3px;
  font-size: 9px;
  font-weight: 600;
  vertical-align: middle;
  line-height: 1;
  color: var(--foreground);
}
.perps-timeline-card thead th.sortable[data-sort-dir="asc"]::after  { content: '▲'; }
.perps-timeline-card thead th.sortable[data-sort-dir="desc"]::after { content: '▼'; }
/* The shared timeline component flags filtered/pre-deal rows with
   classes that need a per-page display:none rule (cex.css scopes its
   rules to #cex-timeline-day-table; defi.css does the same for theirs).
   Without these the search + status-filter inputs update component
   state but the rows stay visible. */
#perps-timeline-day-table tbody tr.is-pre-open,
#perps-timeline-day-table tbody tr.is-hidden {
  display: none;
}
#perps-timeline-day-table tbody tr.is-closed td:not(.num) {
  color: var(--muted-foreground);
}
/* Visual subgrouping — every row in a ticker's cluster (summary, deals,
   perp legs) tints itself in that ticker's brand color via --ticker-color
   (set inline on each <tr> from perps.js → timeline.js ensureRow). The
   whole ERA cluster reads reddish-orange, the whole FET cluster reads
   in FET's hue, etc. Three intensity tiers separate the row types:
   summary (darkest, header strength) → deal (medium, "primary 1") →
   leg (lightest, "primary 2"). The left-border accent on cell 3 adds
   a second cue so spot vs perp reads even without color.
   The timeline component stores each row's key on `data-row-key`:
   summary → `sum|<ticker>`, deal → `deal|<id>`, perp → `leg|<exch>|<sym>`. */
#perps-timeline-day-table tbody tr[data-row-key^="deal|"] {
  background: color-mix(in srgb, var(--ticker-color, var(--foreground)) 12%, transparent);
}
#perps-timeline-day-table tbody tr[data-row-key^="deal|"] td:nth-child(3) {
  padding-left: 24px;
  border-left: 2px solid color-mix(in srgb, var(--ticker-color, var(--foreground)) 70%, transparent);
}
#perps-timeline-day-table tbody tr[data-row-key^="leg|"] {
  background: color-mix(in srgb, var(--ticker-color, var(--foreground)) 6%, transparent);
}
#perps-timeline-day-table tbody tr[data-row-key^="leg|"] td:nth-child(3) {
  padding-left: 24px;
  border-left: 2px solid color-mix(in srgb, var(--ticker-color, var(--foreground)) 40%, transparent);
}
/* Closed deals + closed perp legs — desaturate the ticker tint by
   blending it 50/50 with --muted-foreground, then drop the overall
   opacity. Result is a barely-there grey-tinted row that visually
   sits below the vivid open rows. Mirrors the greyed-out treatment
   completed deals get on their cards (commit 4e9846e). Higher
   specificity than the base rules above (.is-closed class adds a
   tier) so no !important needed. */
#perps-timeline-day-table tbody tr[data-row-key^="deal|"].is-closed {
  background: color-mix(
    in srgb,
    color-mix(in srgb, var(--ticker-color, var(--foreground)) 50%, var(--muted-foreground)) 5%,
    transparent
  );
}
#perps-timeline-day-table tbody tr[data-row-key^="deal|"].is-closed td:nth-child(3) {
  border-left-color: color-mix(in srgb, var(--muted-foreground) 35%, transparent);
}
#perps-timeline-day-table tbody tr[data-row-key^="leg|"].is-closed {
  background: color-mix(
    in srgb,
    color-mix(in srgb, var(--ticker-color, var(--foreground)) 50%, var(--muted-foreground)) 3%,
    transparent
  );
}
#perps-timeline-day-table tbody tr[data-row-key^="leg|"].is-closed td:nth-child(3) {
  border-left-color: color-mix(in srgb, var(--muted-foreground) 25%, transparent);
}
.perps-ticker-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.perps-row-icon {
  /* Stacks on top of .ticker-icon (cards.css) which owns the circle
     clipping + img sizing. Match the row's text height so the icon
     never bumps the row taller than its siblings. */
  width: 1em !important;
  height: 1em !important;
  flex: 0 0 1em;
  margin-right: 0;
}
.perps-row-ticker {
  font-family: var(--font-mono);
  font-weight: 600;
}

/* Summary row — bolds the ticker + total readouts. Uses the strongest
   tint of the ticker color (header strength) so the eye finds the group
   anchor above its tinted deals + perps. The composite firstOpenDate
   puts it at the top of each ticker's cluster; under the default sort
   it always sits before the matching deals + perps. */
#perps-timeline-day-table tbody tr[data-row-key^="sum|"] {
  background: color-mix(in srgb, var(--ticker-color, var(--foreground)) 20%, transparent);
}
#perps-timeline-day-table tbody tr[data-row-key^="sum|"] td {
  border-top: 1px solid color-mix(in srgb, var(--ticker-color, var(--foreground)) 45%, transparent);
  font-size: 12.5px;
}
.tag-summary {
  background: color-mix(in srgb, var(--ticker-color, var(--foreground)) 28%, transparent);
  color: var(--ticker-color, var(--foreground));
}

/* Status tag pills used in the timeline + per-leg tables. */
.tag {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  border-radius: 2px;
  font-weight: 600;
}
.tag-short {
  background: rgba(220, 38, 38, 0.12);
  color: #dc2626;
}
.tag-long {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
}
.tag-open { background: rgba(16, 185, 129, 0.12); color: #10b981; }
.tag-closed { background: rgba(100, 100, 100, 0.18); color: var(--muted-foreground); }
.tag-pending { background: rgba(217, 119, 6, 0.12); color: #d97706; }
.tag-deal { background: color-mix(in srgb, var(--ticker-color, var(--foreground)) 22%, transparent); color: var(--ticker-color, var(--foreground)); }
.tag-perp { background: color-mix(in srgb, var(--ticker-color, var(--foreground)) 16%, transparent); color: var(--ticker-color, var(--foreground)); }
.tag-basis { background: rgba(16, 185, 129, 0.10); color: #059669; }
.tag-over   { background: rgba(217, 119, 6, 0.16); color: #d97706; }
.tag.muted { opacity: 0.55; }

/* In-cell .is-over span (used in scrubber coverage column) — same hue as
   the tag pill and the per-ticker pct, drawn as a bold readout without
   pill chrome so it visually fits a numeric cell. */
.perps-timeline-card td .is-over,
#perps-timeline-day-table td .is-over {
  color: var(--status-dev, #d97706);
  font-weight: 600;
}

/* ── Vest Bridge sub-tab ─────────────────────────────────────────────────
   Status chips + the active-synthetic row accent. Mirrors the .tag pill
   palette used by the Perps sub-tab so the two read consistently. */
.bridge-chip {
  display: inline-block;
  padding: 1px 7px;
  font-size: 10.5px;
  font-weight: 600;
  border-radius: 3px;
  white-space: nowrap;
  background: rgba(100, 100, 100, 0.16);
  color: var(--muted-foreground);
}
.bridge-chip.bridge-active  { background: rgba(16, 185, 129, 0.14); color: #059669; }
.bridge-chip.bridge-pending { background: rgba(217, 119, 6, 0.14); color: #d97706; }
.bridge-chip.muted          { opacity: 0.7; }
/* Type column: Sablier claim rows get the indigo accent, vest rows stay muted. */
.bridge-chip.bridge-kind-claim { background: rgba(99, 102, 241, 0.14); color: #6366f1; }
/* Active synthetic row — left accent + faint tint so the operator sees at a
   glance which tranches are currently bridged into AUM. */
#bridge-table tr.bridge-row-active > td { background: rgba(16, 185, 129, 0.05); }
#bridge-table tr.bridge-row-active > td:first-child { box-shadow: inset 3px 0 0 0 #10b981; }
.bridge-ovr { font-size: 11px; padding: 2px 4px; }

/* ── Cadence section: per-tranche schedule + current valuation ───────────
   Mirrors the /analysis Tranches table, compacted to sit inside a deal card.
   row-mtm / row-disc accents reuse the analysis palette (MtM tranches valued
   at full spot vs discounted). */
.cadence-tranches { margin-top: 12px; }
.cadence-tranches-head { margin-bottom: 6px; }
.cadence-tranche-table { width: 100%; }
.cadence-tranche-table th,
.cadence-tranche-table td { padding: 3px 8px; font-size: 12px; white-space: nowrap; }
.cadence-tranche-table tbody tr.row-mtm  > td:first-child { box-shadow: inset 2px 0 0 0 var(--good, #10b981); }
.cadence-tranche-table tbody tr.row-disc > td:first-child { box-shadow: inset 2px 0 0 0 color-mix(in srgb, var(--muted-foreground, #888) 45%, transparent); }

/* ── EOM-sensitivity accent ──────────────────────────────────────────────
   Tranche rows whose MtM status flips when EOM discounts are toggled, in
   orange so the operator sees exactly which rows the toggle changes. Covers
   both the /analysis Tranches table and the Deals-card Cadence table. The
   first-child rail overrides the row-mtm/row-disc rail above (later + equal
   specificity wins). */
.an-tranche-table tbody tr.tranche-eom-flip > td,
.cadence-tranche-table tbody tr.tranche-eom-flip > td { background: rgba(217, 119, 6, 0.10); }
.an-tranche-table tbody tr.tranche-eom-flip > td:first-child,
.cadence-tranche-table tbody tr.tranche-eom-flip > td:first-child { box-shadow: inset 3px 0 0 0 var(--status-dev, #d97706); }
/* The Discount cell (2nd-from-last in both tables) is the value that flips. */
.an-tranche-table tbody tr.tranche-eom-flip > td:nth-last-child(2),
.cadence-tranche-table tbody tr.tranche-eom-flip > td:nth-last-child(2) { color: var(--status-dev, #d97706); font-weight: 600; }

/* ── Already-vested tranches ─────────────────────────────────────────────
   Cliff/vest steps whose unlock date is in the past — shown greyed for a
   complete schedule view (tokens that vested + their theoretical value now),
   but NOT part of any total (the valuation engines exclude them). Muted text
   + faint rail so they read as a finished/inactive timeline above the still-
   locked rows. Covers /analysis, the Deals-card Cadence table, and the OTC
   discount popup (which reuses .cadence-tranche-table). */
.an-tranche-table tbody tr.tranche-vested > td,
.cadence-tranche-table tbody tr.tranche-vested > td {
  color: var(--muted-foreground);
  opacity: 0.6;
}
.an-tranche-table tbody tr.tranche-vested > td:first-child,
.cadence-tranche-table tbody tr.tranche-vested > td:first-child {
  box-shadow: inset 2px 0 0 0 color-mix(in srgb, var(--muted-foreground) 22%, transparent);
}

