/*
 * Tickscope design tokens — Phase 3 foundation
 *
 * Canonical reference: DESIGN_TOKENS.md in the project root.
 *
 * Loading order in index.html:
 *   1. Brand font <link> (Google Fonts)
 *   2. <link rel="stylesheet" href="/tokens.css">   ← this file
 *   3. Existing inline <style> block
 *
 * Phase 3 strategy: tokens.css ships immediately so the design system
 * is available everywhere. The existing inline <style> block continues
 * to work because its hardcoded values either match these tokens
 * exactly (e.g. green/red/amber) or are slightly off (e.g. surface
 * #141519 vs #14141c) — close enough that nothing breaks. Per-tab
 * refactors progressively replace inline hex with var() references
 * from this file.
 *
 * What does NOT go here:
 *   - Component class definitions (.card, .banner, etc.) — those
 *     come in component CSS files during per-tab refactors, when we
 *     can verify each component against real usage.
 *   - Animations / motion tokens — Phase 4.
 *   - Light-mode overrides — out of scope for now.
 */

:root {
  /* ─── Brand ─── */
  --brand-purple-200: #a78bfa;  /* text on dark, active state */
  --brand-purple-300: #9b6bf5;  /* light accent */
  --brand-purple-400: #7c70f0;  /* accent / hover */
  --brand-purple-600: #5b52d4;  /* gradient start */
  --brand-purple-700: #6c3ed1;  /* gradient end (primary) */
  --brand-gradient: linear-gradient(135deg, #5b52d4 0%, #6c3ed1 100%);

  /* ─── Surfaces (dark theme) ─── */
  --bg:           #0a0a10;
  --surface:      #14141c;
  --surface-alt:  #1c1c26;
  --surface-hi:   #24242f;
  --border:       #2a2a35;
  --border-soft:  #1a1a22;

  /* ─── Text ─── */
  --text-primary:    #e4e4e7;
  --text-strong:     #ffffff;
  --text-secondary:  #c4c4c7;
  --text-muted:      #8f8f99;  /* P1 v9.48: was #7a7a85 - 4.32:1 on a card; approved via the fix-gallery pair */
  --text-dim:        #82828c;  /* P1 v9.48: was #5c5c66 - 2.99:1 on the page, and the v6.59 comment's ~3:1 target was missed on every card; sized against --surface now */
                                   the canvas). Lifted to ~3:1 so hints and the
                                   123 inline uses become readable. Tertiary
                                   micro-text ONLY — body text is --text-muted.
                                   See TYPOGRAPHY.md. */
  --text-on-brand:   #ffffff;

  /* ─── Semantic (status & data) ─── */
  --color-success:   #34d399;
  --color-warning:   #fbbf24;
  /* v6.57: vfat.tools brand gold — was a raw hex inside .pos-badge--vfat
     (and only there). Tokenized when the badge families merged. */
  --color-vfat:      #f0b90b;
  /* Chain brand accents (N25, v9.58) — the --color-vfat precedent applied:
     third-party brand colours are tokens, not raw hexes in JS. Read by
     CHAIN_DOTS via var(). */
  --chain-base:      #2f6bff;
  --chain-ethereum:  #8a92b2;
  --chain-arbitrum:  #28a0f0;
  --chain-hyperevm:  #0aca9c;
  --chain-robinhood: #00c805;
  --color-danger:    #f87171;
  --color-info:      #a78bfa;
  /* IL split (v5.39): realized = deeper red, unrealized = lighter red.
   * Used in the IL bar segments and the matching side labels so the
   * eye can read color\u2192value without consulting a legend. */
  --il-realized:     #b91c1c;
  --il-unrealized:   #fca5a5;

  /* ─── Chart series ─── */
  --chart-1:       #a78bfa;
  --chart-2:       #34d399;
  --chart-3:       #fbbf24;
  --chart-4:       #6366f1;
  /* The overlay-fit line in the liquidity charts (N23, v9.58). Canvas
     strokes carry the literal #f5f5f7 (a 2d context cannot read a var);
     the DOM legends read this token, and the near-miss hex guard in the
     suite keeps the two from drifting apart. */
  --chart-fit:     #f5f5f7;
  --chart-5:       #2dd4bf;
  --chart-6:       #f87171;
  --chart-neutral: #555555;

  /* ─── Heatmap divergent (signed metrics like Net APR) ─── */
  --heat-pos-strong: #15803d;
  --heat-pos-mid:    #34d399;
  --heat-pos-soft:   #a7f3d0;
  --heat-neutral:    #1f1f28;
  --heat-neg-soft:   #fecaca;
  --heat-neg-mid:    #f87171;
  --heat-neg-strong: #b91c1c;

  /* ─── Heatmap sequential (unsigned: MDD, time-in-range) ─── */
  --heat-seq-1: #14532d;  /* best (lowest MDD) */
  --heat-seq-2: #15803d;
  --heat-seq-3: #facc15;
  --heat-seq-4: #f97316;
  --heat-seq-5: #b91c1c;  /* worst (highest MDD) */

  /* ─── Typography ─── */
  --font-display: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  --font-body:    'DM Sans', system-ui, -apple-system, sans-serif;
  --font-mono:    'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace;

  /*
   * Note: --mono token kept below as alias for backward compat with
   * existing inline style block. Phase 3 progressively rewrites
   * var(--mono) → var(--font-mono) call sites.
   */
  --mono: 'IBM Plex Mono', 'JetBrains Mono', ui-monospace, monospace;

  --text-xs:   11px;   /* line-height 1.4; P2 v9.48: was 10px */
  --text-sm:   11px;
  --text-base: 12px;
  --text-md:   13px;
  --text-lg:   14px;
  --text-xl:   16px;
  --text-2xl:  20px;
  --text-3xl:  28px;
  --text-hero: 36px;

  --font-weight-regular:  400;
  --font-weight-medium:   500;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;

  --tracking-tight:  -0.01em;
  --tracking-normal:  0;
  --tracking-label:   0.04em;

  /* ─── Spacing (4px base) ─── */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* ─── Radius ─── */
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-lg:   8px;
  --radius-xl:   10px;
  --radius-2xl:  14px;
  --radius-full: 9999px;

  /* ─── Shadows (rare; elevation comes from surface lightness) ─── */
  --shadow-none: none;
  --shadow-sm:   0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 0 1px rgba(108, 62, 209, 0.4),
                 0 4px 12px rgba(108, 62, 209, 0.15);

  /*
   * ─── Back-compat aliases ───
   * The existing inline <style> block uses these short token names.
   * Mapping them here ensures the inline block works without edits
   * during the per-tab refactor. Phase 3 progressively replaces call
   * sites; this alias block gets shorter as that work proceeds.
   *
   * NOTE: a few values shift slightly (purposefully):
   *   --accent  : #6366f1 → #6c3ed1 (now brand purple, not indigo)
   *   --surface : #141519 → #14141c (subtle shift toward brand cast)
   *   --border  : #2a2a30 → #2a2a35 (one tone warmer)
   * These are tiny enough not to break anything visually; the upgrade
   * is intentional and the differences are barely perceptible.
   */
  --accent: var(--brand-purple-700);
  --green:  var(--color-success);
  --red:    var(--color-danger);
  --amber:  var(--color-warning);
  --muted:  var(--text-muted);
  --dim:    var(--text-dim);
}

/* ═══════════════════════════════════════════════════════════════
 * Phase 3 component library
 *
 * Reusable building blocks for the per-tab refactor. Each component
 * is added when first needed by an Overview/MC/etc. refactor and
 * audited for reuse before being copied elsewhere.
 *
 * Components currently defined:
 *   .tile / .tile-hero / .tile-large    — metric tile + hero variant
 *   .banner / .banner-{info,success,warning,danger}  — inline message
 *   .details-panel / .details-summary   — collapsible <details> wrapper
 *   .bar-comparison                     — Fees vs IL horizontal bars
 * ═══════════════════════════════════════════════════════════════ */

/* ─── Metric tile (replaces .stat) ───
 * The default tile is what a stat panel uses. .tile-hero is for the
 * single most important number on a tab — Tier 1 of the Overview IA.
 * Color is set per-instance via .tile--{success,danger,warning,info}.
 */
.tile {
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tile__label {
  font-size: var(--text-base);
  color: var(--text-muted);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  font-weight: var(--font-weight-medium);
}
.tile__value {
  font-size: var(--text-2xl);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-tight);
}
.tile__sub {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.tile--success .tile__value { color: var(--color-success); }
.tile--danger  .tile__value { color: var(--color-danger); }
.tile--warning .tile__value { color: var(--color-warning); }

/* Clickable tile variant \u2014 used on Heatmap best/worst tiles (v5.38).
 * Subtle affordance: cursor + slight hover lift + brighter border. */
.tile--clickable {
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.tile--clickable:hover {
  border-color: var(--brand-purple-400);
  transform: translateY(-1px);
}
.tile--clickable:active {
  transform: translateY(0);
}

/* Hero variant — for Net P&L on Overview. Bigger surface, larger
 * number, subtle gradient hint of the brand color when positive. */
.tile-hero {
  padding: var(--space-5) var(--space-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-2xl);
  margin-bottom: var(--space-4);
}
.tile-hero__label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-2);
}
.tile-hero__value {
  font-size: var(--text-hero);
  font-weight: var(--font-weight-bold);
  font-family: var(--font-display);
  letter-spacing: var(--tracking-tight);
  line-height: 1.05;
}
.tile-hero__sub {
  font-size: var(--text-md);
  color: var(--text-secondary);
  margin-top: var(--space-2);
  font-family: var(--font-mono);
}
.tile-hero--success .tile-hero__value { color: var(--color-success); }
.tile-hero--danger  .tile-hero__value { color: var(--color-danger); }

/* ─── Banner (replaces .breakeven-box and various inline boxes) ───
 * Used for inline messaging (status notes, fee viability, footnotes).
 * Five flavors: neutral / info / success / warning / danger.
 * Style: left-border accent in the semantic color, surface-alt bg.
 */
.banner {
  background: var(--surface-alt);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--text-secondary);
}
.banner--info    { border-left-color: var(--color-info); }
.banner--success { border-left-color: var(--color-success); }
.banner--warning { border-left-color: var(--color-warning); }
.banner--danger  { border-left-color: var(--color-danger); }
.banner__title {
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: 2px;
}
.banner__body {
  font-size: var(--text-base);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ─── Collapsible details panel ───
 * Wraps native <details>/<summary> to look intentional rather than
 * default-browser-ugly. The Overview "Details" footer uses this.
 */
.details-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-top: var(--space-4);
  overflow: hidden;
}
.details-panel > summary {
  list-style: none;
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.details-panel > summary::-webkit-details-marker { display: none; }
.details-panel > summary::after {
  content: '\002B'; /* + sign */
  font-family: var(--font-mono);
  font-size: var(--text-lg);
  color: var(--text-dim);
  font-weight: var(--font-weight-regular);
  transition: transform 120ms ease;
}
.details-panel[open] > summary::after {
  content: '\2212'; /* minus sign */
}
.details-panel > summary:hover {
  background: var(--surface-hi);
  color: var(--text-secondary);
}
.details-panel__body {
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ─── Fees vs IL bar comparison ───
 * Horizontal bars, side by side, showing fee income vs IL drag with
 * an explicit "Net" callout. The "why" tier on Overview.
 */
.bars-fees-il {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.bars-fees-il__header {
  font-size: var(--text-base);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-3);
}
.bars-fees-il__row {
  display: grid;
  /* v7.04: label column widened 60px -> 150px to carry __sub captions. The
   * statement reads as a chain of steps, and each step says WHY in a caption
   * under its name, so the user does not scroll back to the config bar to
   * recall what they set (owner, 2026-07-27). */
  grid-template-columns: 150px 1fr 110px;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.bars-fees-il__label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  font-weight: var(--font-weight-medium);
}
/* The caption under a step's name: what the number means, in the user's own
 * settings. Sentence case on purpose — it is prose, not a label. */
.bars-fees-il__sub {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-dim);
  text-transform: none;
  letter-spacing: 0;
  font-weight: var(--font-weight-regular, 400);
  margin-top: 1px;
}

/* ── LEVEL rows vs COMPONENT rows ────────────────────────────────────────
 * Component rows (fees, IL, emissions, gas) are SIGNED deltas and diverge
 * from the centre baseline — that is B3 (v6.35): sign reads from direction,
 * not colour alone. Level rows (deposited, ended with, had you just held)
 * are absolute magnitudes on a shared 0..max scale, so a centre baseline
 * would be meaningless for them. They get a left-anchored track with no
 * zero line. Mixing the two on one axis was the thing to avoid. */
.bars-fees-il__track--level::before { display: none; }
.bars-fees-il__fill--level {
  left: 0;
  border-radius: var(--radius-sm);
}
/* The starting capital: a plain neutral, deliberately NOT the track colour.
 * A fill equal to its own track renders as an empty row (v7.04 — the owner
 * caught exactly this on the mockup's HODL bar). */
.bars-fees-il__fill--neutral { background: var(--surface-hi); }
/* The HODL benchmark reads as a GHOST — hatched and outlined — so it is
 * visibly a reference line rather than another component of the sum. */
.bars-fees-il__fill--ghost {
  background: repeating-linear-gradient(135deg,
              var(--surface-hi) 0 5px, transparent 5px 10px);
  border: 1px solid var(--border);
}
/* The closing total carries the brand, being the number the tab exists for. */
.bars-fees-il__fill--total { background: var(--brand-gradient); }
/* A rule before the total, the way a statement rules off before its sum. */
.bars-fees-il__row--total {
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
  margin-top: var(--space-3);
}
.bars-fees-il__row--total .bars-fees-il__label { color: var(--text-strong); }
.bars-fees-il__row--total .bars-fees-il__amount { font-size: var(--text-lg); }
/* v7.06: LP vs HODL is a RATIO, not a term of the sum, so it is set apart
 * from the chain above it. Its bar diverges from the track's centre line,
 * which here means parity with holding: left = behind, right = ahead. */
.bars-fees-il__row--ratio {
  border-top: 1px dashed var(--border);
  padding-top: var(--space-3);
  margin-top: var(--space-2);
}
/* R79 (v11.123): a row OUTSIDE the sum. The idle-bins ceiling sits below
 * the total under the same dashed rule, so the component bars above the
 * total add up to the total. */
.bars-fees-il__row--aside {
  border-top: 1px dashed var(--border);
  padding-top: var(--space-3);
  margin-top: var(--space-2);
}
.bars-fees-il__track {
  height: 22px;
  background: var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
}
/* B3 (v6.35): a centre zero baseline \u2014 component bars diverge from here
 * (left = negative, right = positive) so SIGN reads from direction, not colour
 * alone. Replaces the v5.39 flex row where every fill was left-anchored and a
 * \u2212$5k IL drew identically to a +$5k fee. */
.bars-fees-il__track::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  margin-left: -0.5px;
  background: var(--border);
  z-index: 1;
}
.bars-fees-il__fill {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: var(--radius-sm);
  transition: width 200ms ease;
  display: flex;            /* lays out the two IL split segments */
  align-items: stretch;
  overflow: hidden;         /* clips the segments to the fill's rounded outer end */
}
/* Positive: pinned to centre, grows RIGHT; square the centre-side (left)
 * corners so the bar butts flush against the zero line. */
.bars-fees-il__fill--pos {
  left: 50%;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}
/* Negative: pinned to centre, grows LEFT; square the right corners. */
.bars-fees-il__fill--neg {
  right: 50%;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
/* COST: gas and swap costs are the same kind of row -- money the
 * strategy chose to pay, not a market move -- so they share one dim
 * neutral. It is a CLASS because the inline-style ratchet is a budget
 * that only goes down, and two rows drawing the same thing inline is
 * exactly what it exists to catch. */
.bars-fees-il__fill--cost    { background: var(--text-dim); }
.bars-fees-il__fill--success { background: var(--color-success); }
.bars-fees-il__fill--danger  { background: var(--color-danger); }
/* IL split (v5.39, restructured for B3 as inner segments of the IL fill):
 * realized (deeper red, "locked in") and unrealized (lighter red, "would
 * un-realize if price returns"). Sum equals the IL fill's width. */
.bars-fees-il__seg { flex-shrink: 0; }
.bars-fees-il__seg--il-realized   { background: var(--il-realized, #b91c1c); }
.bars-fees-il__seg--il-unrealized { background: var(--il-unrealized, #fca5a5); }

/* IL split legend (v5.42) \u2014 compact horizontal legend sitting under the
 * segmented IL bar. Two items (Realized / Unrealized), each with a color
 * swatch matching its bar segment, a label, and a value. Reads as a
 * legend, not as additional bar rows. Indented to align approximately
 * under the IL track. */
.il-split-legend {
  display: flex;
  gap: var(--space-5);
  padding: var(--space-1) 0 0 var(--space-5);
  flex-wrap: wrap;
}
.il-split-legend__item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.il-split-legend__swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.il-split-legend__label {
  color: var(--text-muted);
  font-size: var(--text-sm);
}
.il-split-legend__value {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
}
.bars-fees-il__amount {
  font-family: var(--font-mono);
  font-size: var(--text-md);
  font-weight: var(--font-weight-semibold);
  text-align: right;
}
.bars-fees-il__amount--cost    { color: var(--text-dim); }
.bars-fees-il__amount--success { color: var(--color-success); }
.bars-fees-il__amount--danger  { color: var(--color-danger); }

/* ─── Section header ───
 * A modest h3-equivalent for tab subsections. Used wherever a tab has
 * multiple distinct subareas (the MC tab's controls/summary/charts split,
 * for example). Not for hero headlines — those are tile-hero.
 */
/* v6.59 (TYPOGRAPHY.md): ONE section/tool title look. .section-header,
   .section-card__title and .comp-tool__title are grouped here so all tool
   headers render identically — comp-tool__title was --text-xl (16px), the
   reason the owner's three tool headers looked different sizes. */
.section-header,
.section-card__title,
.comp-tool__title {
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  font-family: var(--font-display);
  margin-bottom: var(--space-2);
}
/* ONE subtitle look (base / muted / body). .section-card__intro and
   .comp-tool__sub share it — comp-tool__sub was sm/secondary. */
.section-header__sub,
.section-card__intro,
.comp-tool__sub {
  font-size: var(--text-base);
  color: var(--text-muted);
  font-weight: var(--font-weight-regular);
  font-family: var(--font-body);
  line-height: 1.5;
  margin-top: var(--space-1);
  max-width: 780px;
}

/* ─── Slider group ───
 * A labeled slider with current-value display and an inline explainer.
 * The Phase 1 IA called this out as a reusable pattern after the MC tab
 * prototyped it in v5.11. Refactored from inline-styled markup so we get
 * consistent spacing/typography.
 */
.slider-group {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
}
.slider-group__label {
  font-size: var(--text-base);
  color: var(--text-muted);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  font-weight: var(--font-weight-medium);
  margin-bottom: var(--space-1);
}
.slider-group__input {
  width: 100%;
  accent-color: var(--brand-purple-700);
}
.slider-group__ticks {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-family: var(--font-mono);
  margin-top: 2px;
}
.slider-group__current {
  color: var(--brand-purple-200);
  font-weight: var(--font-weight-semibold);
}
.slider-group__hint {
  font-size: var(--text-xs);
  color: var(--text-dim);
  margin-top: var(--space-2);
  line-height: 1.5;
}

/* ─── Strategy echo strip ───
 * A horizontal strip of compact pill-style chips showing the current
 * strategy parameters at a glance. Used at the top of result panels
 * (MC, future Heatmap) so users don't have to scan the sidebar to
 * remember what they ran.
 *
 * Each chip is .chip with a small label on top and value below.
 */
.strategy-echo {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}
.chip {
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 80px;
}
.chip__label {
  font-size: var(--text-xs);
  color: var(--text-dim);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.chip__value {
  font-size: var(--text-md);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-mono);
  color: var(--text-primary);
}
.chip__value--brand {
  color: var(--brand-purple-200);
}

/* ─── Probability tiles (MC headline) ───
 * Three tiles side by side: prob profitable, prob beats HODL, median net.
 * Uses tile semantics but compact horizontal layout.
 */
.prob-tiles {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}
.prob-tiles .tile {
  flex: 1;
  min-width: 160px;
}

/* ─── Distribution table (MC summary) ───
 * Replaces inline-styled p5/p25/median/p75/p95 table. The middle column
 * (median) is the headline — wider weight + brighter color.
 */
.dist-table {
  width: 100%;
  font-size: var(--text-sm);
  border-collapse: collapse;
  font-family: var(--font-mono);
}
.dist-table th {
  text-align: right;
  padding: var(--space-2) var(--space-1);
  color: var(--text-muted);
  font-weight: var(--font-weight-regular);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}
.dist-table th:first-child {
  text-align: left;
}
.dist-table td {
  padding: var(--space-2) var(--space-1);
  text-align: right;
  border-top: 1px solid var(--border-soft);
  color: var(--text-secondary);
}
.dist-table td:first-child {
  text-align: left;
  color: var(--text-secondary);
}
.dist-table td.median {
  color: var(--text-strong);
  font-weight: var(--font-weight-semibold);
}
.dist-table th.median {
  color: var(--text-secondary);
}
.dist-table tr.section-row td {
  padding-top: var(--space-4);
  color: var(--text-muted);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  border-top: 2px solid var(--border);
  font-family: var(--font-body);
}
.dist-table tr.lp-row td:first-child {
  color: var(--brand-purple-200);
  font-weight: var(--font-weight-semibold);
}

/* ─── Section card ───
 * Standalone analysis section within a tab, with its own header,
 * intro, controls, and Run button. Used on the Shape tab to host
 * two independent analyses (kernel fit, cross-time) in the same
 * vertical scroll without making one a sub-feature of the other.
 *
 * Per UI_PRINCIPLES.md G5: progress bar lives next to the Run
 * button inside this card, not in a global region.
 */
.section-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.section-card__header {
  margin-bottom: var(--space-3);
}


.section-card__controls {
  display: flex;
  gap: var(--space-3);
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.section-card__progress {
  margin-top: var(--space-2);
  height: 4px;
  background: var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.section-card__progress-fill {
  height: 100%;
  background: var(--brand-purple-700);
  transition: width 0.2s;
}
.section-card__progress-label {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-2);
}

/* ─── Criterion selector ─── REMOVED v8.81.
 * It described itself as "the reusable Best by [criterion ▼] pattern" and said
 * it "will also be used in future Heatmap/MC multi-run features". MC shipped
 * its own instead — an inline <select> with `min-width:180px` where this one
 * said 160 — which is the whole argument for the kit: a class that is reusable
 * only by convention does not get reused. Both are `kitSelect(…inline…)` now. */

/* ─── Variant card (Compare) ───
 * Single variant row in the Compare variant editor. Each row gets a label
 * input, range/skew/fee-mode controls, and action buttons (duplicate, remove).
 * Grid layout keeps controls aligned across rows.
 */
.variant-card {
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
  display: grid;
  grid-template-columns: 1.3fr 0.7fr 1.2fr 2fr auto auto;
  gap: var(--space-3);
  align-items: center;
}
/* Compare's card (v6.46): capped column widths. The base 1.3fr/0.7fr/1.2fr/2fr
 * grid stretches absurdly at wide viewports (owner: "input fields are waaaay
 * too wide" at ~2000px) \u2014 inputs should be sized by their content, not the
 * monitor. justify-content packs the row left; the strip row spans full width
 * via grid-column:1/-1 as before. */
.variant-card--cmp {
  /* v6.94: rows, not a track list. Five controls dealt into one CSS grid row
   * took their widths from the tracks, so Strategy, Fee handling and Rebalance
   * were three different sizes for no reason a reader could see. Rows let each
   * control be sized by what it IS. */
  display: block;
  margin-bottom: 0;
}
.variant-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.variant-card__toolbar { display: flex; gap: 6px; align-items: flex-end; }
/* v6.94: a .btn-sm MODIFIER, not a per-card cousin rule. The first attempt
 * styled `.variant-card__actions .btn-sm` and the kit ratchet failed the build
 * — `variant-card__action` is one of the twelve secondary-button cousins v6.56
 * absorbed into .btn-sm + modifiers, and re-adding a scoped rule for it is how
 * that divergence would grow back. Uniform width belongs to the button. */
.btn-sm--wide {
  width: auto;
  min-width: 62px;
  justify-content: center;
}
.variant-card__settings {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
/* One width for every labelled control in the card. */
.variant-card__ctl { width: 168px; flex: 0 0 auto; }
.variant-card__skewfield { width: 190px; flex: 0 0 auto; }
.variant-card__stake {
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-size: var(--text-xs);
  padding-bottom: 6px;
}
.variant-card__stake input { width: auto; margin: 0; }
.variant-card__editor {
  border-top: 1px solid var(--border-soft);
  padding-top: var(--space-2);
}
/* Multi-MC variant card (v5.40) \u2014 more fields than Compare\u2019s card
 * (label / range / skew / feeMode / rebalance / hodlRef / dup / remove).
 * Switch to flex-wrap so fields can wrap on narrower viewports without
 * truncating, and label inputs above each field for clarity. */
.variant-card--mc {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: flex-end;
  padding: var(--space-3);
}
.variant-card__label {
  background: transparent;
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: var(--font-weight-medium);
  min-width: 140px;
  flex: 0 0 140px;
}
.variant-card__label:focus {
  outline: none;
  border-color: var(--brand-purple-400);
}
.variant-card__field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: var(--text-xs);
}
.variant-card__field label {
  color: var(--text-dim);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.variant-card__field input,
.variant-card__field select {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  min-width: 72px;
}
.variant-card__field input:focus,
.variant-card__field select:focus {
  outline: none;
  border-color: var(--brand-purple-400);
}
.variant-card__skew {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.variant-card__skew-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-dim);
}
.variant-card__skew-val {
  color: var(--brand-purple-200);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-mono);
}
/* ─── Comparison results table ───
 * Reuses .dist-table base styles but adds: sortable column headers,
 * best-row highlight, hoverable rows. Used in Compare results panel.
 */
.compare-table {
  width: 100%;
  font-size: var(--text-base);
  border-collapse: collapse;
  font-family: var(--font-mono);
}
.compare-table th {
  text-align: right;
  padding: var(--space-2) var(--space-3);
  color: var(--text-muted);
  font-weight: var(--font-weight-medium);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-body);
  white-space: nowrap;
}
.compare-table th:first-child {
  text-align: left;
}
.compare-table th:hover {
  color: var(--text-primary);
}
/* v7.07: the ACTIVE sort column. The arrow alone is easy to miss on a wide
 * header row, and "which column am I sorted by" is the first thing you ask
 * after clicking one. */
.compare-table th.is-sorted { color: var(--text-primary); }
/* Finder shares the table kit. Names align left; numeric columns align right.
 * Keep this scope stronger than the later generic .tbl header rule. */
.pf-table__pair { display: inline-flex; align-items: center; gap: 6px; }
.pf-table .dim  { color: var(--text-dim); }
.pf-table th:nth-child(2), .pf-table td:nth-child(2) { text-align: left; }
.pf-table th:nth-child(n+3) { text-align: right; }
.compare-table th .sort-indicator {
  display: inline-block;
  margin-left: 4px;
  color: var(--brand-purple-200);
  font-size: var(--text-xs);
}
.compare-table td {
  padding: var(--space-2) var(--space-3);
  text-align: right;
  border-top: 1px solid var(--border-soft);
  color: var(--text-secondary);
  white-space: nowrap;
}
.compare-table td:first-child {
  text-align: left;
  color: var(--text-primary);
}
.compare-table tr.best-row td:first-child {
  color: var(--brand-purple-200);
  font-weight: var(--font-weight-semibold);
}
.compare-table tr.best-row td {
  background: rgba(108, 62, 209, 0.06);
}
.compare-table .num-pos { color: var(--color-success); }
.compare-table .num-neg { color: var(--color-danger); }
.compare-table .num-warn { color: var(--color-warning); }
.compare-table .num-muted { color: var(--text-muted); font-size: var(--text-sm); }

/* ─── Action bar (sticky bottom of a panel) ───
 * Per UI_PRINCIPLES.md: Add and Run are not peer actions and should be
 * spatially separated. Add stays inline with the variant list; Run lives
 * in a persistent action bar at panel bottom.
 */
.action-bar {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) 0 0;
  margin-top: var(--space-3);
  border-top: 1px solid var(--border-soft);
}

/* ─── Sidebar flex column ───
 * The sidebar is split into three vertical regions:
 *   - .sidebar__scroll : scrollable content (pool, strategy, environment)
 *   - .sidebar__sticky : Run button + log, fixed at viewport bottom
 *
 * Phase 1 IA: "Sidebar is too tall, scrolling required to reach Run." Fix:
 * the Run button never scrolls out of view; it sits in a sticky bottom
 * region that's always reachable. The progress bar lives directly above it,
 * matching G5 (progress next to action). */

/* ─── Sidebar group spacing ───
 * Replaces the older .divider pattern. Each group is just a vertical stack
 * with consistent spacing; no visual rule between groups (Phase 1: "three
 * conceptually different concerns visually indistinguishable" → reorder
 * with spacing, not new section headers).
 * OZ9 (the review of batch O3): the .sidebar-group rule was dropped by a
 * stray '}' from v9.58 on, and the page has used that form since. It is
 * not restored, so closing the cut comments changes nothing on screen.
 */
.sidebar-group__heading {
  font-size: var(--text-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--text-muted);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  margin-bottom: var(--space-1);
}

/* ─── Pill bar (Quick Presets) ───
 * Compact horizontal toggle group. Replaces the preset dropdown so users
 * can switch between common pools with one click instead of two. Wraps to
 * multiple rows when narrow (6 presets at sidebar width is too wide for
 * one row).
 */
.pillbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
/* Draggable shape-editing dots on the liquidity curve (v6.28). The glow on
   hover is the discoverability cue that these are grabbable, since a dot on a
   chart doesn't otherwise announce itself. */
.shape-dot {
  transition: box-shadow 120ms ease, transform 120ms ease;
  z-index: 2;
}
.shape-dot:hover {
  box-shadow: 0 0 0 5px rgba(167, 139, 250, 0.22);
  transform: scale(1.12);
}
/* "Which question does this answer?" badge (v6.32). One consistent frame at the
   top of every analysis surface, colour-coded by MEASUREMENT BASIS, so the
   idealized-vs-actual numbers stop reading as contradictions: your ±20% range
   on the real past (Overview) legitimately differs from the pool's full-range
   average (Viability) and from a randomized forward sim (Monte Carlo). The dot
   colour is the category; users learn the four buckets. */
.answers-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--text-xs); font-weight: var(--font-weight-medium, 500);
  padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--border-soft); background: var(--surface-alt);
  color: var(--text-secondary); line-height: 1.45; max-width: 100%;
}
.answers-badge__dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.answers-badge__tag { font-weight: var(--font-weight-semibold, 600); }
.answers-badge__q   { color: var(--text-muted); font-weight: 400; }
.answers-badge--actual  .answers-badge__dot { background: var(--brand-purple-300); }
.answers-badge--actual  .answers-badge__tag { color: var(--brand-purple-200); }
/* Distinct sky-blue for "pool average" — NOT --color-info, which is the brand
   purple (same as "actual") and would collapse the two categories. */
.answers-badge--general .answers-badge__dot { background: #4ca5e0; }
.answers-badge--general .answers-badge__tag { color: #6fb8e8; }
.answers-badge--forward .answers-badge__dot { background: var(--color-warning); }
.answers-badge--forward .answers-badge__tag { color: var(--color-warning); }
.answers-badge--intel   .answers-badge__dot { background: var(--text-muted); }
.answers-badge--intel   .answers-badge__tag { color: var(--text-secondary); }
.pill {
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  padding: 6px var(--space-2);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-family: var(--font-display, sans-serif);
  font-weight: var(--font-weight-medium, 500);
  cursor: pointer;
  transition: all 120ms ease;
  white-space: nowrap;
  /* v8.87: a pill can carry a chain logo (the portfolio filter) — an inline
     <img> sat on the text BASELINE, visibly low against the label. Flex
     centers any child vertically; for the text-only pills this changes
     nothing (a lone text node centers identically), and the gap only exists
     when there are two children to separate. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.pill b {
  font-weight: var(--font-weight-semibold, 600);
  color: var(--text-primary);
}
/* A pill whose data is still being fetched: neither off nor on, and saying so
   (v8.80). Same grammar as `.segbar__btn.is-busy` beside it. */
.pill.is-busy { display: inline-flex; align-items: center; gap: 6px;
  opacity: .7; cursor: progress; }
.pill.is-busy .fee-spinner { margin: 0; }
.pill--active b { color: var(--text-on-brand); }
.pill__meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}
.pill--active .pill__meta { color: var(--text-on-brand); opacity: 0.8; }
.pill:hover:not(:disabled) {
  border-color: var(--brand-purple-400);
  color: var(--text-primary);
}
/* A pill that cannot be clicked has to LOOK like it cannot be clicked. The
   amount presets render disabled when the balance is zero, and without this
   they were indistinguishable from live ones. Mirrors .btn-sm:disabled. */
.pill:disabled { opacity: .5; cursor: default; }
.pill--active {
  background: var(--brand-gradient);
  color: var(--text-on-brand);
  border-color: var(--brand-purple-700);
}

/* ─── Pool address row ───
 * Promotes the pool address from undersized input to a prominent field.
 * Layout: input + Load button + favorite star, all on one row.
 */
.pool-address-row {
  display: flex;
  gap: var(--space-1);
  align-items: stretch;
}
.pool-address-row input {
  flex: 1;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
  padding: var(--space-2);
}
/* ─── Cache state indicator ───
 * One-line summary of cache contents with a Clear button. Surfaces the
 * cache state which was previously invisible to the user (Phase 1 audit).
 */
.cache-state {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-soft);
}
.cache-state__count {
  font-family: var(--font-mono);
  color: var(--text-secondary);
}
/* ─── Sidebar inline progress (G5) ───
 * Progress bar lives directly above the Run button in the sticky region.
 * Same visual language as section-card__progress but contextually located
 * for the global Run action.
 */
.sidebar-progress {
  display: none;
  margin-bottom: var(--space-2);
}
.sidebar-progress--visible { display: block; }
.sidebar-progress__bar {
  height: 4px;
  background: var(--border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.sidebar-progress__fill {
  height: 100%;
  background: var(--brand-purple-700);
  transition: width 0.3s;
}
.sidebar-progress__label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 3px;
  font-family: var(--font-mono);
}

/* ─── Educational explainer (Phase 4) ───
 * Inline expandable card pairing a brand animation with a prose explanation
 * of a technical concept. Used selectively next to non-obvious terms (kernel
 * fit, Option A vs B, IL vs HODL, bootstrap path generation, etc.).
 *
 * The trigger is a small `?` button; the expanded body uses native <details>
 * for accessible keyboard control and zero-JS toggling. When expanded, the
 * animation slot occupies the left ~120px and the prose flows on the right.
 *
 * Animations are served from /anim/<name>.svg with embedded CSS animation;
 * we just <img>-embed them. The four available animations:
 *   • focusing   — gentle aperture pulse, fits empty states
 *   • calibrate  — ticks dialing in, fits loading/computation explanations
 *   • trace      — wavy path drawing across, fits trajectory/bootstrap concepts
 *   • lock-in    — expanding confirmation ring, fits fit-locked/range-set concepts
 */
.explainer {
  margin: var(--space-2) 0;
}
.explainer summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--text-muted);
  user-select: none;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-soft);
  background: var(--surface-alt);
  transition: all 120ms ease;
}
.explainer summary::-webkit-details-marker { display: none; }
.explainer summary::before {
  content: '?';
  font-family: var(--font-mono);
  font-weight: var(--font-weight-semibold);
  color: var(--brand-purple-200);
  width: 14px;
  height: 14px;
  border-radius: var(--radius-full);
  background: rgba(167, 139, 250, 0.15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}
.explainer summary:hover {
  border-color: var(--brand-purple-400);
  color: var(--text-primary);
}
.explainer[open] summary::after {
  content: 'close';
  margin-left: 4px;
  color: var(--text-dim);
  font-size: 10px;
}
.explainer__body {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  align-items: center;
}
.explainer__anim {
  /* v5.42: enlarged inline size for readability in the opened panel.
   * Previously 200x114 (which matched 280x160 source aspect at small scale)
   * was too tiny for the user to make out details without clicking to the
   * lightbox. New size 320x183 still respects the source aspect ratio but
   * gives the animation real estate to actually be readable inline. The
   * click-to-lightbox interaction remains for users who want even bigger.
   */
  flex: 0 0 320px;
  width: 320px;
  height: 183px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg, #0a0a10);
  border-radius: var(--radius-md, 6px);
  cursor: zoom-in;       /* signal: clickable to enlarge */
  transition: border-color 0.15s;
  border: 1px solid transparent;
}
.explainer__anim:hover {
  border-color: var(--brand-purple-400, #7c70f0);
}
.explainer__anim img {
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: auto;
  display: block;
}

/* Lightbox overlay for enlarged animations (v5.38, v5.39 sized down).
 * Hidden by default; shown when the user clicks any .explainer__anim.
 * Click anywhere on the backdrop (or Esc) to dismiss. The animation is
 * centered and scaled to roughly 3\u00D7 its inline size (200\u00D7114 \u2192
 * 600\u00D7343) so it\u2019s comfortably readable but not full-screen \u2014 a
 * page-dominating modal felt like overkill for a small explainer. */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.lightbox--open {
  display: flex;
  animation: lightbox-fade-in 0.18s ease-out;
}
@keyframes lightbox-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.lightbox__img {
  /* Target ~3\u00D7 the inline 200\u00D7114; capped against viewport on small
   * screens. Aspect preserved by the SVG\u2019s viewBox. */
  width: 600px;
  max-width: 80vw;
  height: auto;
  max-height: 60vh;
  border-radius: var(--radius-lg, 8px);
  background: var(--bg, #0a0a10);
  padding: var(--space-3, 12px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}
.lightbox__caption {
  position: absolute;
  bottom: var(--space-4, 16px);
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-muted, #7a7a85);
  font-size: var(--text-xs, 10px);
  font-family: var(--font-mono);
}
.explainer__text {
  flex: 1;
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.5;
}
.explainer__title {
  font-size: var(--text-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

/* Standalone animation tile (no expander wrapper) — for empty states and
 * loading placeholders where the animation is the visual centerpiece. */
/* v6.66: sizes up ~40% (96->132, 140->200) — the empty-state art read as an
   afterthought at the old scale on a ~1900px viewport (owner report). Opacity
   also lifts a little: bigger art at 0.55 looked washed out rather than
   deliberately quiet. */
.anim-tile {
  width: 132px;
  height: 132px;
  margin: 0 auto var(--space-3);
  opacity: 0.62;
}
.anim-tile img { width: 100%; height: 100%; display: block; }
.anim-tile--lg { width: 200px; height: 200px; }

/* ─── Scrollbar (dark, brand-aligned) ───
 * The default browser scrollbar reads as harsh on the dark theme — the
 * bright contrast pulls focus away from content. We restyle it to use
 * subtle surface tones with a brand-purple hover, matching the rest of
 * the interface. Two property sets needed for cross-browser coverage:
 *   • Firefox 64+    — `scrollbar-color` + `scrollbar-width`
 *   • Chromium/WebKit — `::-webkit-scrollbar*` pseudo-elements
 */
* {
  scrollbar-color: var(--border) var(--bg);
  scrollbar-width: thin;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: var(--bg);
}
*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-md);
  border: 2px solid var(--bg);  /* inset effect: thumb appears thinner than track */
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--brand-purple-400);
}
*::-webkit-scrollbar-corner {
  background: var(--bg);
}

/* ─── Number-input spinner buttons (v5.35) ───
 * We replaced the native spinner buttons with custom +/- buttons next to
 * each bound input, because the native ones couldn't step by tick spacing
 * (only by 1) and snap-on-blur composed badly with held-button repeats.
 * Hide the native arrows entirely on `.bounds-input` and rely on the
 * custom .bound-step buttons.
 */
input[type="number"] {
  accent-color: var(--brand-purple-400);
  color-scheme: dark;
}
.bounds-input::-webkit-inner-spin-button,
.bounds-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
.bounds-input {
  -moz-appearance: textfield;  /* Firefox: hide spinner */
}

/* Custom +/- buttons next to bound inputs. Step by exactly one tick on click.
 * Visually subtle but clearly tappable; brand purple on hover. */
/* ═══════════════════════════════════════════════════════════════
 * TOOLS TAB (v5.43)
 * ═══════════════════════════════════════════════════════════════ */

/* Sub-nav pill bar inside the Tools tab */
.tools-subnav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding-bottom: var(--space-3);
  margin-bottom: var(--space-4);
  border-bottom: 1px solid var(--border-soft);
}
.tools-pill {
  background: var(--surface-alt);
  border: 1px solid var(--border-soft);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s;
}
.tools-pill:hover:not(.tools-pill--active) {
  border-color: var(--brand-purple-400);
  color: var(--text-primary);
}
.tools-pill--active {
  background: var(--brand-purple-700);
  border-color: var(--brand-purple-700);
  color: #fff;
  font-weight: var(--font-weight-medium);
}

/* Composition tool layout */
.comp-tool {
  display: flex;
  flex-direction: column;
}
.comp-tool__header {
  margin-bottom: var(--space-4);
}



/* Inputs row: 4-column grid that wraps on narrower screens */
.comp-tool__inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}
.comp-input {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.comp-input > label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.comp-input__hint {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Readout table inside the composition tool */
/* ── Exposure tool (v5.46, restyled v5.49 to match Compare's variant rows) ── */
.exp-tool {
  display: flex;
  flex-direction: column;
}
/* Position row: an Exposure-flavored variant-card. Grid columns:
 * tag | (capital / amount) | (range / token) | skew slider | delete.
 * Mirrors .variant-card so the two tools feel identical. */
.variant-card--exp {
  grid-template-columns: auto 0.8fr 1.4fr 1.6fr auto;
}
.exp-tag {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-semibold);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.03em;
  text-align: center;
}
.exp-tag--lp {
  background: rgba(167,139,250,0.16);
  color: var(--brand-purple-200);
}
/* Range cell: mode toggle + value input(s) on one line inside a field. */
.exp-rangecell {
  display: flex;
  align-items: center;
  gap: 6px;
}
.exp-rangecell input {
  background: var(--bg);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}
.exp-rangecell input:focus {
  outline: none;
  border-color: var(--brand-purple-400);
}
/* Compact pill toggle (±% / bounds, and Long/Short token0/token1) — segmented. */
/* Inline variant sits next to a sibling without growing the row. */
/* Position type tags */
.exp-tag--short {
  background: rgba(248,113,113,0.16);
  color: var(--color-danger);
}
.exp-tag--long {
  background: rgba(52,211,153,0.14);
  color: var(--color-success);
}
/* Surface axis-bound control: label + small numeric input, chart-header style. */
.exp-axisctl {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.exp-axisctl input {
  width: 52px;
  margin-left: 2px;
  background: var(--bg);
  border: 1px solid var(--border-soft);
  color: var(--text-primary);
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  text-align: center;
}
.exp-axisctl input:focus {
  outline: none;
  border-color: var(--brand-purple-400);
}

/* ── Fee tier comparison (v5.48, branded v5.51) ── */
.fee-controls {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
}
/* Spinner used in the button and the full-panel loading state. */
.fee-spinner {
  width: 11px; height: 11px;
  border: 2px solid var(--border);
  border-top-color: var(--brand-purple-300);
  border-radius: var(--radius-full);
  display: inline-block;
  animation: fee-spin 0.7s linear infinite;
}
.fee-spinner--lg { width: 16px; height: 16px; border-width: 2px; margin-right: 8px; }
@keyframes fee-spin { to { transform: rotate(360deg); } }
.fee-filter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.fee-filter__label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.pillbar--sm .pill {
  padding: 5px 11px;
  font-size: var(--text-xs);
}
.fee-count {
  font-size: var(--text-xs);
  color: var(--text-dim);
  margin-left: auto;
  font-family: var(--font-mono);
}
.fee-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: var(--space-4);
  padding: var(--space-6) var(--space-5);
  color: var(--text-muted);
  font-size: var(--text-sm);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
}
/* The same panel, STACKED. The base is a centred flex ROW, so a message plus
 * a button row becomes two columns and the buttons drift off beside the
 * sentence they belong to. Anything with more than a word and one control
 * wants this. */
.fee-loading--stack {
  flex-direction: column;
  text-align: center;
  gap: var(--space-3);
}
.fee-table th {
  white-space: nowrap;
}
.fee-table th:hover {
  color: var(--text-secondary);
}
.fee-row--current td {
  background: rgba(167,139,250,0.06);
}

/* Small delete affordance inside a preset pill (date-range presets, v5.54). */
.pill__x {
  margin-left: 6px;
  color: var(--text-dim);
  font-size: var(--text-sm);
  padding: 0 2px;
  border-radius: var(--radius-sm);
}
.pill__x:hover { color: var(--color-danger); background: rgba(248,113,113,0.12); }

/* Date field: readable yyyy-mm-dd text input + calendar-picker button (v5.55).
   The native type=date sits hidden behind the button purely to host the OS
   calendar; the text input is what the user types into. */
.date-field {
  position: relative;
  display: flex;
  align-items: stretch;
}
.date-field__text {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-align: left;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}
.date-field__native {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 32px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  border: none;
  padding: 0;
}

/* ── Composition tool input row polish (v5.55) ──
   The controls (range slider, skew slider, capital, display toggle, HODL
   select) were visually inconsistent. Scope styling to .comp-tool so the
   row reads as one coherent panel. */
.comp-tool .comp-input input[type="range"] {
  width: 100%;
  margin: 8px 0 2px;
  accent-color: var(--brand-purple-400);
  height: 4px;
  cursor: pointer;
}
.comp-tool .comp-input input[type="number"] {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-align: center;
  padding: 7px 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.comp-tool .comp-input input[type="number"]:focus { border-color: var(--brand-purple-400); }
/* The HODL select this styled is a kitSelect as of v8.81; the sliders and the
   number field above still need their own rules, the dropdown does not. */
.comp-tool .bounds-input {
  background: var(--bg) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-md) !important;
}
/* Display segmented toggle: a contained pill group, not loose buttons. */
/* The range-mode (±%/bounds) toggle buttons in .comp-input share .btn-sm;
   give the inactive ones a subtle surface so the pair reads as a control. */
.comp-tool .comp-input .btn-sm {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.comp-tool .comp-input .btn-sm.active {
  background: var(--brand-purple-700);
  color: var(--text-on-brand);
  border-color: var(--brand-purple-700);
}

/* ── Heatmap zoom confirm popover (v5.56) ── */
.hm-zoom-pop {
  position: absolute;
  z-index: 30;
  width: 290px;
  background: var(--surface-alt);
  border: 1px solid var(--brand-purple-400);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: 0 0 0 1px rgba(108,62,209,.3), 0 10px 28px rgba(0,0,0,.6);
}
.hm-zoom-pop__title {
  font-size: var(--text-md);
  font-weight: var(--font-weight-semibold);
  color: var(--text-strong);
  margin-bottom: var(--space-2);
}
.hm-zoom-pop__body {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-3);
}
.hm-zoom-pop__actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}
.hm-zoom-pop__go {
  background: var(--brand-purple-700) !important;
  color: var(--text-on-brand) !important;
  border-color: var(--brand-purple-700) !important;
  padding: 6px 16px !important;
  font-size: var(--text-sm) !important;
}
.hm-zoom-pop__go:hover { background: var(--brand-purple-600) !important; }

/* ── On-brand modal (tkPrompt, v5.57) — replaces window.prompt ── */
.tk-modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(8,8,12,0.62);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  animation: tk-fade 120ms ease;
}
@keyframes tk-fade { from { opacity: 0 } to { opacity: 1 } }
.tk-modal {
  width: 380px; max-width: calc(100vw - 32px);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-shadow: 0 0 0 1px rgba(108,62,209,.22), 0 18px 50px rgba(0,0,0,.6);
  animation: tk-pop 140ms cubic-bezier(.2,.8,.3,1);
}
@keyframes tk-pop { from { transform: translateY(8px) scale(.98); opacity: 0 } to { transform: none; opacity: 1 } }
.tk-modal__title {
  font-family: var(--font-display, sans-serif);
  font-size: var(--text-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--text-strong);
}
.tk-modal__hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-1);
}
.tk-modal__input {
  width: 100%; box-sizing: border-box;
  margin-top: var(--space-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 11px;
  font-family: var(--font-mono);
  font-size: var(--text-md);
  color: var(--text-primary);
}
.tk-modal__input:focus { outline: none; border-color: var(--brand-purple-400); }
.tk-modal__actions {
  display: flex; gap: var(--space-2); justify-content: flex-end;
  margin-top: var(--space-4);
}
.tk-modal__ok {
  background: var(--brand-purple-700) !important;
  color: var(--text-on-brand) !important;
  border-color: var(--brand-purple-700) !important;
  padding: 6px 16px !important;
}
.tk-modal__ok:hover { background: var(--brand-purple-600) !important; }

/* ── Composition inline header + segmented control (v5.57) ── */
.comp-input__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2); min-height: 20px;
}
.comp-check {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: var(--text-xs); color: var(--text-muted);
  cursor: pointer; text-transform: none; letter-spacing: 0;
}
.comp-check input { margin: 0; accent-color: var(--brand-purple-400); }
/* ── Heatmap zoom breadcrumb — make Back/Reset prominent (v5.57) ── */
.hm-zoom-crumb {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: 3px 4px 3px 10px;
  background: rgba(124,112,240,0.10);
  border: 1px solid var(--brand-purple-400);
  border-radius: var(--radius-full);
}
.hm-zoom-crumb__badge {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--brand-purple-200);
  white-space: nowrap;
}

/* portfolio summary strip */
/* card grid */
.pos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-4);
}
/* ── The chain band (v8.33) ────────────────────────────────────────────────
 * A portfolio spans chains now, and every card looked identical whatever chain
 * it was on. This is a HEADING, not a card: a rule with a label riding on it,
 * so it separates without competing with the cards under it. The dot is the
 * same swatch the header chip uses, so the two read as one system.
 */
.chain-band {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: var(--space-5);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.chain-band:first-of-type { margin-top: var(--space-3); }
.chain-band__name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}
.chain-band__meta {
  font-size: var(--text-xs);
  color: var(--text-dim);
  font-family: var(--font-mono);
}
/* Pushed right, because it qualifies the whole band rather than the count. */
.chain-band__note {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
}
/* The band already provides the separation the grid's own top margin was for. */
.chain-band + .pos-grid { margin-top: var(--space-3); }

.pos-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-dim);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}
.pos-card--in { border-left-color: var(--color-success); }
.pos-card--out { border-left-color: var(--color-warning); }
.pos-card__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--space-2); margin-bottom: var(--space-3);
}
.pos-card__pair {
  font-family: var(--font-display, sans-serif);
  font-size: var(--text-lg); font-weight: var(--font-weight-semibold);
  color: var(--text-strong);
}
.pos-card__badges { display: flex; gap: 5px; flex-wrap: wrap; justify-content: flex-end; }
.pos-progress { width: 100%; height: 6px; border-radius: var(--radius-full, 9999px); background: var(--surface-hi, rgba(255,255,255,.06)); overflow: hidden; position: relative; }
.pos-progress__bar { position: absolute; height: 100%; width: 35%; border-radius: var(--radius-full, 9999px); background: linear-gradient(90deg, var(--brand-purple-600, #5b52d4), var(--brand-purple-400, #7c70f0)); box-shadow: 0 0 8px rgba(108,62,209,.4); animation: pos-progress-slide 1.4s ease-in-out infinite; }
@keyframes pos-progress-slide { 0% { left: -35%; } 100% { left: 100%; } }
/* composition bar */
.pos-card__bar {
  display: flex; height: 8px; border-radius: var(--radius-full);
  overflow: hidden; margin-bottom: var(--space-2);
  background: var(--bg);
}
.pos-card__bar0 { background: var(--chart-1, #a78bfa); }
.pos-card__bar1 { background: var(--chart-2, #34d399); }
.pos-card__comp {
  display: flex; justify-content: space-between; gap: var(--space-2);
  font-size: var(--text-xs); color: var(--text-secondary);
  margin-bottom: var(--space-3); flex-wrap: wrap;
}
.pos-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: baseline; }
.pos-dot--0 { background: var(--chart-1, #a78bfa); }
.pos-dot--1 { background: var(--chart-2, #34d399); }

/* rows */
.pos-card__rows { display: flex; flex-direction: column; gap: 5px; margin-bottom: var(--space-3); }
.pos-card__row {
  display: flex; justify-content: space-between;
  font-size: var(--text-sm); color: var(--text-muted);
}
.pos-card__row .mono { font-family: var(--font-mono); color: var(--text-secondary); }

/* actions */
.pos-card__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ── the action tray (#74) ──
   THE DOCK IS GONE (v8.04). `.tray-dock`, `.tray-dock__inner/__head/__title/
   __note/__actions/__spacer`, `.tray-rows` and the `.tray-row*` family were
   deleted here when the tray moved into the rail; `.tray-card` / `.tray-item`
   further down this file are what replaced them, and the in-flight semantics
   the dock carried (`--sent`, the flag, no remove control) moved with it
   rather than being dropped. A fixed bar across the bottom of the viewport
   needed a 104px spacer to stop it covering the last position card, which is
   a component knowing about the page it sits on. */

/* ── grouped position (#79, the meta position) ──
   A shaped deploy is ONE card that expands to its bins IN PLACE. These four
   exist so the group card can be built entirely out of .pos-card — G0: extend
   the kit, never style the instance. Every one replaces an inline style. */
.pos-card__binlist { margin-top: var(--space-2); }
.pos-card__row--act { cursor: pointer; }
.pos-card__row--act:hover { color: var(--text-secondary); }
.pos-card__row .dim { font-family: var(--font-mono); color: var(--text-dim); }
.pos-card__binacts { padding-bottom: var(--space-2); }
/* OX51: a bin row's value and its Actions toggle sit together at the end. */
.pos-card__binend { display: inline-flex; align-items: center; gap: var(--space-2); }
.pos-card__binlist .pos-card__row { align-items: center; }
/* The add-capital panel is a FORM inside a card, and it opens directly under
   the card's own button row. Without a rule the family pills read as more
   card actions rather than as the first control of a form. */
/* A field row holding a textarea rather than a one-line input: the row's fixed
   height and centred alignment are wrong for multi-line. */
.field__row--area { height: auto; align-items: stretch; padding: 0; }
.field__row--area > textarea {
  width: 100%;
  background: none;
  border: 0;
  outline: none;
  resize: vertical;
  min-height: 54px;
  padding: 7px 9px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
}
/* A user's note about a position. pre-wrap so their line breaks survive —
   done in CSS because the alternative is substituting <br> into innerHTML,
   which is how escaped text stops being escaped. */
.pos-card__note { white-space: pre-wrap; }

/* The balance inside a field label, made clickable — the "Max" every DEX has.
   Styled as the label it sits in plus an affordance, not as a button: it must
   not compete with the preset pills two rows below it. */
.field__max {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--brand-purple-200);
  cursor: pointer;
  border-bottom: 1px dotted currentColor;
}
.field__max:hover { color: var(--text-strong); }

.pos-card__addpanel {
  margin-top: var(--space-2);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-soft);
}
/* ── Distribution view (v7.64): what the bins hold, and what an add would
   stack on top. Lives inside a position card, so every dimension here is
   sized for a ~300px column. ── */
.dist { margin-bottom: var(--space-3); }
.dist__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: var(--space-2); margin-bottom: var(--space-1);
}
.dist__title {
  font-size: var(--text-sm); color: var(--text-secondary);
  letter-spacing: var(--tracking-label); text-transform: uppercase;
}
.dist__key {
  display: flex; align-items: center; gap: var(--space-1);
  font-size: var(--text-xs); color: var(--text-muted);
}
.dist__sw {
  display: inline-block; width: 8px; height: 8px; border-radius: 2px;
  margin-right: 2px; margin-left: var(--space-2);
}
.dist__key .dist__sw:first-child { margin-left: 0; }
.dist__sw--have { background: var(--text-muted); opacity: .42; }
.dist__sw--add  { background: var(--brand-purple-300); }
.dist__canvas { width: 100%; height: 96px; }
/* Reserved height: without it the panel jumps every time the pointer enters
   or leaves a bar, which reads as the card twitching under the cursor. */
.dist__read {
  min-height: 16px; margin-top: var(--space-1);
  font-size: var(--text-xs); color: var(--text-secondary);
  line-height: 1.4; overflow-wrap: anywhere;
}
.dist__lbl { color: var(--text-muted); }
.dist__num { font-family: var(--font-mono); }
.dist__num--after { color: var(--brand-purple-200); }
.dist__flag { color: var(--color-warning); }
/* HR11: a reserved line, as .dist__read has. The field's commit fills
   this note while a press is down; a note that appeared moved the
   'Review add' button 19 px under the pointer, and the press did not
   reach it. An empty note keeps its line, so nothing below it moves. */
.dist__note { min-height: calc(var(--text-xs) * 1.4); }
/* the second line of a hero tile: "1 · 5 bins" */
.tile__unit { font-size: var(--text-sm); color: var(--text-muted); }
/* ═══════════════════════════════════════════════════════════════════════
 * UI KIT — the canonical components (v6.55 · task #53)
 * ═══════════════════════════════════════════════════════════════════════
 * Written after UI_INVENTORY.md found 941 inline style= attributes (566
 * carrying LOOK), 13 secondary-button classes doing one job, 8 container
 * dialects, and a DESIGN_TOKENS.md `.card` spec that was never implemented.
 *
 * Rules for this section:
 *   1. Every value is a token. No raw px, no raw hex.
 *   2. Atoms are classes; composites get JS builders (see kit* in index.html).
 *   3. This block sits LAST in the file so it owns the shared base; the
 *      legacy per-tool classes above may still add their own extras.
 *   4. Suite group 0d locks these against re-drift.
 * ─────────────────────────────────────────────────────────────────── */

/* ── Card / surface ── the DESIGN_TOKENS.md Phase-2 component, finally real.
 * The legacy container classes are folded into the SAME base here, so the
 * app converges on one radius/padding/border immediately without a risky
 * 60-call-site markup sweep. Radius --radius-xl and padding --space-4 win
 * because they were already the majority (chart-box + section-card + cfgbar);
 * the panels that were --radius-lg/8px move 2px, which is the intended
 * settling (owner: "I expect the look to change"). */
.card,
.chart-box,
.section-card,
.cfgbar,
.pf-railcard,
/* .fork-card left this list at v8.13 with the screen it styled. A selector
   for a class nothing emits is the residue that makes the next reader think
   the screen is still there. */
.pool-panel,
.details-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}

/* ── THE MARK, and THE WELCOME SCREEN (v8.13) ──────────────────────────────
 * `.logo` moved here from index.html's own <style> so a modifier can size it:
 * that block loads AFTER this file, so a base rule written there beats every
 * modifier written here. Two releases have now been spent on that ordering.
 *
 * The screen it serves is the signed-out Portfolio, which the sketch calls
 * "the highest-leverage screen in the app and today it says nothing". What
 * was there: two equally weighted cards, "Track your LP portfolio" beside
 * "Backtest a pool". Equal weight is the bug — pasting an address is what
 * every portfolio tracker does, and reconstructing real fees before you fund
 * anything is what none of them do. So the analysis leads and the address is
 * one click away rather than half the screen.
 *
 * Nothing new is invented: the three capability cards are `.pf-railcard`,
 * the buttons are the G6 tiers, and the measure is capped at a reading width
 * rather than the viewport. */
/* THE MARK WAS STILL ON THE PRE-v6.5x INDIGO. It carried
 * its two gradient stops written out in hex — the older of the two pairs the
 * NOTE block near the top of this file names, the one that says accent moved
 * off indigo onto brand purple. Those values are deliberately NOT repeated
 * here: spelled out, they trip group 0d's own raw-hex ratchet, a counter
 * aimed at code matching prose about code.
 *
 * The mark never got the migration because it lived in index.html's own
 * <style>, which is exactly the reason the handoff gives for moving shell CSS
 * out: rules over there never track the tokens. The ratchet caught it the
 * moment the rule arrived in this file, which is the ratchet working. */
.logo{width:32px;height:32px;border-radius:7px;
  background:var(--brand-gradient);display:flex;
  align-items:center;justify-content:center;color:var(--text-on-brand);
  padding:5px}
.logo svg{width:100%;height:100%}

/* Optically centred in what is left of the viewport, not pinned to the top.
 * At 6vh the hero was ~340px of content in a 1080px column and the screen
 * read as unfinished rather than composed — seen only in a screenshot, since
 * nothing about the markup says how much room is under it. `72vh` is the
 * header plus the footer taken off; `center` with a floor rather than
 * `height` so a 720px viewport scrolls instead of clipping. */
.welcome{max-width:840px;margin:0 auto;padding:var(--space-5) var(--space-4);
  text-align:center;min-height:72vh;display:flex;flex-direction:column;
  justify-content:center}
/* .welcome__mark deleted at v8.13.1 with the second logo it sized — the
   header already carries the identity, ~90px above. The `.logo` move into
   this file stands on its own: it is what surfaced the mark's stale
   pre-migration gradient, which the header still shows. */
.welcome__h{font-family:var(--font-display);font-size:var(--text-3xl);
  color:var(--text-strong);letter-spacing:var(--tracking-tight);
  line-height:1.2;text-wrap:balance;margin:0 0 var(--space-2)}
.welcome__sub{font-size:var(--text-md);color:var(--text-secondary);
  line-height:1.6;max-width:56ch;margin:0 auto var(--space-5)}
.welcome__acts{display:flex;gap:var(--space-3);justify-content:center;
  flex-wrap:wrap;margin-bottom:var(--space-5)}
/* The address form, revealed by the second button. Capped narrow because an
   0x… address is 42 characters and a field wider than its content reads as a
   field expecting an essay. */
.welcome__track{max-width:460px;margin:0 auto var(--space-5);text-align:left}
.welcome__grid{display:grid;gap:var(--space-3);text-align:left;
  grid-template-columns:repeat(auto-fit,minmax(210px,1fr))}
/* The shared card base carries margin-bottom for stacked use; inside a grid
   with its own gap that is a double gutter on every row but the last. */
.welcome__grid .pf-railcard{margin-bottom:0}

/* ── .amt — A QUANTITY OF A TOKEN, with the token inside the field (v8.15) ──
 * Sketch section 7, variant A: the grammar every DEX uses. The symbol used to
 * be fixed text in the label; here it is a chip in the row, and where more
 * than one token is legal the chip picks between them.
 *
 * THE CHIP IS A REAL <select>, laid over the visible pill at zero opacity.
 * That is deliberate and it is what keeps this from being a hand-rolled
 * control: the menu, the keyboard, the escape key and the accessible name all
 * come from the platform, and there is no open/closed state to keep, no
 * outside-click rule to invent, and nothing for a re-render to lose. What we
 * draw is the icon, the symbol and the chevron; what you operate is a select.
 *
 * The number is right-aligned and large because it is the thing being decided.
 * The balance sits on the label line, where clicking it fills the field — the
 * same exact-integer path the 100% preset uses, never the rounded text.
 */
/* A MODIFIER ON `.field`, not a second component. `kitAmount` already renders
 * through `kitField`, which owns the one <input> template in this file — the
 * bare-input ratchet exists to keep it that way. So the chip arrives through
 * one new additive slot (`lead`) and everything else is styling on the parts
 * that are already there: the label line, the row, the input. */
.field--amt .field__label{display:flex;align-items:baseline;
  gap:var(--space-2)}
.field--amt .field__label .amt__bal{margin-left:auto;text-transform:none;
  letter-spacing:0;font-family:var(--font-mono);color:var(--text-dim)}
.field--amt .field__row{gap:var(--space-2);padding:6px 8px 6px 6px;
  height:auto}
.field--amt .field__row > input{background:transparent;border:none;
  outline:none;text-align:right;font-family:var(--font-mono);
  font-size:var(--text-xl);color:var(--text-primary);padding:2px 0;
  flex:1;min-width:0;width:100%}
/* ── THE TOKEN PICKER (v8.76) ───────────────────────────────────────────────
 * `sketch_newpos.html:124-142` drew these classes and nothing implemented
 * them; the chip's native <select> stood in until the owner compared it with
 * Aerodrome's and called it "as generic as it gets". A POPOVER anchored to the
 * chip, not a centred modal: the sketch defines the two words at :379-384 and
 * draws this one with the popover definition, and the panel opens over a field
 * the user is part-way through typing an amount into. */
.tdd{position:relative;display:inline-flex}
/* The chain picker is a FIELD, not a chip in a field, so its anchor is the
   full width and its panel matches it (v8.80). */
.tdd--block{display:block;width:100%}
/* Capped rather than full-bleed: five short chain names across a 1000px field
   is a lot of empty row, and the list should read as a menu hanging off the
   control rather than as a second panel. */
.tdd--block .tdd__panel{left:0;width:100%;max-width:340px}
/* A RECTANGLE (owner's call on sketch_dropdowns variant B). The token chip is
   a capsule because it lives inside a rounded amount field; this one IS the
   field, and a capsule reads as a tag rather than a control. */
.chainpick{display:flex;align-items:center;gap:9px;width:100%;
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius-md);padding:8px 11px;
  color:var(--text-primary);font:inherit;font-size:var(--text-md);
  cursor:pointer;text-align:left}
.chainpick:hover,
.chainpick[aria-expanded="true"]{border-color:var(--brand-purple-400)}
.chainpick .amt__chev{margin-left:auto}
/* ── THE HEADER INSTANCE (v8.84) ───────────────────────────────────────────
 * Same component, two shapes. In the pool panel the picker IS the field, so it
 * is a full-width rectangle. In the header it sits between two buttons and has
 * to read as one of them, so it keeps the chip's height and hugs its content.
 * Not `.tdd--block`: that is `width:100%`, which in the header's flex row would
 * push "Sign in" off the end. */
.tdd--chip{display:inline-flex}
.chainpick--chip{width:auto;padding:5px 9px;gap:7px;
  font-size:var(--text-sm);border-radius:var(--radius-full)}
.tdd--chip .tdd__panel{left:auto;width:240px;max-width:min(240px,86vw)}
/* RIGHT-ANCHORED, because the header chip sits near the viewport's right edge
 * and `.tdd__panel`'s `left:-7px; width:320px` has no clamp — the pool-panel
 * instance never met an edge, so nothing surfaced it. Mirrored offset, same
 * measurement. */
.tdd__panel--right{left:auto;right:-7px}
/* The chain dot is 7px because it was built for a badge. In a picker row it
   is the only thing distinguishing five otherwise identical lines, so it gets
   the size an icon would have. Scoped here rather than changed at source —
   the badge is still right at 7px where it lives. */
.chainpick > span:first-child,
.tdd__panel .tdd__row > span:first-child{width:14px !important;
  height:14px !important}
/* A chain that cannot be pool-searched: shown, dimmed, and told WHY on its
   own line — rather than folded into its name the way the <select> had to. */
.tdd__row--off{opacity:.5;cursor:not-allowed}
.tdd__row--off:hover{background:transparent}
.amt__chip--btn{cursor:pointer;font:inherit;color:inherit}
.amt__chip--btn[aria-expanded="true"]{border-color:var(--brand-purple-400)}
/* `left:-7px` lines the panel up with the FIELD's outer edge rather than the
 * chip's: `.field--amt .field__row` is `padding:… 6px` inside a 1px border, so
 * a panel at `left:0` starts 7px in and the first preset pill ("25%") pokes
 * out beside it, reading as a rendering fault. Tied to that padding on
 * purpose — the two are the same measurement. */
.tdd__panel{position:absolute;z-index:30;top:calc(100% + 6px);left:-7px;
  width:320px;max-width:min(320px, 86vw);
  background:var(--surface);border:1px solid var(--border);
  border-radius:var(--radius-lg);box-shadow:0 18px 44px rgba(0,0,0,.55);
  overflow:hidden;text-align:left}
/* THE INLINE VARIANT (OW12, D-291 rule 2): the same list inside a dialog,
   in the flow under its control, so the dialog's own scroll holds it and
   nothing hangs past the dialog's edge. */
.tdd__panel--inline{position:static;width:100%;max-width:none;
  margin-top:var(--space-2);box-shadow:none}
.tdd__head{padding:var(--space-3) var(--space-3) var(--space-2)}
/* The search is a kitField, so it already carries the field grammar; this
 * only removes the label gap a labelless field would otherwise leave. */
.tdd__head .field{gap:0}
/* AND IT UNDOES THE AMOUNT FIELD'S INPUT RULE, which is a DESCENDANT
 * selector (`.field--amt .field__row > input`) and therefore reaches into
 * this nested field — the panel lives inside the amount field's own row, so
 * the search box came out right-aligned, mono and 11px: a search that looked
 * like a balance. Same specificity, later in the file, so it wins without an
 * !important or a specificity war. */
.tdd__head .field__row > input{text-align:left;
  font-family:var(--font-sans);font-size:var(--text-sm);
  color:var(--text-primary)}
.tdd__list{max-height:320px;overflow-y:auto;padding-bottom:var(--space-2)}
.tdd__grp{padding:var(--space-2) var(--space-3) 4px;font-size:var(--text-xs);
  text-transform:uppercase;letter-spacing:.06em;color:var(--text-dim)}
.tdd__row{display:flex;align-items:center;gap:var(--space-3);
  padding:8px var(--space-3);cursor:pointer}
.tdd__row:hover,.tdd__row:focus-visible{background:var(--surface-hi);outline:none}
.tdd__row--on{background:var(--surface-hi)}
.tdd__txt{display:flex;flex-direction:column;min-width:0;flex:1}
.tdd__nm{font-weight:600;color:var(--text-primary)}
.tdd__sub{font-size:var(--text-xs);color:var(--text-dim);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
/* R69 (v11.119): a REASON line wraps. `.tdd__sub` clips a token NAME to
   one line, which is right for a name. The chain picker's sub-line is a
   sentence, and the header panel is 240px wide, so the sentence was cut
   mid-word. A sentence keeps every word. */
.tdd__sub--wrap{white-space:normal;overflow:visible;text-overflow:clip}
.tdd__bal{display:flex;flex-direction:column;align-items:flex-end;flex:none;
  font-family:var(--font-mono);color:var(--text-primary)}
.tdd__usd{font-size:var(--text-xs);color:var(--text-dim)}
.tdd__empty{padding:var(--space-4) var(--space-3);color:var(--text-dim);
  font-size:var(--text-sm)}
.tdd__note{border-top:1px solid var(--border);padding:var(--space-2) var(--space-3)}
.tdd__note .hint{margin:0}

/* OVER-BALANCE (v8.76). The pair fill no longer clamps itself to the wallet,
 * so a field can legitimately show what the pair COSTS rather than what you
 * hold. It has to read as a state, not as a number — the row's edge carries
 * it and the figure goes red, while the balance on the label stays dim so the
 * two are comparable at a glance. Not `:invalid`: the input already carries a
 * native `max` equal to the balance, and styling off that would also paint
 * every half-typed decimal red mid-keystroke. */
.field--over .field__row{border-color:var(--color-danger)}
.field--over .field__row > input{color:var(--color-danger)}
.field--over .field__hint{color:var(--color-danger)}
.amt__chip{position:relative;display:flex;align-items:center;gap:6px;flex:none;
  background:var(--surface-hi);border:1px solid var(--border);
  border-radius:var(--radius-full);padding:3px 9px 3px 4px;
  font-size:var(--text-md);color:var(--text-primary);
  font-family:var(--font-body);white-space:nowrap}
.amt__chip:hover{border-color:var(--brand-purple-400)}
/* focus-within, not :focus — the focusable element is the invisible select. */
.amt__chip:focus-within{border-color:var(--brand-purple-400);
  outline:2px solid var(--brand-purple-700);outline-offset:1px}
/* One token and no choice to make: no pill, no chevron, no affordance that
   lies. `--fixed` is the paired case, where the range decides both sides. */
.amt__chip--fixed{background:transparent;border-color:transparent;
  padding-left:0}
.amt__chip--fixed:hover{border-color:transparent}
.amt__chip img{width:19px;height:19px;border-radius:50%;
  flex:none}
.amt__chev{color:var(--text-dim);font-size:var(--text-sm);margin-left:1px}
/* ── The PAIRED deposit (D-14, v8.54 — sketch p5 step 3) ─────────────────
   Two pay-with fields that are visibly halves of ONE deposit: a bordered
   card holding both, an "and / or" rule between them. Width capped where the
   old single-field grid capped it — a full-width money field puts the chip
   and the number at opposite ends of a metre of row. */
.amt-pair{border:1px solid var(--border);border-radius:var(--radius-lg);
  background:var(--surface);padding:var(--space-3);display:flex;
  flex-direction:column;gap:var(--space-2);max-width:420px;
  margin-bottom:var(--space-3)}
.amt-pair__plus{display:flex;align-items:center;gap:var(--space-2);
  color:var(--text-dim);font-family:var(--font-mono);font-size:var(--text-xs)}
.amt-pair__plus::before,.amt-pair__plus::after{content:'';flex:1;height:1px;
  background:var(--border-soft)}
/* ZAP MODE HOLDS ONE FIELD (v8.62). The card is already a flex column, so a
   single child needs no layout change — the modifier exists to SAY that one
   field is the intended state rather than a pair that failed to render, which
   is the difference between a design and a bug when someone reads the DOM. */
.amt-pair--one{gap:0}
.amt-split{display:flex;align-items:center;gap:var(--space-2);
  margin-top:var(--space-2);font-family:var(--font-mono);
  font-size:var(--text-xs);color:var(--text-muted)}
.amt-split__bar{flex:1;height:6px;border-radius:var(--radius-full);
  overflow:hidden;display:flex;background:var(--bg)}
.amt__sel{position:absolute;inset:0;width:100%;height:100%;opacity:0;
  cursor:pointer;border:none;background:transparent;color:inherit;
  font:inherit;-webkit-appearance:none;appearance:none}
/* Chrome draws steppers on type=number and they collide with a right-aligned
   value; the presets and the clickable balance are the affordances here. */
.field--amt .field__row > input::-webkit-outer-spin-button,
.field--amt .field__row > input::-webkit-inner-spin-button{
  -webkit-appearance:none;margin:0}
.field--amt .field__row > input[type=number]{-moz-appearance:textfield}
.amt__usd{font-family:var(--font-mono);font-size:var(--text-xs);
  color:var(--text-dim);text-align:right;margin-top:-1px}

/* ONE DEPOSIT WITH TWO SIDES (sketch variant C). Two fields in a plain grid
 * said nothing about being halves of one thing; the card and the ratio bar
 * say it before the numbers do. The split is not a preference — it is fixed
 * by where the price sits in the range — so the bar is a READOUT, not a
 * control, and it carries no handle. */
.amt-pair{border:1px solid var(--border);border-radius:var(--radius-lg);
  background:var(--surface);padding:var(--space-3);display:flex;
  flex-direction:column;gap:var(--space-2)}
.amt-pair__plus{display:flex;align-items:center;gap:var(--space-2);
  color:var(--text-dim);font-family:var(--font-mono);font-size:var(--text-xs)}
.amt-pair__plus::before,.amt-pair__plus::after{content:'';flex:1;height:1px;
  background:var(--border-soft)}
.amt-split{display:flex;align-items:center;gap:var(--space-2);
  margin-top:var(--space-2);font-family:var(--font-mono);
  font-size:var(--text-xs);color:var(--text-muted)}
.amt-split__bar{flex:1;height:6px;border-radius:var(--radius-full);
  overflow:hidden;display:flex;background:var(--bg)}

/* ── The zero-positions state (v8.13) ──────────────────────────────────────
 * Its own block rather than another `.fee-loading`, which is a SPINNER class
 * doing duty as an empty state. Centred, and the routes out are buttons in
 * G6 order: the one that puts capital in is filled, the reads are not. */
.nopos{text-align:center;padding:var(--space-6) var(--space-5)}
.nopos__h{font-family:var(--font-display);font-size:var(--text-2xl);
  color:var(--text-strong);margin-bottom:var(--space-2);text-wrap:balance}
.nopos__body{font-size:var(--text-md);color:var(--text-muted);max-width:54ch;
  margin:0 auto var(--space-4);line-height:1.6}
.nopos__acts{display:flex;gap:var(--space-2);justify-content:center;
  flex-wrap:wrap}
.chart-box   { overflow: hidden; }   /* charts must clip their canvas */

/* ── Hint / caption ── replaces 64 hand-inlined copies of
 * "font-size:var(--text-xs);color:var(--text-dim)". */
.hint {
  font-size: var(--text-xs);
  color: var(--text-dim);
  line-height: 1.4;
}
.hint--block { margin-top: 4px; }
.hint--warn  { color: var(--color-warning); }
.hint--muted { color: var(--text-muted); }
/* A list that is prose, not an enumeration (v8.90). The finder's skipped-work
   notes are sentences; a browser's default disc-and-indent turns a plain
   account of what could not be checked into a bulleted warning list, which
   reads as more alarming than it is. */
.bare-list { list-style: none; margin: 0; padding: 0; }
.bare-list > li + li { margin-top: 3px; }
/* A hint that sits ABOVE the content it qualifies and carries an inline
 * action — "2 positions under $1 hidden · show them". Its own class rather
 * than four inlined declarations, because the inline-style budget is a
 * ratchet that only goes down. */
.hint--lede {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}
.hint--lede a { color: var(--brand-purple-200); }

/* ── Micro-label ── one uppercase label for every control and tile.
 * Moved out of the index.html inline block (raw 12px / legacy --muted). */
.label {
  font-size: var(--text-base);
  color: var(--text-muted);
  margin-bottom: 4px;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* ── Key/value readout ── the "term: value" row that pf-deltarow,
 * pf-yieldrow, pos-card__row and a dozen inline flex rows each re-invented
 * (its .kv rule was removed as dead in v9.58; flow-kv is the live form). */

/* ── Primary button family ── MOVED HERE FROM index.html's inline <style> at
 * v8.03, for exactly the reason .btn-sm moved at v6.55, and found before it
 * cost a release this time. The inline block is linked AFTER this file, so a
 * `.btn-run--sm` modifier written HERE sat at equal specificity and LOST —
 * silently: no error, no failed assertion, a modifier that simply does
 * nothing. The tray's rail card is the first component that needs one.
 *
 * Tokenized in the move rather than copied: 13px -> --text-md, 14px ->
 * --text-lg, the hand-written `linear-gradient(135deg,#5b52d4,#6c3ed1)` ->
 * --brand-gradient (the same two stops the token already held), and the two
 * greys #5a5a62 / #6a6a72 -> --text-dim / --text-muted. .btn-run's 15px is
 * the one real change: there is no 15px step in the scale, so it takes
 * --text-lg and the Run controls lose a pixel.
 *
 * Paddings stay raw. 14px and 11px are not on the 4px spacing grid and
 * rounding them would move every Run and tab control to make a comment
 * tidier. */
.btn {
  border: none; border-radius: var(--radius-md);
  padding: 9px 14px;
  font-size: var(--text-md); font-weight: var(--font-weight-semibold);
  cursor: pointer; font-family: var(--font-body);
}
.btn-run {
  width: 100%; padding: var(--space-3); font-size: var(--text-lg);
  background: var(--brand-gradient); color: var(--text-on-brand);
}
.btn-run:disabled {
  background: var(--surface-hi); color: var(--text-muted);
  cursor: not-allowed;
}
.btn-tab {
  background: transparent; color: var(--text-dim);
  border-bottom: 2px solid transparent; border-radius: 0;
  padding-bottom: 11px; font-size: var(--text-lg);
}
.btn-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
/* R104 (v11.136): a DISABLED tab reads as disabled. v9.48 (P1) removed the
   page's opacity from its off-tab modifier to lift the results nav's
   contrast, and put nothing in its place: an off tab (Epochs on a pool
   with no gauge) painted exactly like an enabled inactive tab. The
   contrast rule does not apply to an inactive control. This is the one
   disabled look for the family, the same shape as .btn-sm:disabled and
   .pill:disabled, keyed on the attribute the tab strip already sets. */
.btn-tab:disabled { opacity: .5; cursor: not-allowed; }
.tools-pill:disabled, .segbar__btn:disabled { opacity: .5; cursor: not-allowed; }
/* THE MODIFIER THE MOVE ABOVE EXISTS FOR. `.btn-run` is the page's Run
   control — full width, 12px of padding, the biggest button in the app. In
   232px of rail that is a slab. This rule is three declarations and it could
   not have been written before the base moved out of index.html's own
   <style>: at equal specificity, the later stylesheet wins, and the later
   stylesheet was the page's. It would have done nothing, silently. */
.btn-run--sm { padding: 9px; font-size: var(--text-md); }

/* ── Secondary button ── moved here from the index.html inline block so its
 * MODIFIERS can win (a modifier in this file lost to a base defined later).
 * Absorbs 12 cousin classes: variant-card__action, pool-address-row__action,
 * cache-state__clear, bound-step, pos-act, fee-refresh, hm-zoom-back,
 * hm-zoom-reset, gear-btn, pool-bar__swap, date-field__cal, lightbox__close. */
.btn-sm {
  font-size: var(--text-base);
  padding: 5px 10px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.btn-sm:hover:not(:disabled) {
  border-color: var(--brand-purple-400);
  color: var(--text-primary);
}
/* v6.55: was pre-brand indigo rgba(99,102,241,.1) — the last un-rebranded
 * color in the button system. */
.btn-sm.active, .btn-sm[aria-pressed="true"] {
  border-color: var(--brand-purple-400);
  color: var(--brand-purple-200);
  background: rgba(167,139,250,0.10);
}
.btn-sm:disabled { opacity: .5; cursor: default; }
.btn-sm--icon  { padding: 4px 8px; line-height: 1; }
.btn-sm--step  { font-family: var(--font-mono); font-weight: 600;
                 min-width: 22px; padding: 0 8px; user-select: none;
                 background: var(--surface-alt); color: var(--text-secondary); }
.btn-sm--round { border-radius: var(--radius-full); padding: 4px 12px; }
/* P5 (v9.48): the inline-link tier reaches the 24px hit target — a class of
   controls ("change", "change pool", "browse busiest pools"), not one. The
   quiet look stays; only the touchable area grows. */
.btn-sm--tiny  { font-size: var(--text-sm); padding: 5px var(--space-2);
                 min-height: 24px; }
.link-inline {
  font-size: var(--text-sm); color: var(--brand-purple-200); cursor: pointer;
  display: inline-block; padding: 5px 6px; margin: -5px -6px;
  border-radius: 4px; text-decoration: none;
}
.link-inline:hover { background: rgba(167, 139, 250, .08); }
.btn-sm--wide  { flex: 1; min-width: 90px; white-space: nowrap; }
.btn-sm--solid { background: var(--brand-purple-600); border-color: var(--brand-purple-600);
                 color: var(--text-on-brand); }
.btn-sm--solid:hover:not(:disabled) { background: var(--brand-purple-700);
                 border-color: var(--brand-purple-700); color: var(--text-on-brand); }
.btn-sm--danger:hover:not(:disabled) { border-color: var(--color-danger);
                 color: var(--color-danger); }
/* --row (SF21, v11.202): THE ACTION ON A ROW OF A TABLE, the medium
 * level of emphasis. The filled brand button (.btn-run, .btn-sm--solid)
 * is the one commit of a view; a table with 30 rows has 60 row actions
 * and must not have 60 of those. The plain .btn-sm edge (#2a2a35 on the
 * surface) is 1.3:1, under the 3:1 that WCAG 1.4.11 asks of a control's
 * edge, so an open action looked closed (the owner, 2026-09-29). Here:
 * a brand tint, a brand edge of 3.2:1 and brand text. A disabled row
 * action loses all three and becomes the grey that the open one was. */
.btn-sm--row { min-width: 64px; background: rgba(167,139,250,.12);
               border-color: rgba(167,139,250,.60);
               color: var(--brand-purple-200);
               font-weight: var(--font-weight-semibold); }
.btn-sm--row:hover:not(:disabled) { background: rgba(167,139,250,.24);
               border-color: var(--brand-purple-200); color: var(--text-strong); }
.btn-sm--row:disabled { opacity: 1; background: transparent;
               border-color: var(--border); color: var(--text-dim);
               font-weight: normal; cursor: not-allowed; pointer-events: none; }

/* ── chart-controls ── used 5x in markup since v5.87 with NO definition
 * anywhere (found by the #53 audit): the slot silently did nothing. */
.chart-controls { display: flex; align-items: center; gap: var(--space-2);
                  flex-wrap: wrap; }
/* --bare: chrome buttons with no resting border (gear, lightbox close). */
.btn-sm--bare { border-color: transparent; background: none; }
.btn-sm--bare:hover:not(:disabled) { border-color: var(--border); }
/* --loading: in-flight action (was .fee-refresh--loading). */
.btn-sm--loading { opacity: .6; cursor: progress; }

/* ── Field ── ONE labeled control (v6.56 · #53 step 3). Replaces six
 * dialects: comp-input, viab-input (+__row/__unit), variant-card__field,
 * the pair-lens fieldRow(), deploy's bare .label+input, and the Compare
 * mini-inputs. The unit lives INSIDE the focus ring (viab-input's shape —
 * the best of the six) so "±15%" reads as one control, which is what the
 * owner asked for when the Compare range number had no unit at all.
 * Built by kitField()/kitSelect() in index.html — markup shape is exactly
 * what drifted across the six, so a builder owns it, not a convention. */
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field__label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  color: var(--text-muted);
}
.field__row {
  display: flex; align-items: center; gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0 8px;
  min-width: 0;
}
.field__row:focus-within { border-color: var(--brand-purple-400); }
.field__unit {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  flex: none;
  user-select: none;
}
.field__row > input,
.field__row > select {
  flex: 1 1 auto; min-width: 0; width: 100%;
  background: transparent; border: none; outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-md);
  padding: 7px 4px;
}
/* v6.60: the kit select lost its dropdown arrow — the shared row rule above
   sets `background: transparent`, which wipes the global <select> arrow image.
   Re-supply the same chevron here (transparent COLOR, arrow IMAGE) so kit
   selects match raw ones. This is the black-no-arrow-vs-arrow mismatch the
   owner saw between the Compare card's kit and raw dropdowns. */
.field__row > select {
  cursor: pointer;
  padding-right: 18px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237a7a85' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 3px center;
  background-size: 9px 6px;
}
.field__hint { font-size: var(--text-xs); color: var(--text-dim); line-height: 1.4; }
.field--sm .field__row > input, .field--sm .field__row > select { padding: 4px; font-size: var(--text-sm); }
/* …but NOT the chevron gutter. The shorthand above is more specific than
   `.field__row > select`, so it also overrode the 18px padding-right that
   rule reserves for the arrow image — every small kit select painted its
   chevron on top of its own value. Invisible on a wide one and obvious on a
   narrow one (Model check's "Window" read as "30d" with the arrow through
   the d), which is how it survived since v6.60. */
.field--sm .field__row > select { padding-right: 16px; }
.field--sm .field__label { font-size: var(--text-xs); }
.field--inline { flex-direction: row; align-items: center; gap: var(--space-2); }
.field--inline .field__label { flex: none; margin: 0; }
.field--disabled { opacity: .5; }
.field--grow { flex: 1 1 0; }
/* v8.81: three widths, replacing the per-site `style="min-width:NNNpx"` that
   every hand-rolled <select> carried its own version of (160/180/240/280 —
   four numbers for the same intent). A select whose option text varies a lot
   needs a floor or the control resizes as the user picks; the floor belongs
   with the component, not at the call site. */
.field--w-sm .field__row { min-width: 160px; }
.field--w-md .field__row { min-width: 240px; }
.field--w-lg .field__row { min-width: 280px; }
/* OW1 (v11.223): a short number box in a row of controls (the trigger
   prices). The bare inputs it replaced set width:110px at the call site. */
.field--w-xs { flex: 0 0 auto; }
.field--w-xs .field__row { width: 112px; }

/* ── THE POPUP IS OURS NOW (v8.83) ─────────────────────────────────────────
 * Owner, on the HODL-reference dropdown: "it still a bit off compared to the
 * rest of the frontend assets… a very slight eye-sore." That whiteish outline
 * was never ours to style — a native <select>'s option list is drawn by the
 * OS, and Chrome computes `rgb(255,255,255)` for it against our #14141c
 * surface. Measured side by side: native picker background rgb(255,255,255),
 * radius 2px, no shadow; ours, below, rgb(20,20,28) / 8px / the token shadow.
 *
 * `appearance: base-select` moves the popup INTO the page, so ::picker(select)
 * takes the same tokens as everything else — while the control stays a REAL
 * <select>: keyboard, Escape, type-ahead and the mobile wheel are still the
 * platform's, and there is no open/closed state for a re-render to lose. That
 * is D-130 and D-131 intact rather than reversed; the argument for keeping
 * native selects was never about colour.
 *
 * THE @supports GUARD IS LOAD-BEARING, not politeness. `base-select` is an
 * invalid value elsewhere, so the whole declaration drops — and if the
 * hand-drawn chevron above were removed unconditionally, every non-supporting
 * browser would get a bare arrowless select. That is precisely the v6.60 bug
 * `.field__row > select`'s background-image was written to fix, reintroduced
 * by a redesign. Everything here is additive.
 *
 * SCOPED to `.field__row > select`, which makes the exclusion of the two
 * overlay chips DECLARED rather than accidental. `.amt__sel` is a select laid
 * over a visible pill at zero opacity, and ::picker(select) renders in the top
 * layer — measured: the picker computes `opacity: 1` even when its own select
 * is `opacity: 0`. Those chips would open a styled popup anchored to an
 * invisible control whose box model base-select had just changed underneath
 * them. They keep the platform menu, and `.amt__sel` is not a
 * `.field__row > select` in the first place (it is
 * `.field__row > .amt__chip > select`), so the scoping is structural. */
@supports (appearance: base-select) {
  .field__row > select,
  .field__row > select::picker(select) { appearance: base-select; }

  /* The UA supplies ::picker-icon now, so the hand-drawn arrow would DOUBLE.
     Both gutters go with it — they existed only to make room for it, and the
     16px one was itself a bug fix from v8.81. */
  .field__row > select {
    background-image: none;
    padding-right: 4px;
  }
  /* NOT `white-space:nowrap; overflow:hidden; text-overflow:ellipsis` here,
     though it is the obvious reflex and it was tried. base-select renders the
     button as a flex box whose text has no targetable element, so
     `text-overflow` never applies: `overflow:hidden` on the select produced a
     HARD clip ("…earn AERO e") and, worse, swallowed the ::picker-icon on
     exactly the one control that overflowed — a dropdown with no chevron,
     which is the v6.60 bug arriving from a new direction.
     So the wrap stands. It is strictly better than the native control's
     silent clip: the whole option is readable. Copy that needs two lines is a
     copy problem, and is fixed as one. */
  .field--sm .field__row > select { padding-right: 4px; }

  .field__row > select::picker-icon {
    color: var(--text-dim);
    transition: transform .15s ease;
  }
  .field__row > select:open::picker-icon { transform: rotate(180deg); }

  .field__row > select::picker(select) {
    appearance: base-select;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .55);
    padding: 4px;
    margin-top: 6px;
    /* The picker anchors to the CONTROL, which sits 9px inside the row (8px
       row padding + a 1px border), so it opened visibly inset from the field
       it belongs to. Pulled back onto the field's own edge, and widened by
       the same amount on both sides so it still spans the control. Same
       measurement, same reason, as `.tdd__panel`'s left:-7px. */
    margin-left: -9px;
    /* NOT `calc(100% + 18px)` (#183, owner-reported). ::picker(select) renders
       in the TOP LAYER, so a percentage resolves against the VIEWPORT, not
       against the control it is anchored to — and `min-width` beats
       `max-width`, so the 420px cap below was silently overridden. Measured
       on the LP-mode select at a 1920px viewport: a 234px control opened a
       1868px panel across the whole monitor. Every dropdown in the app shares
       this rule, so every one of them did it.
       `anchor-size(width)` is the anchor-relative unit this always wanted. If
       a browser does not support it the declaration drops and the panel sizes
       to its content under the cap — narrower than intended, never wider,
       which is the right way for this to fail. */
    min-width: anchor-size(width);
    /* An option longer than the closed control is CLIPPED in the button and
       whole in the menu; letting the panel outgrow its anchor is what makes
       that true rather than clipping twice. */
    max-width: min(420px, 92vw);
  }

  /* Restrained on purpose. D-130 settled that 29 of these controls are a
     handful of words with no icon and no second line; this gives the popup
     the app's surface and spacing, it does not turn options into rows. */
  .field__row > select option {
    padding: 7px 10px;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--text-md);
  }
  .field--sm .field__row > select option { font-size: var(--text-sm); }
  .field__row > select option:hover { background: var(--surface-hi); }
  .field__row > select option:checked { color: var(--brand-purple-200); }
  .field__row > select option::checkmark { color: var(--brand-purple-400); }
  .field__row > select option:disabled { opacity: .45; }
}

/* ── Metric-tile row ── (v6.57 · #53 step 4) the container the pos-summary
 * family provided; its __item/__k/__v are now .tile/__label/__value. Two
 * metric-tile families with identical anatomy and different names is exactly
 * the drift #53 exists to remove — .tile wins (36 uses vs 23, and it already
 * had the semantic --success/--danger/--warning modifiers). */
.tile-row { display: flex; gap: var(--space-3); flex-wrap: wrap; margin-top: var(--space-4); }
.tile-row > .tile { flex: 1; min-width: 120px; }
.tile-row--hero > .tile > .tile__value { font-size: var(--text-2xl); }
.tile__value--muted { color: var(--text-muted); }

/* ── Segmented control ── ONE toggle bar (v6.57 · #53 step 5). Merges
 * comp-seg, exp-modetoggle/exp-modebtn, and the .val-toggle + .btn-sm.active
 * pairs: three implementations of "inline-flex bordered strip, transparent
 * members, filled brand on-state" whose on-state colors had already drifted
 * apart. State is `.is-on` — a STATE class, not a per-family modifier, so a
 * new segbar can't invent `--active`/`--on`/`.active` again. */
.segbar {
  display: inline-flex; gap: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
  width: fit-content;
}
.segbar__btn {
  border: none; background: transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: color 120ms ease, background 120ms ease;
}
.segbar__btn:hover:not(.is-on) { color: var(--text-secondary); }
.segbar__btn.is-on { background: var(--brand-purple-700); color: var(--text-on-brand); }
/* A WINDOW STILL BEING READ. The 90-day candles on a pool with nothing cached
   take long enough to be indistinguishable from a click that did nothing, and
   the pill said nothing either way (owner, 2026-08-21). The spinner sits
   INSIDE the button so the bar does not reflow while it spins. */
.segbar__btn.is-busy { display: inline-flex; align-items: center; gap: 6px; }
.segbar__btn.is-busy .fee-spinner { margin: 0; }
.segbar--grow { width: auto; }
.segbar--grow .segbar__btn { flex: 1; }
/* AST-014: A STRIP INSIDE A TILE CANNOT BE WIDER THAN ITS TILE, and
   clipping is not an option — it would HIDE a cadence the user can
   choose. `width: fit-content` with nowrap members made the six-option
   cadence strip 188.6 px inside a 144 px tile content area at 1280 px,
   so its last button drew past the tile and over its neighbour. Measured
   at 1920 px too, so this was never a mobile-only concern.
   This modifier lets the strip take the tile's width and wrap onto a
   second row. The border and radius stay on the CONTAINER, so a wrapped
   strip still reads as one control. */
.segbar--wrap {
  display: flex; width: 100%; max-width: 100%;
  flex-wrap: wrap; row-gap: 2px;
}
.segbar--wrap .segbar__btn { flex: 1 1 auto; text-align: center; }
/* The deposit's pay-mode switch sits directly above the amount card, and the
   gap belongs to the component rather than to an inline style — the kit's
   inline-style ratchet only goes down (v8.62). */
.segbar--paymode { margin-bottom: var(--space-3); }

/* ── Badge / chip ── ONE small status token (v6.57 · #53 step 6). Merges
 * pos-badge (tokens.css) and pbar-chip (index.html) — near-identical mono
 * pill-shaped chips defined in DIFFERENT FILES, each with its own green
 * --staked variant that had already drifted (rgba .45 vs .35 border). The
 * semantic modifiers are shared with the rest of the kit's color language. */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.badge--brand   { color: var(--brand-purple-200); border-color: var(--brand-purple-700); }
/* v7.07: two neutral variants the kit was missing. The pool finder needs to
 * mark a row's POOL TYPE (v2 stable / v2 volatile / v3), which is a factual
 * label, not a judgement — so it must not borrow --success or --warning and
 * imply one venue is better than another. Extending the kit rather than
 * styling the one instance is G0. */
.badge--info    { color: var(--color-info);  border-color: var(--brand-purple-700); }
.badge--muted   { color: var(--text-muted);  border-color: var(--border); }
.badge--success { color: var(--color-success);
                  border-color: color-mix(in srgb, var(--color-success) 45%, transparent);
                  background: color-mix(in srgb, var(--color-success) 8%, var(--bg)); }
.badge--warning { color: var(--color-warning);
                  border-color: color-mix(in srgb, var(--color-warning) 45%, transparent); }
.badge--gold    { color: var(--color-vfat);
                  border-color: color-mix(in srgb, var(--color-vfat) 45%, transparent);
                  background: color-mix(in srgb, var(--color-vfat) 8%, var(--bg)); }

/* ── Tooltip affordance ── (v6.58 · #53 step 7) The audit found 100 native
 * title= tooltips and exactly ONE that advertised itself. A tooltip nobody
 * knows about is a tooltip nobody reads — especially the ones carrying
 * methodology (how a number was derived). .has-tip marks the element as
 * hoverable without inventing a custom popover: same native tooltip, a
 * visible cue. Applied where the title EXPLAINS something, not where it
 * merely repeats a label. */
/* The dotted grey affordance v8.00 replaced is deleted here. Its rule
   outlived its last call site by six releases; leaving it would be a third
   way to mark a tooltip, sitting there for someone to pick. */
/* THE RULE THESE THREE DEAD LINES ENCODED, AND THE MIGRATION LOST.
   They said, in v6.5x: "On block elements (tiles, table headers) the underline
   would span the whole box; mark just the text child instead." v8.00 carried
   the CLASS to .tipmark--brand and left the knowledge behind, put the
   underline straight onto twelve tiles and a table header, and the owner
   found the rule across a whole hint line three releases later.
   A migration that moves a class without moving what the class had learned
   is a migration that ships an old bug under a new name. The rule is back
   above, as .tile[data-tip] .tile__label::after, and the suite asserts it. */

/* ── Table ── (v6.58 · #53 step 8) ONE data table. comp-readout-table was
 * already the de-facto standard (8 uses); .tbl is its kit name, with the
 * numeric-column convention (mono + tabular figures + right-align) baked in
 * so per-cell inline text-align/padding stops being hand-written. */
.tbl { width: 100%; border-collapse: collapse; font-size: var(--text-base); }
.tbl th {
  text-align: left; padding: 6px 8px;
  color: var(--text-muted); font-weight: var(--font-weight-medium);
  font-size: var(--text-xs); text-transform: uppercase;
  letter-spacing: var(--tracking-label);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl td {
  padding: 6px 8px; border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl .num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* R125: the lending figures wear one colour wherever they appear — the two
   per-bin columns and the yield-split tile. Stated once here, so the page
   does not repeat it inline three times and the ratchet keeps falling. */
.lend-amt { color: var(--chart-5); }
/* R127: a typed-but-unsaved lane value. One class, so the warning colour
   is stated here rather than inline beside every step that can be dirty. */
.step__meta--unsaved { color: var(--color-warning); }
.tbl td.lend-amt, .tbl td.lend-time { font-family: var(--font-mono); }
.tbl td.lend-time { color: var(--text-muted); }
.tbl--tight th, .tbl--tight td { padding: 3px 6px; }
.tbl-scroll { overflow-x: auto; }

.tbl__accent { color: var(--text-primary); }

/* ── Compare fine-tune fields ── (v6.60) the Conc/K/Rebal/period/Convert-into
 * controls in a variant card's second row are kit .field.field--inline.field--sm
 * now (were raw inline <input>/<select>). Keep them compact so the row still
 * wraps tidily: label hugs the control, inputs size to content. (The
 * .variant-card__fine rules were removed as dead in v9.58.) */


/* #66 (v7.10): the full-emissions-history opt-in, now rendered under the
 * LP-mode selector instead of buried in the settings gear. Inline styles
 * removed with the move (G0) - this is a kit rule like everything else. */
.emfull {
  display: flex; gap: 7px; align-items: flex-start;
  margin-top: var(--space-2); cursor: pointer;
}
.emfull input { width: auto; margin: 2px 0 0; flex: none; }
.emfull__t {
  display: block; font-size: var(--text-sm); color: var(--text-secondary);
}
.emfull__s {
  display: block; font-size: var(--text-xs); color: var(--text-dim);
  line-height: 1.4; margin-top: 1px;
}

/* #67 (v7.15): pool-finder option C - magnitude bars behind the APR numbers,
 * plus the four legibility fixes the owner listed. */
.pf-table td, .pf-table th { font-size: var(--text-base); }
/* The rows LOAD a pool on click and nothing said so - the missing hover was a
 * discoverability bug, not a polish item. */
.pf-table tbody tr { cursor: pointer; transition: background 90ms ease; }
.pf-table tbody tr:hover { background: var(--surface-alt); }
/* Venue cell, in order of how likely it is to be checked. */
.pf-venue { color: var(--text-muted); font-size: var(--text-sm); margin-right: 6px; }
/* D-298 (LB33): the finder row's staleness mark. */
.pf-lag { color: var(--color-warning); font-size: var(--text-xs); }
.pf-fee {
  display: inline-flex; font-family: var(--font-mono); font-size: var(--text-sm);
  padding: 2px 7px; border-radius: var(--radius-sm);
  background: var(--surface-hi); color: var(--text-secondary); margin-right: 6px;
}
/* Bar grows from the RIGHT, where the number is anchored: a left-anchored bar
 * puts magnitude at one end of the cell and digits at the other. */
.pf-bar {
  position: relative; display: inline-block; min-width: 62px;
  padding: 3px 7px; border-radius: var(--radius-sm);
}
.pf-bar__fill {
  position: absolute; top: 0; bottom: 0; right: 0;
  border-radius: var(--radius-sm); opacity: .30;
}
.pf-bar__v { position: relative; }
/* BF8 (D-425): every row keeps the height of two scenarios, and a single
 * scenario sits on the row's text line, not in the upper slot. */
.pf-income {
  display: inline-grid;
  grid-auto-rows: 1.9em;
  min-height: calc(2 * 1.9em + var(--space-1));
  align-content: center;
  gap: var(--space-1);
}
.pf-income__scenario {
  display: grid;
  grid-template-columns: 8ch 9ch 16ch 2ch;
  gap: var(--space-2);
  align-items: center;
  white-space: nowrap;
}
.pf-income__scenario > .pill { justify-self: start; }
.pf-income__scenario > .hint { text-align: left; }
.pf-income__warning { color: var(--color-warning); text-align: center; }
.tdd__row--address .tdd__sub {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

/* ═══════════════════════════════════════════════════════════════════════════
   v8.00 — THE REVAMP KIT
   Ported from ui/sketch_frontend.html, which the owner reviewed and settled
   variant by variant. The sketch loaded THIS file, so these rules were
   designed against the real tokens and need no re-tuning; what changes here is
   that the sketch's per-instance `style=` positioning becomes modifier classes,
   because the inline-style budget (group 0d) only ever ratchets DOWN.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Tooltip (.tip) — replaces every native title= ─────────────────────────
   WHY A COMPONENT AND NOT `title=`. Native tooltips are drawn by the OS: that
   yellow is Windows and cannot be restyled, they wait ~500ms, they never
   appear on touch, and they CANNOT HOLD MARKUP — several of ours carry a
   methodology line that deserves an equation. `.tip__eq` is exactly that.

   MIGRATION RULE, enforced by the suite: an element carries `data-tip` OR
   `title`, never both, or the browser paints its own on top of ours. */
.tip-anchor { position: relative; display: inline-block; }
.tip {
  position: absolute; z-index: 900;
  bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: 290px;
  background: var(--surface-alt); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: var(--space-3);
  font-family: var(--font-body); font-size: var(--text-sm);
  color: var(--text-secondary); line-height: 1.55; text-align: left;
  box-shadow: 0 0 0 1px rgba(108,62,209,.18), 0 10px 28px rgba(0,0,0,.6);
  opacity: 0; pointer-events: none;
  transition: opacity 120ms, transform 120ms;
}
.tip-anchor:hover .tip { opacity: 1; transform: translateX(-50%) translateY(-2px); }
.tip::after {
  content: ""; position: absolute; top: 100%; left: 50%; margin-left: -6px;
  border: 6px solid transparent; border-top-color: var(--border);
}
/* Edge-anchored variants. A tip on the last column of a table, or in the rail,
   would otherwise be clipped by the viewport — the sketch did this with inline
   `left:auto;right:-8px`, which the budget forbids. (The .tip--right and
   .tip--left rules were removed as dead in v9.58.) */
/* THE SHIPPED FORM: one shared node, positioned from JS against the hovered
   element's rect and clamped to the viewport (see tipShow). `position: fixed`
   because it is a child of <body>, not of the thing it describes — which is
   also why scrolling dismisses it. */
/* REACHABLE (v8.05). `.tip` sets `pointer-events:none`, which is right for a
   tip that only ever needs reading — but ours carries an NFT id, a range and
   a manager ADDRESS, and the owner could read the address and not copy it:
   crossing the 9px gap to select it dismissed the tip. The floating variant
   takes pointer events and selectable text; `tipHideSoon`'s 200ms grace is
   what makes the crossing survivable. */
.tip--float {
  position: fixed; bottom: auto; left: 0; top: 0; transform: none;
  opacity: 0; visibility: hidden;
  transition: opacity 120ms;
  /* INERT BY DEFAULT, and v8.05 got this wrong. Making every tip
     pointer-interactive so the address inside one could be copied turned all
     132 of them into obstacles: overshoot onto `Close + burn`, its tip covers
     the 25% button you were aiming at, you move onto the tip — and now you
     are HOVERING it, so it never fades. Owner-reported, and a regression.
     Only a tip carrying something to take (an address) earns pointer events;
     the other ~120 are back to being scenery you can move straight through. */
  pointer-events: none;
}
.tip--float.tip--grab { pointer-events: auto; user-select: text; cursor: default; }
.tip--float.is-on { opacity: 1; visibility: visible; }
.tip--float::after { display: none; }
.tip__t { display: block; font-weight: 600; color: var(--text-strong); margin-bottom: 3px; }
.tip__eq {
  display: block; font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--brand-purple-200); background: var(--bg);
  border-radius: var(--radius-sm); padding: 4px 7px; margin-top: 6px;
}
/* Inside the FLOATING tip this block is click-to-copy, so it has to look
   like something you can click. Selecting 42 monospace characters out of a
   box that is 290px wide is not a thing to ask of anyone. */
.tip--float .tip__eq { cursor: pointer; }
.tip--float .tip__eq:hover { background: var(--surface-hi); }
.tip__eq--copied { color: var(--color-success); }
/* X87 (v11.183): a label above a copyable block, when a tip names two
   addresses (a lending market's token and its contract). */
.tip__eql {
  display: block; margin-top: 8px; font-size: var(--text-xs);
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.tip__eql + .tip__eq { margin-top: 3px; }

/* THE AFFORDANCE, settled after the owner could not find the old one at all:
   a --border hairline on a dark surface is invisible. Brand purple AT REST,
   deepening on hover. I pushed back on the literal proposal to FADE on hover —
   dimming on hover is the DISABLED signal everywhere else in this app, so it
   would teach two opposite things with one gesture. */
/* INLINE TEXT ONLY. On a block element `border-bottom` spans the entire
   row and reads as a horizontal rule — the owner caught it under a whole
   hint line. Buttons never take it either: a button already looks
   interactive, and underlining it says 'link' about something that is not
   one. Labels and table headers use --i instead, where an underline would
   fight the uppercase letter-spacing. */
.tipmark--brand {
  border-bottom: 1px solid var(--brand-purple-300);
  transition: border-color 120ms, color 120ms;
}
.tipmark--brand:hover { border-bottom-color: var(--brand-purple-700); color: var(--text-strong); }
/* For LABELS and TABLE HEADERS, where an underline would fight the uppercase
   letter-spacing: a circled i after the text. */
/* No cursor change here, deliberately. The OS arrow-and-question-mark
   pointer is Windows 95 with a purple theme on top, cannot be styled, and
   says what the underline (or the circled i) already says. Owner-reported.
   The suite asserts that property is set nowhere, so it cannot be named
   here either. */
.tipmark--i { }
/* A TILE marks itself, and only when it actually carries a tooltip. Applying
   the marker in markup put an "i" on every tile including the ones with
   nothing to say — a promise of information where there is none, which is the
   same defect as a tooltip nobody needs, drawn smaller. The attribute
   selector cannot get out of step with the data-tip because it IS the
   data-tip. */
/* F12 (v11.69), DEV-13's settled rule made structural: labels and table
   headers that CARRY a tooltip mark themselves with the circled i, the
   same way tiles have since v8.05. The attribute selector cannot get
   out of step with the data-tip because it IS the data-tip; a label
   with nothing to say gets no mark. */
.tile[data-tip] .tile__label::after,
th[data-tip]::after,
.label[data-tip]::after,
.tipmark--i::after {
  content: "i"; display: inline-flex; align-items: center; justify-content: center;
  width: 12px; height: 12px; margin-left: 5px;
  border-radius: var(--radius-full); border: 1px solid var(--text-dim);
  color: var(--text-dim); font-family: var(--font-mono); font-size: 9px;
  line-height: 1; vertical-align: 1px;
}
.tipmark--i:hover::after { border-color: var(--brand-purple-400); color: var(--brand-purple-200); }

/* ─── The tray, as a rail card ──────────────────────────────────────────────
   MOVED OUT OF THE FIXED BOTTOM DOCK at v8.04 — .tray-dock and its whole
   family are deleted, not deprecated. The rail reads top to bottom as one honest
   story: everything above is READ — wallet, value, income, delta — and the
   tray is the one WRITE surface, last. A dock that floats over the content it
   describes cannot say that.

   Portfolio only, by the owner's call: "that's the command center, the other
   tabs have different purposes." A count badge on the Portfolio nav button
   carries it everywhere else, so a queue is never silently forgotten. */
.tray-card {
  background: var(--surface); border: 1px solid var(--brand-purple-700);
  border-radius: var(--radius-lg);
}
.tray-card__head {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3); border-bottom: 1px solid var(--border-soft);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.tray-card__title {
  font-family: var(--font-display); font-size: var(--text-md);
  color: var(--text-strong); font-weight: 600;
}
.tray-card__n {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-on-brand); background: var(--brand-purple-700);
  border-radius: var(--radius-full); padding: 1px 7px;
}
.tray-card__sig { margin-left: auto; font-size: var(--text-xs); color: var(--text-muted); }
.tray-card__list { max-height: 210px; overflow-y: auto; }
.tray-card__foot {
  padding: var(--space-3); border-top: 1px solid var(--border-soft);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  display: flex; flex-direction: column; gap: 6px;
}

/* TWO LINES, because 232px of rail cannot hold "Claim fees · WETH/USDC · bin 2
   of 3" on one. The second line is mono: it is an identifier, not prose. */
.tray-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 7px var(--space-3); border-bottom: 1px solid var(--border-soft);
}
.tray-item:last-child { border-bottom: none; }
.tray-item:hover { background: var(--surface-alt); }
.tray-item__v { flex: 1; min-width: 0; }
.tray-item__k { font-size: var(--text-base); color: var(--text-primary); display: block; }
.tray-item__s {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-dim); display: block;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tray-item__x {
  color: var(--text-dim); cursor: pointer; font-size: var(--text-sm);
  line-height: 1.2; padding: 0 3px;
}
.tray-item__x:hover { color: var(--color-danger); }
/* An EXIT (close/withdraw) is the one row shape worth flagging before it is
   signed — same warning stripe the dock used. */
.tray-item--exit { box-shadow: inset 2px 0 0 var(--color-warning); }
/* IN FLIGHT (v7.74): signed and sent, waiting on the chain. No × — removing a
   row whose transaction is already in the mempool is how a withdrawal gets
   sent twice. */
.tray-item--sent { opacity: .6; }
.tray-item--sent .tray-item__x { display: none; }
/* The sketch drew --sent as opacity alone and never drew the WORD, so the
   deck was an incomplete spec here: dimmed is how this app also renders
   "disabled", and a user cannot tell "already signed and sent" from "you
   cannot do this". The dock said the word; the card says it too. */
.tray-item__flag {
  font-family: var(--font-body); font-size: var(--text-xs);
  color: var(--brand-purple-200); text-transform: uppercase;
  letter-spacing: var(--tracking-label); margin-left: 5px;
}
/* P26 (v9.46): a sent row whose receipt never arrived within the bounded
   wait — the flag stops reading as routine progress. */
.tray-item__flag--stale { color: var(--color-warning); }
/* The one line the tray writes back to the user — what was queued, what was
   left out and why. It sits between the list and the button because that is
   where it is read: after acting, before signing. */
.tray-card__note {
  padding: 0 var(--space-3) var(--space-2);
  font-size: var(--text-xs); color: var(--text-muted); line-height: 1.45;
}

/* ─── Button tiers: weight encodes CONSEQUENCE, never position ──────────────
   The three tiers already existed and were semantically right. Two defects:
   row one used `btn-sm--wide` (flex:1) and row two did not, so the two rows
   disagreed on width; and `btn-sm--bare` has no resting background, so the
   tertiary tier read as broken rather than as quiet.

   THE RULE, now also in UI_PRINCIPLES.md:
     filled   — puts capital IN            (Add capital, Deploy)
     outlined — moves money that EXISTS    (Claim, Close, Compound)
     ghost    — touches no money           (Rename, History, Forget)
   A hairline separates the money row from the meta row, so the boundary is
   visible before the click rather than learned after it. */
.btn-sm--ghost {
  border-color: transparent; background: var(--surface-alt);
  color: var(--text-muted);
}
.btn-sm--ghost:hover:not(:disabled) {
  border-color: var(--border); background: var(--surface-hi);
  color: var(--text-secondary);
}
/* A TOGGLE that happens to be quiet is still a toggle. .btn-sm.active sits
   ~400 lines above --ghost, so ghost's later background/border/color simply
   erased the pressed look — the Bins button would have opened its list and
   gone on looking closed. This is the same "modifier defined earlier loses"
   trap the .btn move above fixes, one level down. */
.btn-sm--ghost.active, .btn-sm--ghost[aria-pressed="true"] {
  border-color: var(--brand-purple-400); color: var(--brand-purple-200);
  background: rgba(167, 139, 250, 0.10);
}
/* The filled tier has nowhere brighter to go, so its pressed state is an
   inset ring rather than a lift. */
.btn-sm--solid[aria-pressed="true"] {
  box-shadow: inset 0 0 0 2px var(--brand-purple-200);
}
/* Natural label width decides the line before flex stretches its buttons.
   A zero basis fitted three 96px buttons at the 340px card minimum, but
   Compound yield clipped inside its border. Keep the 90px minimum for
   short labels; the auto basis lets longer controls wrap as a whole. */
.btn-row {
  display: flex; gap: var(--space-2); flex-wrap: wrap;
}
.btn-row > .btn-sm { flex: 1 1 auto; min-width: 90px; white-space: nowrap; }
/* --border, NOT --border-soft. Measured on the real card: soft is #1a1a22 on
   a #14141c surface — six units of difference, which at the owner's viewport
   is not a quiet line, it is no line. G6's claim is that the boundary is
   visible BEFORE the click; a separator nobody can see makes the mechanism
   the principle names a no-op while every gate agrees it is there. */
.btn-row--meta {
  margin-top: var(--space-2); padding-top: var(--space-2);
  border-top: 1px solid var(--border); gap: var(--space-1);
}
/* BOTH ROWS STRETCH (D-10, agreed 2026-08-05, built v8.59 after the owner
   re-reported it from the field: "the second button row on positions are not
   stretching to the end of the line"). Two rows of buttons that disagree on
   width read as two unrelated things.

   The history is the trap, and it is why this is `1 1 auto; min-width: 0` and
   not `1; min-width: 90px`. Measured on the real card: 356px of content, four
   ghost buttons, 4×90 + 3×4 = 372 — over budget, so `Forget` wrapped onto a
   line of its own and, being alone, stretched to the card's full width. The
   most destructive-sounding control on the row became the widest button on it.
   A 0 min-width lets the four SHRINK to share one line instead of wrapping,
   which is what makes stretching safe here; `white-space: nowrap` is inherited
   from `.btn-row > .btn-sm`, and these labels (Bins (3) / Rename / History /
   Forget) fit at ~86px. The visual hierarchy G6 wanted is still carried by the
   separator above the row and by the ghost tier of the buttons themselves —
   by tier, not by width. */
.btn-row--meta > .btn-sm { flex: 1 1 auto; min-width: 0; }

/* ─── .flow — the modal shell (v8.06) ───────────────────────────────────────
   Settings is its first consumer and the ~90 confirm()/alert() sites are the
   second, which is the order on purpose: rehearse the geometry on a surface
   with no money path before putting it in front of a signature.

   ONE geometry, not two. The gear used to open a 320px fixed popover
   (.settings-panel) anchored to the corner of the window — a shape nothing
   else in the app used, that could not grow, and that had to invent its own
   outside-click rule.

   The backdrop closes on POINTERDOWN, not click, and only when the pointer
   went down on the backdrop ITSELF. That is the v5.96 lesson kept: a
   drag-select that starts inside an input and releases outside fires its
   click on the common ancestor, so a click-to-close dismissed the dialog
   while you were selecting your own API key. */
.flow-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(8, 8, 12, 0.72); backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--space-6) var(--space-4); overflow-y: auto;
}
.flow {
  width: 520px; max-width: 100%;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 0 0 1px rgba(108, 62, 209, .22), 0 18px 50px rgba(0, 0, 0, .6);
  overflow: hidden;
}
.flow--wide { width: 640px; }
/* OB1 (OT157, D-350 point 1): A DIALOG THAT HOLDS A POPOVER. .flow clips
   its content (overflow: hidden), so the token list of Add capital was cut
   at the dialog's bottom edge and its last rows could not be reached
   (OT152). Here the list hangs over the edge, and the backdrop scrolls to
   it. No child of the Add dialog has a background at a corner, so the
   rounded corners stay. New position keeps its own scrolling body
   (.flow--np). */
.flow--popover { overflow: visible; }
/* The history/manage modal (D-172, v9.56): the seven-column events ledger
   needs more room than --wide, less than --np. One rule, kit-owned. */
.flow--ledger { width: 780px; }
@media (max-width: 820px) { .flow--ledger { width: 100%; } }
/* The new-position overlay carries a pool picker AND a deposit form; 640px
   puts the picker's search, list and the form's two-up rows all on top of one
   another. Capped at the viewport so it never needs a horizontal scroll. */
.flow--xl { width: 880px; }
.flow__head {
  display: flex; align-items: flex-start; gap: var(--space-2);
  padding: var(--space-4); border-bottom: 1px solid var(--border-soft);
}
.flow__title {
  font-family: var(--font-display); font-size: var(--text-xl);
  color: var(--text-strong); font-weight: var(--font-weight-semibold);
}
.flow__sub {
  /* The ported dialogs carry the blank lines they were written with; without
     this every paragraph ran together into one block (v8.85). `pre-line`
     rather than `pre` so the text still WRAPS at the card's width. */
  white-space: pre-line; font-size: var(--text-sm); color: var(--text-muted); margin-top: 2px; }
/* Two words in the whole app carry a verdict inside running prose:
   whether these settings are YOURS or SHARED with every visitor to this
   server. Semantic, not decorative, so they are classes and not two more
   inline styles against a budget that only goes down. */
.flow__sub .ok   { color: var(--color-success); }
.flow__sub .warn { color: var(--color-warning); }
/* The glyph, not the box: at --text-base a × in a 29px pill reads as a speck.
   Measured on the rendered dialog, which is the only place that shows. */
.flow__x {
  margin-left: auto; flex: none;
  font-size: var(--text-xl); line-height: 1; padding: 2px 10px 4px;
}
.flow__tabs {
  padding: var(--space-3) var(--space-4) 0;
}
.flow__body { padding: var(--space-4); }
/* The paragraphs an armed ask carries (v8.88) — the one-shot dialog's body,
   living on the run card while its question waits. pre-line keeps the ported
   copy's own paragraph breaks without trusting it as markup. */
/* v9.36 (D-158): the tray's two pickers moved off the rail and into the
   flow modal, where the plan they change has actually been simulated. They
   sit between the steps and the foot, hairline-separated so they read as
   controls rather than as another row of the description above them. */
.flow__controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
}
/* The rail sized these for a 232px column; the modal is wider, and a select
   stretched across it reads as a text field. Capped, not centred: the label
   above it is left-aligned and a centred control under a left label looks
   like two unrelated things. */
.flow__controls > .field { max-width: 420px; }
.flow__prose {
  padding: 0 var(--space-4) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.55;
  white-space: pre-line;
}
/* v9.71: the collapsed half of a flow question. The paragraphs that answer
   a FOLLOW-UP live here so the ones that answer THE question can be read.
   Deliberately quiet — a disclosure that shouts competes with the very
   decision it is standing aside for. */
.flow__more { padding: 0 var(--space-4) var(--space-3); }
.flow__more > summary {
  cursor: pointer;
  list-style: none;
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding: var(--space-1) 0;
  user-select: none;
}
.flow__more > summary::-webkit-details-marker { display: none; }
.flow__more > summary::before {
  content: "\203A";                 /* › — rotates to ⌄ when open */
  display: inline-block;
  margin-right: var(--space-2);
  transition: transform .15s ease;
}
.flow__more[open] > summary::before { transform: rotate(90deg); }
.flow__more > summary:hover { color: var(--text-secondary); }
.flow__more > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.flow__more .flow__prose { padding: var(--space-2) 0 0; }
@media (prefers-reduced-motion: reduce) {
  .flow__more > summary::before { transition: none; }
}
/* v8.85: a ported dialog is a headline and its paragraphs — no steps, so
   flowStepsHtml returns "" and this box reserved a step's worth of empty
   height between the text and the buttons. Hidden when it has nothing in
   it, rather than by giving the adapters a fake step to fill it. */
.flow__body:empty { display: none; }


/* #153b (v8.73): the receipt keeps the finished sequence above its rows, so
   the last step is SEEN to complete instead of the list vanishing at success.
   A hairline between the two says "this is what happened" then "this is what
   it moved" without a heading for either. */
.flow__body--receipt .step:last-of-type {
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-3);
}

.flow__body > * + * { margin-top: var(--space-3); }
.flow__foot {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-soft); background: var(--surface-alt);
}
.flow__spacer { margin-left: auto; }
/* THE FOOT'S BUTTONS DO NOT SHRINK (v8.61). The foot is a flex row whose
   first child is a sentence, and a long one squeezed "Sign in wallet" into
   three stacked words — seen in the rendered dialog, not in the markup. The
   hint is what may wrap; the control the user is about to press is not. */
.flow__foot .btn-sm,
.flow__foot .btn-run { flex: none; white-space: nowrap; }
/* The flow's primary control sizes to its label rather than to the row — the
   geometry lives here, not in four inline styles (v8.62, kit ratchet). */
.flow__foot .btn-run { width: auto; padding: 7px 16px; }
.flow__foot .hint { min-width: 0; }

/* ─── .np2 — the New position panel: two panes and a bar (v8.66, D-123) ───
   Variant D from `ui/sketch_newpos.html`: variant C's frame with variant A's
   left pane. LEFT is everything that changes the picture, beside the picture.
   RIGHT is a tab row, and a tab may only hold things that do NOT change the
   picture — that is the rule that lets automation and lending drop in later
   without moving anything. The BAR carries the committing numbers, so no tab
   can conceal what is about to be signed.

   THE MODAL SCROLLS ITSELF, and that is load-bearing rather than cosmetic.
   `.flow` sets `overflow:hidden`, which makes it a scrollport that never
   scrolls — `position:sticky` inside it is inert, so a bar that must never
   hide could not be made to stick. Capping the dialog at the viewport and
   giving the BODY the scroll puts a real scrollport around both panes. */
.flow--np { width: 1060px; max-height: calc(100vh - var(--space-6) * 2);
  display: flex; flex-direction: column; }
.flow--np > .flow__head { flex: none; }
.flow--np > .flow__body { flex: 1 1 auto; min-height: 0; overflow: auto;
  padding-bottom: 0; }

.np2 { display: grid; grid-template-columns: 1.35fr 1fr; align-items: start; }
.np2__left {
  position: sticky; top: 0; min-width: 0;
  padding-right: var(--space-4); border-right: 1px solid var(--border-soft);
}
.np2__right { padding-left: var(--space-4); min-width: 0; }
.np2__right > * + * { margin-top: var(--space-3); }
.np2__tabs { margin-bottom: var(--space-3); }
/* The bin table has five columns in a ~400px pane; the kit's default size
   fits a full-width result and not this one. Read on hover for the ticks. */
.np2__right .tbl { font-size: var(--text-xs); }

/* The facts the four summary tiles used to carry, in a caption's register. */
.np2__facts {
  display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4);
  margin-top: var(--space-3);
  font-size: var(--text-xs); color: var(--text-dim);
}
.np2__facts b {
  color: var(--text-secondary); font-family: var(--font-mono);
  font-weight: var(--font-weight-normal);
}

.np2__bar {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  margin-top: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border-soft); background: var(--surface-alt);
}
/* Inside the dialog it spans the body's full width, so the bar reads as a
   floor rather than as one more card in the column. Outside it (the Tools
   route) it stays inside the content column, because there is no padding
   there to reach back through. */
.flow--np .np2__bar {
  margin-left: calc(-1 * var(--space-4)); margin-right: calc(-1 * var(--space-4));
}
.np2__nums {
  display: flex; gap: var(--space-4); flex-wrap: wrap;
  font-size: var(--text-sm); color: var(--text-muted);
}
.np2__nums b {
  color: var(--text-strong); font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.np2__spacer { margin-left: auto; }
/* Same rule as .flow__foot: the sentence may wrap, the control may not. */
.np2__bar .btn-sm, .np2__bar .btn, .np2__bar .btn-run { flex: none; white-space: nowrap; }
.np2__bar .btn-run { width: auto; padding: 8px 20px; }
.np2__bar .hint { min-width: 0; }

/* ── MOBILE IS VARIANT B, and it is this component at a breakpoint (S3) ──
   Not a second design: the panes stack, the deposit leads, the chart follows
   and shortens. Variant B's order is the DEX order the owner named — tokens
   first, range under them — so `order` reverses the two panes rather than the
   markup, which keeps ONE tab body in the DOM and one source for both widths.
   The tab row stays a tab row: turning it into B's disclosures would need
   both bodies mounted, and two `deployB0`s on one page is the defect the
   single-body rule exists to prevent. */
@media (max-width: 900px) {
  .flow--np { width: 100%; }
  .np2 { display: flex; flex-direction: column; }
  .np2__right { order: 1; padding-left: 0; }
  .np2__left {
    order: 2; position: static; padding-right: 0; padding-top: var(--space-3);
    margin-top: var(--space-3);
    border-right: 0; border-top: 1px solid var(--border-soft);
  }
  /* THE PANEL CANNOT BE NARROWER THAN ITS WIDEST GRID. `.rng` is
     `1fr clamp(132px,16%,280px) 78px`, whose min-content width is ~420px, and
     a flex item does not shrink below min-content unless it is told to - so
     the dialog stayed 420px wide inside a 375px viewport and the whole PAGE
     scrolled sideways. Measured in the pane, not deduced: `.flow--np`'s own
     `width:100%` and `.flow`'s `max-width:100%` were both already correct. */
  .np2 .rng {
    height: 200px;
    /* Stacked, the panel is the full dialog width, so a fixed depth column
       becomes a sliver against a very wide history - the same mistake the
       desktop clamp was written to fix, one breakpoint down. Floor low
       enough for a phone, proportional above it. */
    grid-template-columns: 1fr clamp(92px, 20%, 200px) 62px;
  }
  .np2, .np2__left, .np2__right, .np2 .rng { min-width: 0; }
}

/* ─── .step / .flow-kv / .flow-quote — the flow's INSIDES (#94, v8.61) ──────
   Sketch §4 variant C, the stepped accordion, lifted from
   `ui/sketch_frontend.html` rather than re-invented. The shell above has
   existed since v8.06 and been used twice (Settings, the new-position
   overlay); these are the three classes SKETCH_ALIGNMENT's GAP-4 recorded as
   entirely absent, and without them there was nothing to put a money flow in.

   WHY C AND NOT A STEPPER. A one-step flow renders as one block with no
   ceremony and a five-step flow still fits, because completed steps collapse
   to a single line and only the active one expands. A horizontal stepper is
   noise at one step and runs out of width at five.

   The correctness argument that pays for all of it: `confirm()` FREEZES the
   page, so no quote refreshes and no timer runs while it is open — which is
   what creates "the price moved while that dialog was open". A non-blocking
   modal keeps the quote live and locks its own button instead. */
.step {
  display: flex; gap: var(--space-3);
  padding: var(--space-3) 0; border-bottom: 1px solid var(--border-soft);
}
.step:last-child { border-bottom: 0; }
.step__dot {
  width: 20px; height: 20px; flex: none;
  border-radius: var(--radius-full); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-dim); background: var(--bg); margin-top: 1px;
}
.step__main { flex: 1; min-width: 0; }
.step__t {
  font-size: var(--text-md); color: var(--text-muted);
  display: flex; align-items: baseline; gap: 8px;
}
.step__meta {
  margin-left: auto; font-family: var(--font-mono);
  font-size: var(--text-xs); color: var(--text-dim);
}
.step__detail { margin-top: var(--space-2); }
/* Three states, three readings: done is success-coloured, now is the only
   filled dot on screen, waiting is dimmed rather than hidden — a step you
   cannot see is a step you did not consent to. */
.step--done .step__dot { border-color: var(--color-success); color: var(--color-success); }
.step--now  .step__dot { border-color: var(--brand-purple-400); background: var(--brand-purple-700); color: var(--text-strong); }
.step--wait .step__dot { opacity: .6; }
/* D-336 point 2: a step that was not needed: the check of a done step, lighter. */
.step--skip .step__dot { border-color: var(--color-success); color: var(--color-success); opacity: .55; }
.step__dot--ok { border-color: var(--color-success); color: var(--color-success); }
/* Two more ENDINGS (v8.63). A run does not only finish or continue: it can be
   refused before signing, and it can be signed and then not come back. Those
   are different facts and they get different dots — `bad` means nothing
   happened, `hold` means something was sent and the chain has not answered.
   Painting both as a generic failure is how "nothing was sent" gets read as
   "it might have gone through". */
.step--bad  .step__dot { border-color: var(--color-danger);  color: var(--color-danger); }
.step--hold .step__dot { border-color: var(--color-warning); color: var(--color-warning); }
.step--bad  .step__t   { color: var(--text-strong); }
.step--hold .step__t   { color: var(--text-strong); }
.step__dot--bad  { border-color: var(--color-danger);  color: var(--color-danger); }
.step__dot--hold { border-color: var(--color-warning); color: var(--color-warning); }
/* The receipt's tick sits in the flow HEAD beside a two-line title, so it
   needs the optical nudge the in-body dots do not (v8.62 — moved out of an
   inline style, because the kit's inline-style ratchet only goes down). */
.step__dot--head { margin-top: 6px; }

.flow-kv {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: var(--space-3); padding: 5px 0; font-size: var(--text-base);
  border-bottom: 1px solid var(--border-soft);
}
.flow-kv:last-child { border-bottom: 0; }
.flow-kv__k { color: var(--text-muted); }
/* tabular-nums because these rows are read as a COLUMN of amounts — the whole
   point of the panel is comparing what goes out against what comes back. */
.flow-kv__v {
  font-family: var(--font-mono); color: var(--text-primary);
  font-variant-numeric: tabular-nums; text-align: right;
  overflow-wrap: anywhere;
}
.flow-kv__v--out { color: var(--color-warning); }
.flow-kv__v--in  { color: var(--color-success); }
/* A linked value (v8.63 — in practice a transaction hash). The browser's
   default anchor is a saturated blue with a full underline, which in a card
   whose only accent is purple reads as a foreign element. Accent colour and a
   soft rule instead, so it is legibly a link without competing with the
   primary button two rows below. */
.flow-kv__v a {
  color: var(--brand-purple-300); text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--brand-purple-300) 35%,
                                     transparent);
}
.flow-kv__v a:hover { border-bottom-color: var(--brand-purple-300); }

/* ═══ #151 · THE RANGE PANEL — price history and depth on ONE price axis ════
   Three columns, one shared vertical axis: time series left, the rotated
   liquidity strip right, the price scale between them at the far right where
   both can be read against it. The band and the spot line are drawn TWICE,
   once per panel, at the same fractions — that is the whole point, and it is
   why the two panels must keep identical heights and identical mappings. */
.rng {
  display: grid;
  /* The depth column GROWS with the panel. A fixed 132px looked right in a
     840px probe and became a 7%-wide sliver at the owner's ~1900px viewport,
     where the shape is the thing being set. clamp keeps the sketch's ~1:5
     proportion in the middle and still leaves a usable target when the panel
     is narrow. */
  grid-template-columns: 1fr clamp(132px, 16%, 280px) 78px;
  gap: 0; height: 260px;
  border: 1px solid var(--border-soft); border-radius: var(--radius-md);
  overflow: hidden; background: var(--bg);
}
/* `grab`, because it does now — the pane shares its price window with the
   depth strip beside it and drags the same way. It said nothing before,
   while its neighbour promised a drag it could not deliver: the two halves
   of the same lie (owner, 2026-08-21). */
.rng__hist { position: relative; min-width: 0; overflow: hidden;
  cursor: grab; user-select: none; }
.rng__hist:active { cursor: grabbing; }
.rng__depth {
  position: relative; min-width: 0; overflow: hidden;
  border-left: 1px solid var(--border-soft);
  cursor: ns-resize;              /* the grips run horizontally here */
}
.rng__axis {
  position: relative; border-left: 1px solid var(--border-soft);
  background: var(--surface);
  /* THE WHEEL ALREADY ZOOMS HERE. `stripWheel` is bound on the `.rng` grid
     wrapper, which spans history, depth AND this axis — so scrolling over
     the price scale has always scaled it, and the default arrow cursor was
     the only thing saying otherwise (owner, 2026-08-20). Its neighbour
     `.rng__depth` has carried `ns-resize` all along; this is the same
     affordance on the column the gesture is aimed at. `user-select` because
     a vertical drag over numbers otherwise selects them. */
  cursor: ns-resize; user-select: none;
}
/* The shape dots sit ABOVE the rotated depth chart and are the only thing in
   that layer allowed to take a pointer — same contract as the horizontal
   canvas, where the overlay is transparent and each dot opts back in. */
.rng__dots { position: absolute; inset: 0; pointer-events: none; }
.rng__tick {
  position: absolute; right: 7px; transform: translateY(-50%);
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-dim); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.rng__tick--bound { color: var(--brand-purple-200); }
.rng__tick--spot  { color: var(--color-danger); }
.rng__tick--view  { opacity: .55; }
/* WAITING IS A SENTENCE, NOT AN EMPTY PANEL. Blank space beside a live depth
   chart reads as "the price never moved" — a claim, and a false one. */
.rng__wait {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; gap: 8px; padding: 0 var(--space-5);
  text-align: center; font-size: var(--text-sm); color: var(--text-dim);
  line-height: 1.5;
}
.rng__wait--err { color: var(--color-warning); }
.rng__hx {
  position: absolute; left: 8px; right: 8px; bottom: 4px;
  display: flex; justify-content: space-between; pointer-events: none;
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-dim); opacity: .8;
}
.rng-head {
  display: flex; align-items: center; gap: var(--space-3);
  flex-wrap: wrap; margin-bottom: var(--space-2);
}
.rng-head__spacer { margin-left: auto; }
.rng-head__tir {
  font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-muted);
}
.rng-head__tir b { color: var(--color-success); }
.rng-legend {
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
  margin-top: var(--space-2); font-size: var(--text-xs);
  color: var(--text-dim);
}
.rng-legend__src {
  margin-left: auto; font-family: var(--font-mono); opacity: .7;
}
.rng-key {
  display: inline-block; width: 9px; height: 9px; margin-right: 5px;
  vertical-align: 0; border-radius: 2px;
}
.rng-key--px   { height: 3px; background: var(--text-muted); vertical-align: 3px; }
.rng-key--liq  { background: var(--brand-purple-300); opacity: .55; }
.rng-key--band {
  background: var(--surface-alt);
  border-top: 1px solid var(--brand-purple-200);
  border-bottom: 1px solid var(--brand-purple-200);
  border-radius: 0;
}
.rng-cap {
  font-size: var(--text-xs); color: var(--text-dim);
  margin-top: var(--space-2); line-height: 1.5;
}
/* Under ~900px the two panels stop being readable side by side; the price
   panel goes first because the depth chart carries the controls. */
@media (max-width: 900px) {
  .rng { grid-template-columns: 1fr 96px 64px; height: 220px; }
}

.flow-quote {
  display: flex; align-items: center; gap: 8px;
  font-size: var(--text-xs); color: var(--text-dim); margin-top: var(--space-2);
}
.flow-quote__ring {
  width: 11px; height: 11px; flex: none; border-radius: var(--radius-full);
  border: 1.5px solid var(--brand-purple-400); border-top-color: transparent;
  animation: fee-spin 1.1s linear infinite;
}
/* A spinner is decoration; the number beside it is the information. */
@media (prefers-reduced-motion: reduce) {
  .flow-quote__ring { animation: none; border-top-color: var(--brand-purple-400); }
}

/* ─── Header cluster ────────────────────────────────────────────────────────
   PLACES LEFT, ACTIONS AND IDENTITY RIGHT. Nav items are nouns — destinations
   that persist. The right cluster is verbs plus who you are. The owner checked
   Uniswap, Aerodrome and Jupiter: all three do this, and Jakob's Law says a
   three-item nav is not where to spend novelty. */
/* ── The three destinations ── moved out of index.html's own <style> at v8.08.
   THEY WERE TOO SMALL AND ALL THE SAME (owner, on a 1440p monitor: "they
   completely blend in"). 13px text in 5px of padding is a toolbar control,
   and these are the app's primary wayfinding: everything else in the header
   is an action or an identity. --text-lg and real padding give the row a
   height the eye can find, and the filled active state (which already
   existed) now has something to be filled AGAINST. */
.space-nav { display: flex; gap: 6px; margin-left: var(--space-5); }
.space-btn {
  font-size: var(--text-lg); padding: 8px 18px;
  border-radius: var(--radius-md); color: var(--text-secondary);
  background: none; border: 1px solid transparent; cursor: pointer;
  font-family: var(--font-body); font-weight: var(--font-weight-medium);
  transition: color 120ms ease, background 120ms ease;
}
.space-btn:hover { color: var(--text-strong); background: var(--surface-alt); }
.space-btn--active, .space-btn--active:hover {
  color: var(--text-on-brand); background: var(--brand-gradient);
}
/* The right cluster matches the nav's height so the header reads as ONE bar
   rather than three sizes stacked on a line. The gear keeps its icon padding:
   it is a 1:1 glyph, not a labelled control. */
/* DESCENDANT, not direct-child: the auth control lives one level down inside
   #authSlot, so a `>` selector left "Sign in" at 28px beside a 36px row —
   which is the "they are all roughly the same size and all small" complaint,
   half-fixed, which is worse than not fixed. */
.hdr-right .btn-sm:not(.btn-sm--icon),
.hdr-right .badge { font-size: var(--text-lg); padding: 8px 16px; }
.hdr-right .btn-sm--icon { padding: 8px 11px; font-size: var(--text-lg); }

.hdr-left { display: flex; align-items: center; gap: 10px; }
.hdr-brand {
  font-family: var(--font-display); font-size: var(--text-xl);
  color: var(--text-strong); font-weight: var(--font-weight-semibold);
}
.hdr-ver { font-size: var(--text-xs); color: var(--text-dim); }
.hdr-status {
  font-size: var(--text-sm); color: var(--text-muted);
  font-family: var(--font-mono); max-width: 400px; text-align: right;
}
.hdr-auth { display: inline-flex; align-items: center; gap: 6px; }
.hdr-right { display: flex; align-items: center; gap: var(--space-2); }
/* OZ9: the count of the tray on the Portfolio tab. A cut comment above it
   swallowed this rule from v9.58 on, so the count rendered as plain text. */
.nav-badge {
  margin-left: 6px; font-family: var(--font-mono); font-size: var(--text-xs);
  color: var(--text-on-brand); background: var(--brand-purple-700);
  border-radius: var(--radius-full); padding: 0 6px; vertical-align: 1px;
}

/* ═══ + New position chooser menu (D-115, sketch K3) ════════════════════════
   The dropdown the owner picked over the modal: two EQUAL rows — same height,
   same icon size, same type — anchored to the button, no backdrop. Equal
   billing is the point (a footnote link was rejected), so nothing here may
   style one row above the other. */
.newpos-menu {
  position: fixed; z-index: 1100; width: 300px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.55);
}
.newpos-menu__row {
  display: flex; gap: 12px; align-items: center; width: 100%;
  text-align: left; background: none; border: none; cursor: pointer;
  padding: 12px 14px; font: inherit; color: inherit;
}
.newpos-menu__row:hover, .newpos-menu__row.is-active {
  background: var(--surface-alt);
}
.newpos-menu__row svg { color: var(--brand-purple-200); flex: 0 0 auto; }
.newpos-menu__title {
  display: block; color: var(--text-strong); font-size: var(--text-base);
  font-family: var(--font-display);
}
.newpos-menu__sub {
  display: block; color: var(--text-muted); font-size: var(--text-xs);
}
/* --border, not --border-soft: soft against the surface is a six-unit
   per-channel difference — a line every regex sees and no person does
   (the G6 hairline lesson, applied before it bites here too). */
.newpos-menu__div { border-top: 1px solid var(--border); }
.btn-caret { opacity: .7; margin-left: 4px; }

/* ═══ Lending screen (D-115 · sketch p10 variant A) ═════════════════════════
   Everything else on the screen is the existing kit: .tile-row, .tbl,
   .tbl--tight, .pillbar, .btn-sm, .amt via kitAmount, .flow. These two are
   the only genuinely new needs: a two-column action panel and a table row
   dimmed because its market is frozen. */
.lend-grid2 {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: var(--space-4); align-items: start;
}
@media (max-width: 760px) { .lend-grid2 { grid-template-columns: 1fr; } }
.lend-row--frozen td { opacity: .55; }
/* SF2/SF3 (v11.201): a market row's actions sit in two fixed slots, and its name stays on one line. */
.lend-acts { display: inline-grid; grid-template-columns: repeat(2, minmax(64px, auto)); column-gap: var(--space-2); align-items: center; justify-items: start; }
.tbl td.lend-asset { white-space: nowrap; }
/* SF21: the wrapper of a disabled row action carries its tip, because
   the disabled button gets no pointer events. */
.lend-off { display: inline-block; cursor: not-allowed; }
/* SF22: the withdraw risk of a supply, above the Review button. SF29: what
   stopped the review, in the same place and at the same size. */
.lend-risk, .lend-err { margin: var(--space-3) 0; }
.lend-err { font-size: var(--text-md); color: var(--text-primary); }
.lend-risk .banner__title,
.lend-risk .banner__body { font-size: var(--text-md); }
.lend-risk .banner__body { color: var(--text-secondary); line-height: 1.5; }
.lend-risk__ack { display: flex; gap: var(--space-2); align-items: flex-start;
  justify-content: flex-start; text-align: left;
  margin-top: var(--space-3); color: var(--text-primary); cursor: pointer; }
.lend-risk__ack input { flex: none; width: auto; margin: 3px 0 0;
  accent-color: var(--color-warning); }
/* SF3: the lending modal is wider than .flow--xl, so the markets table fits with one-line names. */
.flow--lend { width: 960px; }
@media (max-width: 1000px) { .flow--lend { width: 100%; } }

/* Text-tone utilities (v8.52, the lending screen). The alternative was four
   more inline style= colours in new markup, against a budget that only
   ratchets down. Semantic colour only — the accent stays the brand's. */
.txt-dim  { color: var(--text-dim); }
.txt-good { color: var(--color-success); }
.txt-warn { color: var(--color-warning); }
.txt-bad  { color: var(--neg, #f87171); }
/* A tile whose value is a phrase, not one number (the per-protocol ACCOUNT
   RISK tile): 2xl would wrap; md is the sketch's own size for it. */
.tile__value--md { font-size: var(--text-md); }

/* ─── The coverage bar (#170) ───
 * One thin track, absolutely-positioned segments, a legend of day totals.
 * Kit tokens only; the segment colors are semantic (cache = brand, fetch =
 * warning, subgraph = info) and set inline by the renderer so the CSS holds
 * geometry, not meaning. */
.covbar { margin: 2px 0 var(--space-2); }
.covbar__track {
  position: relative; height: 6px; border-radius: var(--radius-full);
  background: var(--surface-alt); border: 1px solid var(--border);
  overflow: hidden;
}
.covbar__seg { position: absolute; top: 0; bottom: 0; }
.covbar__legend {
  display: flex; gap: var(--space-3); margin-top: 3px;
  font-size: var(--text-xs); color: var(--text-muted);
  font-family: var(--font-mono, monospace);
}
.covbar__key { display: inline-flex; align-items: center; gap: 5px; }
.covbar__dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* --- #147: sortable lending headers --- */
.tbl-sort { cursor: pointer; user-select: none; white-space: nowrap; }
.tbl-sort:hover { color: var(--text-primary); }
.tbl-sort--on { color: var(--brand-purple-200); }

/* ─── #179 (F22): keyboard focus is VISIBLE ─────────────────────────────────
   Measured during the C3 pass: of 25 visible interactive controls sampled on
   the Backtest space, ZERO showed any focus indicator — every one resolved to
   `outline: none` with no box-shadow, because `.btn-sm`, `.btn`, `.pill`,
   `.segbar__btn` and the rest each reset the UA outline and nothing put one
   back. A keyboard user could not tell where they were.

   ONE rule, on :focus-visible rather than :focus, so a mouse click never
   paints a ring the pointer user did not ask for — that is the whole reason
   :focus-visible exists, and it is why the old blanket `outline:none` was
   tempting in the first place.

   It uses a box-shadow ring rather than `outline` so it follows border-radius
   on every control without each one restating its own radius, and it is drawn
   in the brand accent against a dark ground so it reads at a glance. The
   second, inset ring keeps it legible on surfaces that share the accent's
   value (the filled primary buttons).

   `:focus-visible` is not enough on its own for elements that opt out further
   down the cascade, so the selector is deliberately broad and late in the
   file: last rule wins at equal specificity. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible,
.btn:focus-visible, .btn-sm:focus-visible, .pill:focus-visible,
.segbar__btn:focus-visible, .space-btn:focus-visible,
.chainpick:focus-visible, .tbl-sort:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--bg, #0b0b0f), 0 0 0 4px var(--brand-purple-300);
  border-radius: inherit;
}
/* SF31 (v11.206): A FIELD SHOWS ONE FOCUS MARK. Inside a kit field row the
   row's own rounded border turns purple (.field__row:focus-within), so the
   ring above drew a second, narrower box around the input, with its ends
   inside the row's ends (the owner's OT73: "another one painted right on
   top of it"). The rounded row border is the one mark. */
.field__row > input:focus-visible,
.field__row > select:focus-visible,
.field__row > textarea:focus-visible { box-shadow: none; }
/* Rows and cells that are themselves the control: a ring around a full-width
   row reads as a selection, which is what it is. */
.tdd__row:focus-visible, .newpos-menu__row:focus-visible,
.pos-card__row--act:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--brand-purple-300);
}
@media (prefers-reduced-motion: reduce) {
  :where(a, button, input, select, textarea):focus-visible { transition: none; }
}

/* v9.81: the automation chip row on a position card (sketch §auto-surfaces 1).
   The header's badge row right-aligns; this one sits above the action row and
   reads left-to-right like the tiles. Chips are status, and they click through. */
.pos-card__badges--auto { justify-content: flex-start; margin: var(--space-2) 0 0; }
.pos-card__badges--auto .badge { cursor: pointer; }

/* v9.85: the emergency button (sketch §auto-gaps G3-a). One family for every
   "stop it now" control - the automation Stop everything today, the
   convert-everything switch later - so the eye learns one shape. Solid danger,
   full weight; the ghost form is the same control at card size. */
.btn-stop { background: var(--color-danger); border: 1px solid var(--color-danger); color: var(--text-on-brand);
  border-radius: var(--radius-md); padding: 8px 18px; font-size: var(--text-md); font-weight: 600;
  cursor: pointer; font-family: inherit; }
.btn-stop:hover:not(:disabled) { filter: brightness(1.08); }
.btn-stop:disabled { opacity: .55; cursor: default; }
.btn-stop--ghost { background: none; color: var(--color-danger); padding: 4px 10px; font-size: var(--text-xs); font-weight: 500; }
.badge--stopped { background: var(--surface); color: var(--text-muted); border-color: var(--border); text-decoration: line-through; }
.badge--stopped-label { background: var(--surface); color: var(--color-danger); border-color: var(--border); }
/* R86 (v11.118): a runner that stopped REPORTING is a warning, not a
   cancellation — the rules stand. No strike; the label chip carries the
   fact once per card, the armed chips only lose their colour. */
.badge--silent { background: var(--surface); color: var(--text-muted); border-color: var(--border); }
.badge--silent-label { background: var(--surface); color: var(--color-warning); border-color: var(--border); }

/* D-222: the two lend lines under the Overview note — the ceiling's and
   the strategy's. One class, tint by modifier, so neither carries an
   inline style (the 0d ratchet). */
.lend-note { font-size: var(--text-xs); color: var(--text-dim); margin-bottom: var(--space-3); }
.lend-note--warn { color: var(--color-warning); }
