/* ui.css — the Fusion Stats look, as the Activity page has it.
 *
 * Shared by Monitor, Switchers, Dust Tracker and Stocks. The Activity page
 * carries the same values inline; change them in both places.
 *
 * Tokens first. Older pages, their chart code and nav.js read names like
 * --surface, --stroke and --text-body; those are mapped onto the new tokens
 * below, so a rule written against them picks up this palette unchanged.
 */

:root {
  --bg: #FFFFFF;
  --bg-subtle: #F7F7F8;
  --bg-hover: #F5F5F7;
  --line: #EDEDF0;
  --line-strong: #E2E2E7;
  --text: #0B0B0F;
  --text-2: #5E5E6B;
  --text-3: #9A9AA6;
  --accent: #8429FF;
  --accent-bg: rgba(132, 41, 255, 0.08);
  --pos: #16A34A;
  --pos-bar: #22C55E;
  --pos-soft: rgba(34, 197, 94, 0.13);
  --neg: #DC2626;
  --neg-bar: #EF4444;
  --neg-soft: rgba(239, 68, 68, 0.11);
  --amber: #B45309;
  --amber-soft: rgba(217, 119, 6, 0.10);
  --tip-bg: #111116;
  --tip-fg: #FFFFFF;
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  /* The ⓘ icon, drawn rather than typed so it looks the same in every font. */
  --ui-i-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='6.4' fill='none' stroke='%23000' stroke-width='1.3'/%3E%3Cpath d='M8 7.3v3.9' stroke='%23000' stroke-width='1.4' stroke-linecap='round'/%3E%3Ccircle cx='8' cy='5' r='.9'/%3E%3C/svg%3E");
  --ui-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%239A9AA6' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");

  /* Older names. */
  --surface: var(--bg);
  --bg-alt: var(--bg-subtle);
  --stroke: var(--line);
  --stroke-light: var(--line);
  --border: var(--line);
  --text-body: var(--text-2);
  --text-secondary: var(--text-3);
  --green: var(--pos);
  --green-bg: var(--pos-soft);
  --red: var(--neg);
  --red-bg: var(--neg-soft);
  --accent-end: #6C00FF;
  --accent-light: #A37FFF;
  /* A chart's categories (the Stocks routes): shadcn's chart palette. */
  --chart-1: #F54900;
  --chart-2: #009689;
  --chart-3: #104E64;
  --chart-4: #FFB900;
  --chart-5: #FE9A00;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0A0A0C;
  --bg-subtle: #131317;
  --bg-hover: #141419;
  --line: #1E1E24;
  --line-strong: #2A2A32;
  --text: #F4F4F6;
  --text-2: #A3A3AE;
  --text-3: #70707C;
  --accent: #A37FFF;
  --accent-bg: rgba(163, 127, 255, 0.14);
  --pos: #22C55E;
  --pos-bar: #22C55E;
  --pos-soft: rgba(34, 197, 94, 0.15);
  --neg: #EF4444;
  --neg-bar: #EF4444;
  --neg-soft: rgba(239, 68, 68, 0.15);
  --amber: #F59E0B;
  --amber-soft: rgba(245, 158, 11, 0.12);
  --tip-bg: #F4F4F6;
  --tip-fg: #0A0A0C;
  --accent-end: #8429FF;
  --accent-light: #B89AFF;
  --chart-1: #1447E6;
  --chart-2: #00BC7D;
  --chart-3: #FE9A00;
  --chart-4: #AD46FF;
  --chart-5: #FF2056;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background 0.2s, color 0.2s;
}

/* Sizes to the content column, not the window: nav.js's sidebar takes 220px
   on desktop and none on a phone. */
.ui-page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 44px 48px 96px;
  container-type: inline-size;
}

/* Chart tick labels keep a halo of the page colour: inside the plot on a
   phone they sit over bars and lines, and stay legible there. */
.js-plotly-plot .xtick text, .js-plotly-plot .ytick text {
  paint-order: stroke fill;
  stroke: var(--bg);
  stroke-width: 3px;
  stroke-linejoin: round;
}
/* A chart with one series labels its levels in that series' colour
   (--chart-ink, set by ui-chart.js frame). */
.ui-chart .ytick text, .plot .ytick text { fill: var(--chart-ink, var(--text-3)) !important; }
/* No sharp corners on a line, and the ringed dots on its high and low
   lift off the plot a little. */
.js-plotly-plot .scatterlayer .js-line { stroke-linejoin: round; stroke-linecap: round; }
.js-plotly-plot .scatterlayer .points path { filter: drop-shadow(2px 3px 3px rgba(0, 0, 0, 0.35)); }

/* ---------- Masthead: title, what the page shows, data status ---------- */
.ui-masthead {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
/* Text takes the room; status and controls stay right, even when they wrap. */
.ui-masthead > :first-child { flex: 1 1 520px; min-width: 0; }
.ui-masthead > .ui-meta { margin-left: auto; }
.ui-masthead h1 {
  margin: 0;
  font-size: 32px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.035em;
  color: var(--text);
}
.ui-lede { margin: 8px 0 0; max-width: 720px; font-size: 15px; color: var(--text-2); }
.ui-lede b, .ui-lede strong { color: var(--text); font-weight: 600; }
.ui-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-3);
}
.ui-status b { color: var(--text-2); font-weight: 500; }
.ui-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13px;
  color: var(--text-2);
}
/* "Updated 2 h 11 min ago": the time is what is read (as on Activity). */
.ui-meta .ago { color: var(--text); font-weight: 500; }

/* A quiet button for a masthead's controls. */
.ui-ghost {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--text-2);
  font: 500 13px var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.ui-ghost:hover { color: var(--text); background: var(--bg-subtle); border-color: var(--line-strong); }

/* A section after the masthead: hairline above, room around. */
.ui-section { padding: 32px 0; border-top: 1px solid var(--line); }
.ui-masthead + .ui-section { border-top: none; }   /* the masthead already draws that line */
.ui-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}
.ui-section-title .ui-count { font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--text-3); }

@keyframes ui-shimmer { to { background-position: -200% 0; } }

@media (max-width: 1200px) { .ui-page { padding: 36px 32px 80px; } }
@media (max-width: 900px) { .ui-page { padding: 12px 24px 64px; } }
@media (max-width: 480px) {
  .ui-page { padding: 6px 16px 48px; }
  .ui-masthead { gap: 12px; padding-bottom: 22px; }
  .ui-masthead h1 { font-size: 26px; }
  .ui-lede { font-size: 14px; }
  .ui-status, .ui-meta { font-size: 12.5px; }
}

/* =====================================================================
 * Components, as Activity and Stocks draw them, for every other page.
 * ui- names, so the pages that still carry their own copies of these
 * (Activity, Stocks, Monitor, Switchers, Dust) are not touched by them.
 * Narrow-layout rules key off the .ui-page container's width.
 * ===================================================================== */

/* Words for the narrow layout only (.m-show) and the wide one only (.m-hide). */
:where(.m-show) { display: none; }
@container (max-width: 700px) {
  .m-show { display: inline; }
  .m-hide { display: none; }
}
/* A phone gets the title and the data, not the subtitle (.keep keeps one). */
@container (max-width: 560px) {
  .ui-masthead .ui-lede:not(.keep) { display: none; }
  .ui-masthead { padding-bottom: 16px; }
  .ui-status { margin-top: 6px; }
}

/* ---------- Figures: a row of headline numbers, a hairline between each ---------- */
.ui-figures {
  display: grid;
  grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr));
  padding: 26px 0 30px;
  border-bottom: 1px solid var(--line);
}
.ui-figures[hidden] { display: none; }
.ui-figure { min-width: 0; padding: 0 24px; border-left: 1px solid var(--line); }
.ui-figure:first-child { padding-left: 0; border-left: none; }
.ui-figure .k {
  display: flex; align-items: center; gap: 5px;
  font-size: 13px; font-weight: 500; color: var(--text-3); white-space: nowrap;
}
.ui-figure .v {
  margin-top: 6px;
  font-size: clamp(20px, 3.2cqi, 34px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ui-figure .v.pos { color: var(--pos); }
.ui-figure .v.neg { color: var(--neg); }
/* A caption says all it says: where its column is narrow it takes a second,
   balanced line rather than end in "…". */
.ui-figure .s { margin-top: 3px; font-size: 12.5px; color: var(--text-3); text-wrap: balance; }
.ui-figure .v:empty::before { content: ''; display: block; width: 70%; height: 1em; border-radius: 8px; background: linear-gradient(90deg, var(--bg-subtle) 0%, var(--line) 50%, var(--bg-subtle) 100%); background-size: 200% 100%; animation: ui-shimmer 1.4s linear infinite; }
/* Narrow: two columns, a hairline between rows as well. */
@container (max-width: 700px) {
  .ui-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 14px 0 16px; }
  .ui-figure { padding: 10px 0 10px 16px; }
  .ui-figure:nth-child(odd) { padding-left: 0; border-left: none; }
  .ui-figure:nth-child(n+3) { border-top: 1px solid var(--line); }
  .ui-figure .v { margin-top: 4px; font-size: clamp(20px, 7cqi, 28px); }
}

/* ---------- Filter bar: cells, each a small label over its value ---------- */
/* Each cell is a <label class="ui-filter">: its control covers the whole
   cell, so a click anywhere opens it (fusion-select.js draws the list). */
.ui-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 0 0 16px; }
.ui-filters {
  flex: 1 1 560px;
  display: flex;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--bg);
  box-shadow: 0 1px 2px rgba(16, 16, 24, 0.04);
}
.ui-filter {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 54px;
  padding: 9px 14px 0;
  border-left: 1px solid var(--line);
  cursor: pointer;
  transition: background 0.15s;
}
.ui-filter:first-child { border-left: none; border-radius: 13px 0 0 13px; }
.ui-filter:last-child { border-radius: 0 13px 13px 0; }
.ui-filter:only-child { border-radius: 13px; }
.ui-filter.wide { flex-grow: 2.2; }
.ui-filter:hover, .ui-filter:focus-within { background: var(--bg-subtle); }
.ui-filter-label {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; color: var(--text-2);
  white-space: nowrap;
  pointer-events: none;
}
.ui-filter-label .ui-tip { pointer-events: auto; }
.ui-filter select, .ui-filter .fs-trigger, .ui-filter input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0;
  padding: 21px 28px 0 14px;
  border: none; border-radius: inherit;
  background: transparent var(--ui-chevron) no-repeat right 12px center;
  font: 500 14px var(--sans);
  color: var(--text);
  text-overflow: ellipsis; white-space: nowrap;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none; appearance: none;
}
/* The chevron (fusion-select.js .fs-chev) draws 3px inside its box: a right
   padding 3px under the left one sets its glyph as far from the cell's right
   edge as the text is from the left. */
.ui-filter .fs-trigger { display: flex; align-items: center; padding-right: 11px; }
.ui-filter input { padding-right: 14px; background-image: none; cursor: text; }
.ui-filter input::placeholder { color: var(--text-3); font-weight: 400; }
.ui-filter input::-webkit-search-cancel-button { display: none; }
.ui-filter select:focus-visible, .ui-filter .fs-trigger:focus-visible, .ui-filter input:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
@container (max-width: 700px) {
  .ui-filters { flex-basis: 100%; display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); overflow: clip; }
  /* Every cell draws its top and left hairline 1px out: at the box's own
     edge that falls under the clip, so only the lines between cells show,
     whatever the number of columns. Inner corners are square. */
  .ui-filters .ui-filter { height: 49px; margin: -1px 0 0 -1px; padding: 9px 12px 0; border-left: 1px solid var(--line); border-top: 1px solid var(--line); border-radius: 0; }
  .ui-filter.full { grid-column: 1 / -1; }
  .ui-filter-label { font-size: 11px; gap: 4px; }
  .ui-filter select, .ui-filter .fs-trigger, .ui-filter input { padding: 20px 26px 0 12px; font-size: 13.5px; background-position: right 10px center; }
  .ui-filter .fs-trigger { padding-right: 9px; }
  .ui-filter input { padding-right: 12px; }
}

/* ---------- Segmented control ---------- */
.ui-seg {
  display: inline-flex; flex-shrink: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-subtle);
}
.ui-seg button {
  flex: 1;
  height: 34px; padding: 0 14px;
  border: none; border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font: 500 13px var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}
.ui-seg[hidden] { display: none; }
.ui-seg button:hover { color: var(--text); }
.ui-seg button:disabled { color: var(--text-3); opacity: 0.45; cursor: default; }
.ui-seg button.on, .ui-seg button[aria-pressed="true"] {
  background: var(--bg); color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 16, 24, 0.08), 0 0 0 1px var(--line);
}
.ui-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
@container (max-width: 700px) { .ui-seg { width: 100%; } .ui-seg button { height: 36px; padding: 0 8px; } }

/* ---------- Tables: hairlines, no boxes ---------- */
.ui-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ui-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.ui-table th {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 12px; font-weight: 500; color: var(--text-3);
  text-align: left; white-space: nowrap;
}
.ui-table td { padding: 13px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ui-table th:first-child, .ui-table td:first-child { padding-left: 0; }
.ui-table th:last-child, .ui-table td:last-child { padding-right: 0; }
.ui-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ui-table .muted { color: var(--text-3); }
.ui-table th.sortable { cursor: pointer; user-select: none; transition: color 0.15s; }
.ui-table th.sortable:hover, .ui-table th.sorted { color: var(--text); }
.ui-table th .arrow { display: inline-block; margin-left: 4px; font-size: 10px; }
.ui-table a { color: inherit; text-decoration: none; }
.ui-table a:hover { color: var(--accent); }
.ui-mono { font-family: var(--mono); font-size: 12.5px; letter-spacing: -0.01em; }
.ui-sub { display: block; margin-top: 2px; font-size: 12.5px; color: var(--text-3); }

/* ---------- Network badge: mark and name ---------- */
/* The name carries the chip's baseline, so it sits on its line level with the
   words beside it; the mark is centred on it. (Inline, an image first would
   put the baseline at the image's foot and lift the name.) */
.ui-chain { display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.ui-chain img, .ui-chain .ui-chain-mono { align-self: center; width: 16px; height: 16px; flex-shrink: 0; border-radius: 4px; }
.ui-chain .ui-chain-mono {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--text); color: var(--bg);
  font: 700 6.5px/1 var(--sans);
}
[data-theme="dark"] .ui-chain img.ink { filter: invert(1); }
.ui-token {
  display: inline-block; padding: 1px 7px;
  border-radius: 6px; background: var(--bg-subtle);
  font: 500 12px var(--mono); color: var(--text-2);
}

/* ---------- Pager: range on the left, Prev · pages · Next ---------- */
.ui-pager {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 4px; padding-top: 18px;
}
.ui-pager .pg-range { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.ui-pager .pg-ctrls, .ui-pager .pg-nums { display: flex; align-items: center; gap: 6px; }
.ui-pager .pg-step, .ui-pager .pg-num {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; min-width: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: 9px;
  background: var(--bg); color: var(--text);
  font: 500 13px var(--sans); font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ui-pager .pg-num { padding: 0 10px; }
.ui-pager .pg-num.on { background: var(--text); border-color: var(--text); color: var(--bg); cursor: default; }
.ui-pager .pg-step:hover:not(:disabled), .ui-pager .pg-num:hover:not(.on) { background: var(--bg-subtle); border-color: var(--line-strong); }
.ui-pager .pg-step:disabled { opacity: 0.4; cursor: default; }
.ui-pager .pg-step:focus-visible, .ui-pager .pg-num:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ui-pager .pg-gap { padding: 0 2px; color: var(--text-3); }
.ui-pager .pg-of { display: none; }
@container (max-width: 700px) {
  .ui-pager { flex-direction: column; align-items: stretch; gap: 12px; padding-top: 16px; }
  .ui-pager .pg-range { text-align: center; }
  .ui-pager .pg-span { display: none; }   /* "Page n of N" below says where you are */
  .ui-pager .pg-nums { display: none; }
  .ui-pager .pg-of { display: block; flex: 1; text-align: center; font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
  .ui-pager .pg-ctrls { gap: 10px; }
  .ui-pager .pg-step { height: 44px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
}

/* ---------- ⓘ and its bubble (ui.js) ---------- */
.ui-tip {
  display: inline-block; flex-shrink: 0;
  width: 13px; height: 13px;
  background: var(--text-3);
  -webkit-mask: var(--ui-i-mask) center / contain no-repeat;
          mask: var(--ui-i-mask) center / contain no-repeat;
  font-size: 0; color: transparent;
  cursor: help;
  vertical-align: -2px;
  transition: background 0.15s;
}
.ui-tip:hover, .ui-tip:focus-visible { background: var(--text-2); outline: none; }
.ui-tip-bubble {
  position: fixed; z-index: 2000; left: 0; top: 0;
  max-width: min(320px, calc(100vw - 16px));
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--tip-bg); color: var(--tip-fg);
  font: 400 12.5px/1.5 var(--sans);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  opacity: 0; transform: translateY(2px);
  transition: opacity 0.12s, transform 0.12s;
  pointer-events: none;
}
.ui-tip-bubble.show { opacity: 1; transform: none; }

/* ---------- Buttons ---------- */
.ui-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--bg); color: var(--text);
  font: 500 13px var(--sans); white-space: nowrap;
  cursor: pointer; text-decoration: none;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ui-btn:hover { background: var(--bg-subtle); }
.ui-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ui-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.ui-btn.primary { border-color: transparent; background: var(--text); color: var(--bg); }
.ui-btn.primary:hover { opacity: 0.88; }

/* ---------- Chart box: the faint dot grid the charts sit on ---------- */
/* The dots (the reference's: one every 20px) fill the plot's square and stop
   at its edges: the page colour is laid over them above the plot (--plot-t),
   under it (--plot-b), where the dates go, and either side of it (--plot-l,
   the y labels' gutter, and --plot-r). ui-chart.js (frame) sets all four from
   the drawn plot. */
.ui-chart {
  position: relative;
  height: 340px;
  --dots: rgba(11, 11, 15, 0.14);
  --plot-t: 20px;
  --plot-b: 50px;
  --plot-l: 65px;
  --plot-r: 10px;
  background:
    linear-gradient(var(--bg), var(--bg)) top / 100% var(--plot-t) no-repeat,
    linear-gradient(var(--bg), var(--bg)) bottom / 100% var(--plot-b) no-repeat,
    linear-gradient(var(--bg), var(--bg)) left / var(--plot-l) 100% no-repeat,
    linear-gradient(var(--bg), var(--bg)) right / var(--plot-r) 100% no-repeat,
    radial-gradient(circle, var(--dots) 1px, transparent 1.5px) 0 0 / 20px 20px;
}
[data-theme="dark"] .ui-chart { --dots: rgba(255, 255, 255, 0.09); }
.ui-chart .nsewdrag { cursor: default !important; }
@container (max-width: 700px) { .ui-chart { height: 260px; } }

/* The dates under a chart: five, each under its own reading, the first and
   last kept inside the plot (ui-chart.js frame places them). */
.ui-dates {
  position: absolute; left: 0; right: 0; top: 0; z-index: 1;
  height: 16px;
  font: 12px/16px var(--sans); color: var(--chart-ink, var(--text-3));
  white-space: nowrap; pointer-events: none;
}
.ui-dates span { position: absolute; top: 0; left: 0; }
@container (max-width: 560px) { .ui-dates { font-size: 11px; } }

/* ---------- States ---------- */
.ui-empty { padding: 40px 12px; text-align: center; font-size: 13.5px; color: var(--text-3); }
.ui-error { padding: 16px 0; font-size: 14px; color: var(--neg); }
.ui-loading-row td { height: 52px; }
.ui-loading-row td::before { content: ''; display: block; height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-subtle) 0%, var(--line) 50%, var(--bg-subtle) 100%); background-size: 200% 100%; animation: ui-shimmer 1.4s linear infinite; }

/* ---------- Chart hover (ui-chart.js glide): hairline, ringed dots, bubble ---------- */
.hv { position: absolute; inset: 0; z-index: 5; pointer-events: none; }
.hv-line, .hv-dot, .hv-bubble {
  position: absolute; top: 0; left: 0;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}
.hv-jump .hv-dot, .hv-jump .hv-bubble, .hv-line.hv-jump { transition: opacity 0.14s ease; }
/* A dashed cursor, as the reference: 3 on, 3 off. It runs under the plot
   (ui-chart.js hairline): a bar covers it, so the bar and the marks in it
   stay readable; over the slot behind the bars. */
.hv-line { z-index: 0; width: 1px; pointer-events: none; background: repeating-linear-gradient(to bottom, var(--text-3) 0 3px, transparent 3px 6px); }
.hv-line.on { opacity: 0.5; }
/* The reference's active dot: 6 across the middle, a white ring of 2, a shadow. */
.hv-dot {
  width: 12px; height: 12px; margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 2px #fff, 2px 3px 6px rgba(0, 0, 0, 0.35);
}
/* A light card, as the reference: the page's own surface, a hairline and a
   soft shadow. */
.hv-bubble {
  min-width: 128px;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font: 400 12.5px/1.5 var(--sans);
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(16, 16, 24, 0.12), 0 2px 6px rgba(16, 16, 24, 0.05);
}
[data-theme="dark"] .hv-bubble { box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5); }
.hv-on .hv-dot, .hv-on .hv-bubble { opacity: 1; }
.hv-when { margin-bottom: 4px; font-size: 13px; color: var(--text-3); }
.hv-big { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.hv-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hv-row + .hv-row { margin-top: 2px; }
.hv-k { display: flex; align-items: center; gap: 7px; color: var(--text-2); }
/* A bar chart's day, as on Activity: a rounded slot behind the bars that
   glides to the day pointed at, while the other bars step back. */
.hv-slot {
  position: absolute; top: 0; left: 0; z-index: 0;
  border-radius: 8px;
  background: var(--bg-subtle);
  opacity: 0; pointer-events: none;
  transition: opacity 0.14s ease, transform 0.16s cubic-bezier(0.2, 0.8, 0.2, 1), width 0.16s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}
.hv-slot.hv-jump { transition: opacity 0.14s ease; }
.hv-slot.on { opacity: 1; }
.js-plotly-plot .barlayer .point { transition: opacity 0.18s; }
.js-plotly-plot.hv-live .barlayer .point { opacity: 0.35; }
.js-plotly-plot.hv-live .barlayer .point.hv-pt { opacity: 1; }
.hv-v { font-weight: 600; font-variant-numeric: tabular-nums; }
.hv-sw { width: 8px; height: 8px; flex-shrink: 0; border-radius: 50%; }

/* ---------- Section head: title, then its actions on the right ---------- */
.ui-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 14px; }
.ui-head h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -0.02em; color: var(--text); }
.ui-head .ui-count { margin-left: 8px; font-size: 13px; font-weight: 400; color: var(--text-3); white-space: nowrap; }
/* The title keeps its line: on a phone a button beside it that has an icon
   (Export, CSV, …) is just its icon (the word stays for screen readers), and
   the narrowest phones step the title down a size. */
@container (max-width: 560px) {
  .ui-head .ui-btn:has(> svg):not(.ui-menu .ui-btn) { width: 36px; padding: 0; gap: 0; font-size: 0; }
}
@container (max-width: 345px) { .ui-head h2 { font-size: 17px; } }

/* ---------- Export menu: <details class="ui-export"> (ui.js closes it) ---------- */
.ui-export { position: relative; }
.ui-export > summary { list-style: none; }
.ui-export > summary::-webkit-details-marker { display: none; }
.ui-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 50;
  width: 260px; max-width: calc(100vw - 32px);
  padding: 12px;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--bg);
  box-shadow: 0 18px 44px rgba(16, 16, 24, 0.14), 0 2px 6px rgba(16, 16, 24, 0.06);
}
[data-theme="dark"] .ui-menu { box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5); }
.ui-menu-k { margin: 2px 0 6px; font-size: 11.5px; font-weight: 500; color: var(--text-3); }
.ui-menu .ui-seg { display: flex; width: 100%; }
.ui-menu .ui-seg button { height: 30px; padding: 0 6px; font-size: 12.5px; }
.ui-check { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.ui-check input { accent-color: var(--accent); }
.ui-menu-actions { display: grid; gap: 6px; margin-top: 12px; }
.ui-menu-actions .ui-btn { width: 100%; }

/* ---------- Collapsible note (methodology and the like) ---------- */
.ui-more { border-top: 1px solid var(--line); }
.ui-more > summary {
  display: flex; align-items: center; gap: 6px;
  padding: 16px 0;
  list-style: none; cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--text-2);
}
.ui-more > summary::-webkit-details-marker { display: none; }
.ui-more > summary::after { content: ''; width: 12px; height: 12px; background: var(--ui-chevron) center / contain no-repeat; transition: transform 0.2s; }
.ui-more[open] > summary::after { transform: rotate(180deg); }
.ui-more > div { padding: 0 0 18px; max-width: 760px; font-size: 13.5px; line-height: 1.6; color: var(--text-2); }
.ui-more code { font: 12px var(--mono); padding: 1px 5px; border-radius: 5px; background: var(--bg-subtle); }

/* Labels, site-wide: every word starts with a capital (TVL Growth, Total
   Value Managed, Spot APY). Figure names, section titles, tabs, table
   headings, filter names, buttons and segments; not the keys, chips or
   dropdown values, which carry markets' and tokens' own spelling (cbETH). */
.ui-figure .k, .ui-head h2, h2, th, .ui-filter-label, .ui-menu-k, .ui-seg button, .ui-btn,
.xp-tab, .xp-sort, .chart-section-title, .xport-k, .xport-btn, .seg button { text-transform: capitalize; }
