  body { background: var(--grad-page); background-attachment: fixed; min-height: 100vh; margin: 0; color: var(--text-hi); display: flex; flex-direction: column; }
  .shell { max-width: 1400px; margin: 0 auto; padding: 16px; width: 100%; box-sizing: border-box; }

  /* Period selector - cloned from analytics for visual consistency. */
  /* Canonical filter bar - same card as scanner/chart .ark-controls +
     analytics .cex-nav-bar (bg-card + 1px border + 8px radius + 6px 10px pad). */
  .period-bar {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    padding: 6px 10px; display: flex; gap: 10px; margin-bottom: 10px; align-items: center; flex-wrap: wrap;
  }
  .period-bar .label { font-size: 9px; font-weight: 700; color: var(--text-md); letter-spacing: 0.6px; padding: 0 12px; }
  /* Window buttons now use the shared .ark-seg.seg-chips chip control (same as
     scanner/chart/analytics/intelligence) - the look comes from style.css. */
  .period-bar .info { margin-left: auto; color: var(--text-md); font-size: 10px; font-family: var(--mono); display: flex; gap: 10px; align-items: center; }
  .period-bar .info .k { color: var(--text-lo); text-transform: uppercase; letter-spacing: .5px; margin-right: 4px; }

  .card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 14px; overflow: hidden; }
  .card-title { font-size: 11px; font-weight: 700; color: var(--text-hi); margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; letter-spacing: 0.3px; }
  .card-title .hint { color: var(--text-md); font-size: 10px; font-weight: 400; font-family: var(--mono); }

  /* ── SWNF / net-flow readout ────────────────────────────────── */
  .swnf-wrap { display: flex; gap: 14px; align-items: stretch; flex-wrap: wrap; margin-bottom: 12px; }
  .swnf-box { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 14px 16px; min-width: 210px; flex: 0 0 auto; }
  .swnf-box .k { font-size: 9px; font-weight: 700; color: var(--text-lo); text-transform: uppercase; letter-spacing: .7px; }
  .swnf-box .v { font-family: var(--mono); font-size: 26px; font-weight: 700; margin-top: 4px; line-height: 1; }
  .swnf-box .sub { font-size: 10px; color: var(--text-md); margin-top: 6px; font-family: var(--mono); }
  .swnf-box .bias-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 3px 8px; border-radius: 8px; margin-top: 6px; }
  .bias-distributing { color: var(--flow-in);  background: color-mix(in srgb, var(--flow-in) 14%, transparent);  border: 1px solid color-mix(in srgb, var(--flow-in) 38%, transparent); }
  .bias-accumulating { color: var(--flow-out); background: color-mix(in srgb, var(--flow-out) 14%, transparent); border: 1px solid color-mix(in srgb, var(--flow-out) 38%, transparent); }
  .bias-neutral      { color: var(--text-md); background: rgba(143,168,200,.08); border: 1px solid var(--border); }

  .spark-box { flex: 1 1 320px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; min-width: 280px; display: flex; flex-direction: column; }
  .spark-box .k { font-size: 9px; font-weight: 700; color: var(--text-lo); text-transform: uppercase; letter-spacing: .7px; }
  #spark { width: 100%; flex: 1; min-height: 56px; }

  /* ── Time-slider ────────────────────────────────────────────── */
  .slider-row { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; }
  .slider-row .lbl { font-size: 9px; font-weight: 700; color: var(--text-lo); text-transform: uppercase; letter-spacing: .6px; white-space: nowrap; }
  .slider-row input[type=range] { flex: 1; accent-color: var(--accent); cursor: pointer; min-width: 120px; }
  .slider-row .ts { font-family: var(--mono); font-size: 11px; color: var(--text-hi); white-space: nowrap; min-width: 150px; text-align: right; }
  .live-btn { font-family: var(--mono); font-size: 10px; font-weight: 700; padding: 5px 11px; border-radius: 5px; cursor: pointer; border: 1px solid var(--border); background: var(--bg-card2); color: var(--text-md); display: inline-flex; align-items: center; gap: 5px; }
  .live-btn.on { color: var(--flow-in); border-color: color-mix(in srgb, var(--flow-in) 45%, transparent); }
  .live-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .live-btn.on .dot { animation: lpulse 1.4s ease-in-out infinite; }
  @keyframes lpulse { 0%,100%{opacity:1} 50%{opacity:.3} }

  /* ── Legend ─────────────────────────────────────────────────── */
  .legend { display: flex; gap: 16px; flex-wrap: wrap; font-family: var(--mono); font-size: 10px; color: var(--text-md); margin: 0 2px 10px; }
  .legend .item { display: inline-flex; align-items: center; gap: 6px; }
  .legend .sw { width: 12px; height: 12px; border-radius: 3px; }

  /* ── Treemap ────────────────────────────────────────────────── */
  #tree {
    position: relative; width: 100%; border-radius: 8px; overflow: hidden;
    background: var(--bg-card); border: 1px solid var(--border);
    /* Iter 19.60 - flow-direction ambient glow set per render by applyTreeGlow().
       Defaults: zero opacity (no glow) and inflow-green colour. Transitions
       gently when the dominant flow direction flips. */
    --tree-glow-color: var(--flow-in);
    --tree-glow-opacity: 0;
    isolation: isolate;
  }
  #tree::before {
    content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
    border-radius: inherit;
    background: radial-gradient(ellipse 80% 50% at 50% 100%,
      color-mix(in srgb, var(--tree-glow-color, var(--flow-in)) 100%, transparent),
      transparent 70%);
    opacity: var(--tree-glow-opacity, 0);
    transition: opacity .6s ease, background .6s ease;
  }
  /* Data-refresh sweep: a brief horizontal wash + border flash when new data
     arrives. JS adds .data-fresh; auto-clears after the keyframe finishes. */
  #tree::after {
    content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
    border-radius: inherit;
    background: linear-gradient(110deg,
      transparent 0%,
      transparent 35%,
      rgba(255,255,255,0.08) 50%,
      transparent 65%,
      transparent 100%);
    background-size: 250% 100%;
    background-position: -100% 0;
    opacity: 0;
  }
  #tree.data-fresh::after { animation: tree-refresh-sweep 780ms cubic-bezier(0.16, 1, 0.3, 1) 1; }
  #tree.data-fresh { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-2) 32%, transparent); transition: box-shadow .8s ease; }
  @keyframes tree-refresh-sweep {
    0%   { opacity: 0; background-position: -100% 0; }
    35%  { opacity: 1; }
    100% { opacity: 0; background-position: 200% 0; }
  }
  /* All leaves morph between layouts (FLIP). The CSS transitions on
     left/top/width/height/background-color carry surviving cells from old
     position/size/colour to new ones - this IS the "beautiful update
     animation" when new data lands. transform stays on a separate property
     for the hover scale. Single combined declaration so the cascade doesn't
     drop one when the iter-19.51 rule re-declares transition. */
  .tm-leaf {
    position: absolute; box-sizing: border-box; cursor: pointer;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    text-align: center; overflow: hidden;
    outline: 0 solid transparent;
    border-radius: 2px;
    /* Subtle "lit from above" overlay - layered on top of the JS-set
       background-color so depth survives any flow colour. */
    background-image: linear-gradient(180deg,
      rgba(255,255,255,0.10),
      rgba(255,255,255,0.02) 38%,
      transparent 60%,
      rgba(0,0,0,0.12));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 -1px 0 rgba(0,0,0,0.15);
    will-change: transform, left, top, width, height;
    transition:
      left   var(--tm-morph, 360ms) cubic-bezier(0.22, 1, 0.36, 1),
      top    var(--tm-morph, 360ms) cubic-bezier(0.22, 1, 0.36, 1),
      width  var(--tm-morph, 360ms) cubic-bezier(0.22, 1, 0.36, 1),
      height var(--tm-morph, 360ms) cubic-bezier(0.22, 1, 0.36, 1),
      background-color var(--tm-morph, 360ms) ease,
      transform .15s cubic-bezier(0.16, 1, 0.3, 1),
      outline-color .1s;
  }
  /* Cells that are leaving (no longer in the new layout) — fade + scale out
     before they're removed from the DOM. */
  .tm-leaf.is-leaving {
    animation: tm-leaf-leave 300ms cubic-bezier(0.4, 0, 1, 1) forwards;
    pointer-events: none;
  }
  @keyframes tm-leaf-leave {
    to { opacity: 0; transform: scale(0.88); }
  }
  .tm-leaf:hover { outline: 2px solid rgba(255,255,255,.65); outline-offset: -2px; z-index: 3; }
  .tm-leaf.sel { outline: 2px solid var(--accent-2); outline-offset: -2px; z-index: 3; }
  .tm-leaf .sym    { font-family: var(--mono); font-size: 11px; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
  .tm-leaf .sym-xs { font-size: 8px; }   /* fallback for tight cells */
  .tm-leaf .np     { font-family: var(--mono); font-size: 9px;  color: rgba(255,255,255,.82); text-shadow: 0 1px 2px rgba(0,0,0,.6); }
  .tm-leaf .nv     { font-family: var(--mono); font-size: 9px;  color: rgba(255,255,255,.70); text-shadow: 0 1px 2px rgba(0,0,0,.6); }

  /* hover tooltip */
  #tip { position: fixed; z-index: 50; pointer-events: none; display: none; background: #0c0f17; border: 1px solid var(--border2); border-radius: 6px; padding: 8px 10px; font-family: var(--mono); font-size: 11px; color: var(--text-hi); box-shadow: 0 8px 24px rgba(0,0,0,.5); max-width: 260px; }
  #tip .t-h { font-weight: 700; margin-bottom: 4px; }
  #tip .t-r { display: flex; justify-content: space-between; gap: 14px; color: var(--text-md); }
  #tip .t-r .pos { color: var(--flow-in); } #tip .t-r .neg { color: var(--flow-out); }

  /* click detail line */
  #detail { font-family: var(--mono); font-size: 11px; color: var(--text-md); margin-top: 10px; min-height: 16px; }
  #detail b { color: var(--text-hi); }

  /* ── Sources panel (CEX + whale multi-select) ────────────── */
  .sources-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; }
  .sources-hd { padding: 9px 14px; display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; }
  .sources-hd .k { font-size: 9px; font-weight: 700; color: var(--text-lo); text-transform: uppercase; letter-spacing: .7px; }
  .sources-hd .summary { color: var(--text-md); font-size: 10px; font-family: var(--mono); }
  .sources-hd .chev { margin-left: auto; color: var(--text-md); font-size: 16px; transition: transform .15s; }
  .sources-card.open .sources-hd .chev { transform: rotate(180deg); }
  .sources-bd { padding: 0 14px 12px; border-top: 1px solid var(--border); display: none; grid-template-columns: 1fr 1fr; gap: 18px; }
  .sources-card.open .sources-bd { display: grid; }
  @media (max-width: 720px) { .sources-bd { grid-template-columns: 1fr; } }
  .src-col h4 { margin: 10px 0 6px; font-size: 10px; font-weight: 700; color: var(--text-md); text-transform: uppercase; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
  .src-col h4 .sub { font-weight: 400; color: var(--text-lo); font-size: 9px; text-transform: none; letter-spacing: 0; }
  .src-col h4 .quick { font-size: 9px; color: var(--text-md); cursor: pointer; padding: 1px 6px; border-radius: 3px; border: 1px solid var(--border); margin-left: auto; }
  .src-col h4 .quick + .quick { margin-left: 4px; }
  .src-col h4 .quick:hover { background: var(--bg-card2); color: var(--text-hi); }
  .src-list { display: flex; flex-direction: column; gap: 1px; max-height: 220px; overflow-y: auto; padding-right: 4px; }
  .src-row { display: flex; align-items: center; gap: 8px; font-size: 11px; font-family: var(--mono); cursor: pointer; padding: 4px 6px; border-radius: 4px; }
  .src-row:hover { background: var(--bg-card2); }
  .src-row input { margin: 0; cursor: pointer; flex-shrink: 0; accent-color: var(--accent); }
  .src-row .nm { color: var(--text-hi); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .src-row .vol { color: var(--text-md); font-size: 10px; flex-shrink: 0; }
  .src-empty { color: var(--text-lo); font-size: 10px; padding: 8px; text-align: center; font-family: var(--mono); }

  .loading { text-align: center; color: var(--text-md); font-family: var(--mono); font-size: 11px; padding: 60px 30px; }
  .empty { color: var(--text-lo); text-align: center; padding: 60px 20px; font-size: 11px; font-family: var(--mono); }

/* ══════════════════════════════════════════════════════════════
   Iter 19.50 - Supply Map animation pass round 1
   ══════════════════════════════════════════════════════════════ */

/* Treemap cell entry. The JS adds .is-fresh + animation-delay only on the
   FIRST render of the session; later renders skip the stagger so a period
   switch or slider scrub isn't an animation marathon. */
.tm-leaf.is-fresh {
  animation: tm-leaf-enter 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes tm-leaf-enter {
  0%   { opacity: 0; transform: scale(0.86); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: scale(1); }
}

/* Selection: replace the bland static outline with a soft accent halo + a
   one-shot pulse so the click registers visually. */
.tm-leaf.sel {
  /* keep the existing outline + z-index from the base rule */
  animation: tm-leaf-select 600ms cubic-bezier(0.16, 1, 0.3, 1) 1;
  z-index: 4;
}
@keyframes tm-leaf-select {
  0%   { box-shadow: 0 0 0 0 var(--accent-2); }
  50%  { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent-2) 30%, transparent); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Hover tooltip: fade instead of display:block snap. We can't use opacity
   transitions with display:none, so the JS-controlled display:none/block
   stays; we just add a quick fade-in via animation when the tooltip
   appears. Animation fires once per show; movement updates only reposition. */
#tip {
  /* Existing properties stay; add the entry anim. */
  animation: tip-fade-in 140ms ease-out;
}
@keyframes tip-fade-in {
  0%   { opacity: 0; transform: translateY(2px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Sparkline bars rise from the centre baseline (mid line). Each bar's
   `y` attribute already sets the right anchor — for inflow bars y is
   above mid (bar extends upward), for outflow bars y is at mid (extends
   downward). We can't use a single transform-origin for both directions
   so we animate opacity + a tiny scaleY from origin centre — the visual
   read is "bars wake up", which works in both directions.
   Stagger comes from inline animation-delay on each rect (set by JS). */
#spark rect.spark-bar {
  transform-box: fill-box;
  transform-origin: center;
  animation: spark-wake 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes spark-wake {
  0%   { transform: scaleY(0.1); opacity: 0; }
  100% { transform: scaleY(1);   opacity: 1; }
}

/* Period button + live button - small interaction polish: subtle scale on
   active press so the click feels physical. */
.period-bar button[data-p],
.live-btn,
.src-row {
  transition: background .15s, border-color .15s, transform .08s ease-out;
}
.period-bar button[data-p]:active,
.live-btn:active,
.src-row:active { transform: scale(0.97); }

/* Sources card chevron rotation is already there; add a slide for the body. */
.sources-bd {
  /* Keep the existing display:grid swap from the .open class but add a
     transition on max-height for a smooth open. Note: this works because
     `display: none` → `display: grid` instantly shows the panel; we
     transition the visual stuff inside (cards fade in). */
}
.sources-card .src-row {
  animation: tm-leaf-enter 280ms ease-out both;
}
.sources-card.open .src-col:nth-child(1) .src-row:nth-child(1) { animation-delay:  40ms; }
.sources-card.open .src-col:nth-child(1) .src-row:nth-child(2) { animation-delay:  60ms; }
.sources-card.open .src-col:nth-child(1) .src-row:nth-child(3) { animation-delay:  80ms; }
.sources-card.open .src-col:nth-child(1) .src-row:nth-child(4) { animation-delay: 100ms; }

@media (prefers-reduced-motion: reduce) {
  .tm-leaf.is-fresh,
  .tm-leaf.sel,
  #tip,
  #spark rect,
  .period-bar button[data-p],
  .live-btn,
  .src-row,
  .sources-card .src-row {
    animation: none !important;
    transition: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   Iter 19.51 - Supply Map animation pass round 2
   ══════════════════════════════════════════════════════════════ */

/* Detail line: animate the contents on selection. The element is always
   present; when its innerHTML is rewritten we trigger a one-shot anim by
   resetting + re-applying via a class. Simpler approach: animate every
   time we write to it via CSS `* { animation: ... }` on the wrapper.
   But that fires on every keystroke if anything else writes there. Use
   the [data-has-selection] attribute set by JS instead. */
#detail {
  transition: padding .2s, background .2s;
  border-radius: 6px;
}
#detail:not(:empty) {
  padding: 8px 12px;
  background: color-mix(in srgb, var(--accent-2) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent-2) 25%, var(--border));
  animation: detail-pop 320ms cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes detail-pop {
  0%   { opacity: 0; transform: translateY(-4px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Bias tag: when the class swaps between bias-neutral / bias-distributing /
   bias-accumulating, briefly flash a wider ring so users notice the change.
   The flash uses CSS animation with an attribute selector trick - we can't
   easily fire an animation on class change without JS, so apply the
   animation on any bias-tag and let it loop subtly. */
.bias-tag {
  transition: color .25s, background .25s, border-color .25s;
}
.bias-tag.bias-distributing,
.bias-tag.bias-accumulating {
  animation: bias-pulse 2.4s ease-in-out infinite;
}
@keyframes bias-pulse {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  50%      { box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 20%, transparent); }
}

/* Treemap cell hover: subtle scale-up for affordance. Transition for
   transform is declared in the consolidated .tm-leaf rule above so the
   FLIP morph (left/top/width/height) coexists with the hover scale. */
.tm-leaf:hover {
  transform: scale(1.02);
  z-index: 5;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    inset 0 -1px 0 rgba(0,0,0,0.18),
    0 6px 18px rgba(0,0,0,0.45);
}
.tm-leaf:active { transform: scale(0.99); }

/* Live button "off" state: existing styles handle .on (green); when not
   .on, treat as historical snapshot - desaturated + amber tint. */
.live-btn:not(.on) {
  color: #f5b400;
  border-color: color-mix(in srgb, #f5b400 35%, transparent);
}
.live-btn:not(.on) .dot { animation: none; opacity: 0.85; }

/* Sources card chevron: smooth pulse to draw eye when there are >0
   selections so the user can find the trigger. */
.sources-hd .chev { transition: transform .2s ease, color .15s; }
.sources-hd:hover .chev { color: var(--text-hi); }

@media (prefers-reduced-motion: reduce) {
  #detail:not(:empty)  { animation: none; }
  .bias-tag.bias-distributing,
  .bias-tag.bias-accumulating { animation: none; box-shadow: none; }
  .tm-leaf { transition: none; }
  .tm-leaf:hover, .tm-leaf:active { transform: none; }
}

/* ══════════════════════════════════════════════════════════════
   Iter 19.52 - Supply Map round 3: smooth refresh, tooltip bars, empty
   ══════════════════════════════════════════════════════════════ */

/* Refresh-mode cell entry: shorter duration than the first-render keyframe.
   .is-fresh.is-refresh overrides the duration on top of the base entry. */
.tm-leaf.is-fresh.is-refresh {
  animation: tm-leaf-enter 220ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Tooltip "top sources" - inline proportional bar per source. */
#tip .t-src-row { margin-top: 4px; }
#tip .t-src-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 10px;
}
#tip .t-src-name {
  color: var(--text-md);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
#tip .t-src-bar {
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  margin-top: 2px;
  overflow: hidden;
}
#tip .t-src-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width .2s ease-out;
}

/* Empty state - centred icon + headline + hint, quiet pulse on icon. */
.supply-empty {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-md);
  padding: 80px 24px !important;
}
.supply-empty-icon {
  font-size: 42px !important;
  color: var(--text-lo);
  animation: supply-empty-pulse 2.6s ease-in-out infinite;
}
.supply-empty-title {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-hi);
}
.supply-empty-hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-lo);
}
@keyframes supply-empty-pulse {
  0%, 100% { opacity: 0.45; transform: scale(1); }
  50%      { opacity: 0.85; transform: scale(1.06); }
}

/* Tighter spark min-height so it doesn't crush against the SWNF box on
   medium widths. */
#spark { min-height: 64px; }

@media (prefers-reduced-motion: reduce) {
  .tm-leaf.is-fresh.is-refresh,
  .supply-empty-icon,
  #tip .t-src-bar i {
    animation: none !important;
    transition: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   Iter 19.53 - Supply Map round 4: icon header, bias arrow, slider theme
   ══════════════════════════════════════════════════════════════ */

/* Tooltip header now contains [icon] + [symbol]. The img comes from
   AssetIcons.icon() with margin-right:4px inline; we just need the
   container to align them. */
#tip .t-h {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  margin-bottom: 4px;
  font-size: 12px;
}
#tip .t-h img {
  width: 16px !important;
  height: 16px !important;
  margin-right: 0 !important;
}

/* Bias-tag icon: small Material glyph beside the bias word. Auto-rotates
   for distributing/accumulating to read as "flow direction". */
.bias-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bias-tag-icon {
  font-size: 12px !important;
  line-height: 1;
}

/* ── Themed slider ───────────────────────────────────────────
   Replaces the OS-default range slider styling with one that matches
   the rest of the page chrome. Vendor-prefixed pseudos for WebKit +
   Firefox + the standardised ::slider-thumb. */
.slider-row input[type=range] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: linear-gradient(
    90deg,
    var(--accent) 0%,
    var(--accent) var(--slider-pct, 100%),
    var(--bg-card2) var(--slider-pct, 100%),
    var(--bg-card2) 100%
  );
  border-radius: 3px;
  outline: none;
}
.slider-row input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-hi);
  border: 2px solid var(--accent);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.slider-row input[type=range]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text-hi);
  border: 2px solid var(--accent);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.slider-row input[type=range]:hover::-webkit-slider-thumb,
.slider-row input[type=range]:focus::-webkit-slider-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent);
}
.slider-row input[type=range]:hover::-moz-range-thumb,
.slider-row input[type=range]:focus::-moz-range-thumb {
  transform: scale(1.15);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 25%, transparent);
}
.slider-row input[type=range]:disabled::-webkit-slider-thumb { opacity: .4; cursor: not-allowed; }
.slider-row input[type=range]:disabled::-moz-range-thumb     { opacity: .4; cursor: not-allowed; }

@media (prefers-reduced-motion: reduce) {
  .slider-row input[type=range]::-webkit-slider-thumb,
  .slider-row input[type=range]::-moz-range-thumb { transition: none; }
}

/* ══════════════════════════════════════════════════════════════
   Iter 19.54 - Round 5: period glow, chevron bounce, detail chips
   ══════════════════════════════════════════════════════════════ */

/* Period button active state: stronger affordance with a soft glow
   halo around the active button so it reads as "current window" at
   a glance. Existing rule sets bg + border + colour; we add the glow
   on top via box-shadow. */
.period-bar button[data-p].active {
  box-shadow: 0 0 0 1px rgba(26,127,255,0.35), 0 0 12px rgba(26,127,255,0.25);
  transition: box-shadow .25s ease, background .15s;
}
.period-bar button[data-p]:not(.active):hover {
  color: var(--text-hi);
}

/* Sources card chevron: small spring-bounce on open/close instead of a
   straight linear rotate. Uses cubic-bezier with a small overshoot. */
.sources-hd .chev {
  transition: transform .26s cubic-bezier(0.34, 1.56, 0.64, 1), color .15s;
}
.sources-card.open .sources-hd .chev { color: var(--text-hi); }

/* Detail strip: convert the plain inline text into a row of small
   semantic groups + clickable source chips. */
#detail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.detail-asset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
}
.detail-asset img { margin-right: 0 !important; vertical-align: middle; }
.detail-sep { color: var(--text-lo); opacity: .8; }
.detail-pos { color: var(--flow-in); }
.detail-neg { color: var(--flow-out); }

.detail-src-block {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 4px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
.detail-src-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-hi);
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 10px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.detail-src-chip:hover {
  background: color-mix(in srgb, var(--accent-2) 12%, var(--bg-card2));
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border));
}
.detail-src-chip:active { transform: scale(0.97); }
.detail-src-chip .detail-src-name { color: var(--text-md); }
.detail-src-chip .detail-src-net.pos { color: var(--flow-in); }
.detail-src-chip .detail-src-net.neg { color: var(--flow-out); }

@media (prefers-reduced-motion: reduce) {
  .period-bar button[data-p].active,
  .sources-hd .chev,
  .detail-src-chip {
    transition: none !important;
  }
}

/* ══════════════════════════════════════════════════════════════
   Iter 19.55 - Round 6: live-feel polish on the period bar
   ══════════════════════════════════════════════════════════════ */

/* "Updated" group keeps the spinner inline with the value. */
.period-bar .info-updated {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.info-spin {
  font-size: 12px !important;
  color: var(--accent-2, var(--text-md));
  animation: info-spin 0.9s linear infinite;
  display: inline-block;
}
.info-spin[hidden] { display: none !important; }
@keyframes info-spin {
  to { transform: rotate(360deg); }
}

/* LIVE button data-arrival pulse: one-shot scale+glow when fresh data
   lands while in live mode. Runs forwards then settles into the
   existing on-state pulse animation. */
.live-btn.just-loaded {
  animation: live-arrival 600ms ease-out 1;
}
@keyframes live-arrival {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--flow-in) 80%, transparent); transform: scale(1); }
  35%  { box-shadow: 0 0 0 8px color-mix(in srgb, var(--flow-in) 0%, transparent); transform: scale(1.08); }
  100% { box-shadow: 0 0 0 0 transparent; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .info-spin                { animation: none; }
  .live-btn.just-loaded     { animation: none; }
}

/* ══════════════════════════════════════════════════════════════
   Iter 19.56 - Round 7: sparkline hover + sources search
   ══════════════════════════════════════════════════════════════ */

/* Sparkline bars: brighten on hover so the hovered bar reads as "selected"
   in the row. JS positions the themed tooltip. */
#spark .spark-bar {
  transition: opacity .12s, filter .12s;
  cursor: pointer;
}
#spark:hover .spark-bar { opacity: 0.55; }
#spark .spark-bar:hover {
  opacity: 1;
  filter: drop-shadow(0 0 4px currentColor);
}

/* Sources search input. Quiet styling, full-width inside its column. */
.src-search {
  width: 100%;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-hi);
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 8px;
  margin-bottom: 6px;
  box-sizing: border-box;
  transition: border-color .15s, background .15s;
}
.src-search::placeholder { color: var(--text-lo); }
.src-search:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
}
.src-search::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
  width: 14px; height: 14px;
  background: var(--text-lo);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 6.4L17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z'/%3E%3C/svg%3E") center/contain no-repeat;
  mask:         url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='black' d='M19 6.4L17.6 5 12 10.6 6.4 5 5 6.4 10.6 12 5 17.6 6.4 19 12 13.4 17.6 19 19 17.6 13.4 12z'/%3E%3C/svg%3E") center/contain no-repeat;
  cursor: pointer;
}
.src-search::-webkit-search-cancel-button:hover { background: var(--text-hi); }

@media (prefers-reduced-motion: reduce) {
  #spark .spark-bar { transition: none; }
}

/* ══════════════════════════════════════════════════════════════
   Iter 19.57 - Round 8: sparkline playhead + filter-aware empty CTA
   ══════════════════════════════════════════════════════════════ */

/* Playhead transition: smooth movement when slider input bumps it across
   the sparkline. Skip under reduced-motion. */
#spark-playhead line,
#spark-playhead circle {
  transition: x1 .15s ease-out, x2 .15s ease-out, cx .15s ease-out;
}

/* "Show all sources" reset button inside the empty state. */
.supply-empty-reset {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  color: var(--text-hi);
  padding: 7px 14px;
  border-radius: 5px;
  font-family: var(--mono);
  font-size: 11px;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.supply-empty-reset:hover {
  background: color-mix(in srgb, var(--accent-2) 14%, var(--bg-card2));
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border));
}
.supply-empty-reset:active { transform: scale(0.97); }
.supply-empty-reset .material-symbols-outlined { color: var(--accent-2); }

@media (prefers-reduced-motion: reduce) {
  #spark-playhead line,
  #spark-playhead circle { transition: none; }
}

/* ══════════════════════════════════════════════════════════════
   Iter 19.58 - Round 9: shareable URL state + share button
   ══════════════════════════════════════════════════════════════ */
.share-btn {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 5px 11px;
  border-radius: 5px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--bg-card2);
  color: var(--text-md);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.share-btn:hover {
  background: color-mix(in srgb, var(--accent-2) 12%, var(--bg-card2));
  border-color: color-mix(in srgb, var(--accent-2) 45%, var(--border));
  color: var(--text-hi);
}
.share-btn:active { transform: scale(0.97); }
.share-btn .material-symbols-outlined {
  font-size: 13px !important;
  color: var(--accent-2);
}

/* Flash state - briefly green to confirm the URL is on the clipboard. */
.share-btn.just-copied {
  background: color-mix(in srgb, var(--flow-in) 22%, var(--bg-card2));
  border-color: color-mix(in srgb, var(--flow-in) 55%, var(--border));
  color: var(--flow-in);
  animation: share-copied-pulse 600ms ease-out;
}
.share-btn.just-copied .material-symbols-outlined { color: var(--flow-in); }
@keyframes share-copied-pulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--flow-in) 70%, transparent); }
  100% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--flow-in) 0%,  transparent); }
}

@media (prefers-reduced-motion: reduce) {
  .share-btn.just-copied { animation: none; }
}

/* ══════════════════════════════════════════════════════════════
   Iter 19.59 - Round 10: mobile responsive pass
   ══════════════════════════════════════════════════════════════ */

/* ≤860px - phones and small tablets. The page chrome (period bar + slider
   row + sources card + SWNF/spark + treemap) is collapsed to be readable
   in a single thumb-scrollable column. */
@media (max-width: 860px) {
  .shell { padding: 6px; }   /* system-wide minimum mobile gutter */

  /* Period bar: hide the "WINDOW" prefix label, tighten gaps, make
     the info group wrap onto a new line. */
  .period-bar { padding: 5px; gap: 3px; }
  .period-bar .label { display: none; }
  .period-bar button[data-p] { padding: 5px 9px; font-size: 11px; }
  .period-bar .info {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 4px 0;
  }

  /* Slider row: collapses to two-row layout - slider + timestamp on top,
     live + share buttons under. Text labels on share/live shrink to icons. */
  .slider-row {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 10px;
  }
  .slider-row .lbl { display: none; }
  .slider-row .ts {
    min-width: 0;
    flex: 1;
    font-size: 10px;
    text-align: right;
  }
  .share-btn .share-label { display: none; }
  .share-btn { padding: 5px 8px; }

  /* SWNF + spark: stack vertically. */
  .swnf-wrap { gap: 8px; }
  .swnf-box { min-width: 0; flex: 1 1 100%; padding: 10px 12px; }
  .swnf-box .v { font-size: 22px; }
  .spark-box { min-width: 0; flex: 1 1 100%; padding: 8px 12px; }
  #spark { min-height: 48px; }

  /* Legend: smaller text, allow wrap. */
  .legend { font-size: 9px; gap: 10px; }

  /* Sources card: the picker columns stack (already in the 720px rule
     but reinforce here so the search inputs don't get squeezed). */
  .sources-bd { gap: 10px; padding: 0 10px 10px; }
  .src-list { max-height: 180px; }
  .src-row { padding: 5px 6px; font-size: 12px; }

  /* Treemap: thumb-friendly hover target by making cells respond on tap.
     The hover-scale transition still applies; mobile Safari fires :hover
     on first tap so this gives users a chance to see the tooltip. */
  .tm-leaf:hover .sym  { font-size: 12px; }

  /* Tooltip: cap width so it doesn't bleed off-screen. */
  #tip { max-width: calc(100vw - 24px); font-size: 10px; padding: 6px 8px; }

  /* Detail strip: smaller font + chips wrap freely. */
  #detail { font-size: 10px; padding: 6px 10px !important; }
  .detail-src-block { padding-left: 6px; margin-left: 2px; }
  .detail-src-chip  { padding: 2px 6px; font-size: 9px; }
}

/* ≤480px - extra-small phones. Treemap shrinks further; period bar
   becomes a horizontal scroll strip so all 5 windows stay reachable. */
@media (max-width: 480px) {
  .period-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;     /* Firefox: no scrollbar (clutter on a 5-button strip) */
  }
  .period-bar::-webkit-scrollbar { display: none; }
  .period-bar button[data-p] { flex-shrink: 0; }
  .period-bar .info { display: none; }    /* Stats hide on the smallest phones; SWNF box covers it. */

  /* SWNF text scales down. */
  .swnf-box .v { font-size: 20px; }
  .swnf-box .k { font-size: 8px; }

  /* Treemap height ceiling: don't dominate the entire screen. */
  #tree { max-height: 60vh; }
}

/* ══════════════════════════════════════════════════════════════
   Iter 19.60 - Smoothness pass: chrome polish + FLIP morph + baseline
   badge + top-tx detail rows. Adds the missing depth and makes the page
   feel like a single workstation rather than a stack of cards.
   ══════════════════════════════════════════════════════════════ */

/* Subtle "lit from above" overlay on every chrome card. Composites over
   the existing background-color: var(--bg-card) so it survives admin theme
   tweaks. ~2% white at top fading to transparent at 50% — just enough to
   give each card a sense of light direction without changing its identity. */
.period-bar,
.slider-row,
.sources-card,
.swnf-box,
.spark-box,
#tree {
  background-image: linear-gradient(180deg, rgba(255,255,255,0.022), transparent 55%);
}

/* Period bar: SWNF box gets a stronger inner highlight since it's the
   biggest visual anchor. */
.swnf-box {
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.035), transparent 60%),
    radial-gradient(120% 80% at 0% 0%, rgba(255,255,255,0.025), transparent 60%);
  position: relative;
}

/* Baseline-comparison badge (B2). Sits under the bias tag inside the SWNF
   box. Quiet by default, with directional colour + arrow once data lands. */
.baseline-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  padding: 3px 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card2);
  color: var(--text-md);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .35s ease, transform .35s cubic-bezier(0.22, 1, 0.36, 1);
}
.baseline-tag.just-loaded { opacity: 1; transform: translateY(0); }
.baseline-tag[hidden]     { display: none !important; }
.baseline-tag .baseline-arrow {
  font-size: 14px !important;
  line-height: 1;
}
.baseline-tag .baseline-sub {
  color: var(--text-lo);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.baseline-tag.baseline-up {
  color: var(--flow-in);
  background: color-mix(in srgb, var(--flow-in) 10%, var(--bg-card2));
  border-color: color-mix(in srgb, var(--flow-in) 35%, transparent);
}
.baseline-tag.baseline-down {
  color: var(--flow-out);
  background: color-mix(in srgb, var(--flow-out) 10%, var(--bg-card2));
  border-color: color-mix(in srgb, var(--flow-out) 35%, transparent);
}
.baseline-tag.baseline-flat {
  color: var(--text-md);
  background: var(--bg-card2);
  border-color: var(--border);
}

/* Top-transactions block inside the detail strip (B3). Sits below the
   inline summary row when an asset is clicked. Each row is a clickable
   anchor to /tx/<hash>. Layout: side chip, USD, counterparty, hash, age. */
#detail .detail-row-1 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
}
.detail-tx-block {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed color-mix(in srgb, var(--border) 70%, transparent);
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: detail-tx-fade-in .35s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes detail-tx-fade-in {
  0%   { opacity: 0; transform: translateY(-2px); }
  100% { opacity: 1; transform: translateY(0); }
}
.detail-tx-head {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text-lo);
  margin-bottom: 2px;
}
.detail-tx-head .material-symbols-outlined { font-size: 11px !important; }
.detail-tx-row {
  display: grid;
  grid-template-columns: 36px 80px 1fr 100px 56px;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-md);
  text-decoration: none;
  background: color-mix(in srgb, var(--bg-card2) 60%, transparent);
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, transform .08s ease-out;
}
.detail-tx-row:hover {
  background: var(--bg-card2);
  border-color: color-mix(in srgb, var(--accent-2) 30%, var(--border));
  color: var(--text-hi);
}
.detail-tx-row:active { transform: scale(0.99); }
.detail-tx-side {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 6px;
  border-radius: 999px;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.detail-tx-side.pos {
  color: var(--flow-in);
  background: color-mix(in srgb, var(--flow-in) 12%, var(--bg-card));
  border-color: color-mix(in srgb, var(--flow-in) 35%, transparent);
}
.detail-tx-side.neg {
  color: var(--flow-out);
  background: color-mix(in srgb, var(--flow-out) 12%, var(--bg-card));
  border-color: color-mix(in srgb, var(--flow-out) 35%, transparent);
}
.detail-tx-usd  { color: var(--text-hi); font-weight: 700; }
.detail-tx-cp   { color: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-tx-hash { color: var(--text-lo); font-size: 9px; }
.detail-tx-age  { color: var(--text-lo); font-size: 9px; text-align: right; }

/* Mobile pass: tighter morph + simpler grid for tx rows. The FLIP transition
   already feels smooth on phones; we just shorten the duration so it doesn't
   drag, and on the tx rows we fall back to two rows of inline info instead
   of the desktop 5-col grid (counterparty + hash get cramped < 480px). */
@media (max-width: 860px) {
  #tree { --tm-morph: 260ms; }   /* snappier feel on touch devices */
  #tree::after { display: none; } /* the refresh sweep across a full-width treemap is too much on phones */
  .detail-tx-block { gap: 2px; padding-top: 6px; margin-top: 6px; }
  .detail-tx-row {
    grid-template-columns: 30px 1fr auto;
    grid-template-rows: auto auto;
    grid-template-areas:
      "side usd  age"
      "side cp   hash";
    row-gap: 2px;
    padding: 5px 8px;
  }
  .detail-tx-side { grid-area: side; align-self: center; }
  .detail-tx-usd  { grid-area: usd; }
  .detail-tx-cp   { grid-area: cp;  font-size: 9px; }
  .detail-tx-hash { grid-area: hash; text-align: right; }
  .detail-tx-age  { grid-area: age; }
  .baseline-tag   { font-size: 9px; padding: 2px 7px; }
}
@media (max-width: 480px) {
  #tree { --tm-morph: 220ms; }
  .baseline-tag .baseline-sub { display: none; }   /* keep only "N× normal" */
}

/* Reduced motion: all morph + entry + sweep animations disabled. Cells
   snap to new positions; users keep functionality, lose flourishes. */
@media (prefers-reduced-motion: reduce) {
  .tm-leaf,
  .tm-leaf.is-leaving,
  #tree.data-fresh::after,
  #tree::before,
  .baseline-tag,
  .detail-tx-block,
  .detail-tx-row,
  #spark rect.spark-bar {
    transition: none !important;
    animation: none !important;
  }
  #tree.data-fresh { box-shadow: none !important; }
}

