/* Correlation engine: Measurement fund deck skin, tuned for dense finance text. */

:root {
  --bg: #fbfbf8;
  --bg-soft: #f6f6f1;
  --panel: rgba(255, 255, 255, 0.97);
  --panel-hi: #ffffff;
  /* Line colour lives on ONE axis. These four were each authored locally and each drifted off the warm
     neutral the rest of the product is built on — measured against --mf-border-subtle rgba(17,19,22)
     (B−R=5, G−R=2): --border B−R=6, --border-soft B−R=10, and the portfolio pair B−R=19 / G−R=14, which is
     visibly teal. Two adjacent modules therefore read as two different materials. Repointing the
     definitions moves ~123 declarations onto the warm axis without touching a single call site. */
  --border: var(--mf-border-default, rgba(17, 19, 22, 0.18));
  --border-soft: var(--mf-border-subtle, rgba(17, 19, 22, 0.105));

  --text: #1c2229;
  --text-dim: #596270;
  --text-faint: #858e9a;

  --pos: #16945c;
  --neg: #d94c68;
  --dir-high: #2f6f9f;
  --dir-low: #c7772f;
  /* Detail-surface tokens promoted to :root so the in-product trading modal (appended to <body>, outside
     #detail) shares the same panels/lines/accent. The detail view redefines them identically on #detail. */
  --detail-panel: var(--mf-surface-panel, #fffefa);
  --detail-line: var(--mf-border-subtle, rgba(17, 19, 22, 0.105));
  --detail-line-strong: var(--mf-border-default, rgba(17, 19, 22, 0.18));
  --detail-cyan: var(--mf-signal-accent, #74deeb);
  --recomp-marker: var(--mf-chart-revision, #96631c); /* 4.9:1 on --bg — darker than the original chart-stroke-only shade since it now also carries bold label text */
  --chart-line: #3d444c;
  --chart-area: #596270;
  --zero: #8e949c;
  --mixed: #596270;
  --accent: #2f7fc1;
  --accent-2: #596270;
  --accent-3: #2d8a6f;
  --accent-soft: rgba(47, 127, 193, 0.12);
  --surface-muted: rgba(32, 36, 42, 0.025);
  --surface-hover: rgba(47, 127, 193, 0.055);
  --deck-shadow: 0 16px 36px rgba(31, 35, 40, 0.045);
  --deck-shadow-strong: 0 22px 48px rgba(31, 35, 40, 0.075);

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Menlo", Consolas, monospace;
  --sans: var(--mono);
  --display: var(--mono);
  --type-caption-size: 12px;
  --type-body-size: 13.5px;
  --type-ui-size: 12.5px;
  --type-title-size: 23px;
  --type-title-mobile: 18px;
  --type-hero-size: 32px;

  --r: 8px;
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: var(--type-body-size);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

button,
input,
textarea,
select {
  font-family: var(--mono);
}

body.home-page,
body.index-page {
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--bg);
}

body.home-page::before,
body.home-page::after,
body.index-page::before,
body.index-page::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body.home-page::before,
body.index-page::before {
  z-index: 0;
  opacity: 0.42;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), transparent 36%),
    linear-gradient(90deg, transparent 0, rgba(32, 36, 42, 0.025) 1px, transparent 1px);
  background-size: 100% 100%, 84px 100%;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.42) 42%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.42) 42%, transparent 100%);
}

body.home-page::after,
body.index-page::after {
  z-index: 3;
  opacity: 0.2;
  background-image: radial-gradient(rgba(32, 36, 42, 0.04) 0.7px, transparent 0.7px);
  background-size: 6px 6px;
}

main {
  width: min(1320px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 72px;
}

.home-main {
  position: relative;
  z-index: 1;
  padding-top: 20px;
}

/* -- home hero ---------------------------------------------------------- */
.home-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 920px);
  align-items: start;
  min-height: 0;
  padding: 0 0 22px;
}

.home-hero::before {
  display: none;
}

/* The hero introduces the "Measure a theme" task only. On the other workspace tabs it's the wrong context and
   wastes the top of the screen, so hide it there — Review/History/Admin lead with their own pane header. */
body.review-workspace-view .home-hero,
body.history-workspace-view .home-hero,
body.admin-workspace-view .home-hero { display: none; }

/* ── header ─────────────────────────────────────────────────────────── */
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 10px;
}

header h1 {
  font-family: var(--mono);
  font-size: var(--type-title-size);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.12;
  margin: 0 0 8px;
  color: var(--text);
}

.home-hero header {
  max-width: 920px;
}

.home-hero h1 {
  max-width: 760px;
  font-family: var(--mono);
  font-size: var(--type-hero-size);
  font-weight: 600;
  line-height: 1.16;
  text-wrap: balance;
}

.sub {
  color: var(--text-dim);
  margin: 0 0 26px;
  max-width: min(100%, 68ch);
  text-wrap: pretty;
}

.home-hero .sub {
  width: min(100%, 760px);
  max-width: none;
  font-size: var(--type-body-size);
}

.navlink {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(47, 127, 193, 0.32);
}

.navlink:hover {
  color: var(--accent-3);
  border-bottom-color: var(--accent-3);
}

/* input row */
.command-band {
  width: min(100%, 1040px);
  margin: 0 0 24px;
  padding: 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: var(--deck-shadow);
}

form {
  display: flex;
  gap: 10px;
  min-width: 0;
}

#url {
  flex: 1 1 auto;
  min-width: 0;
  height: 54px;
  min-height: 54px;
  padding: 0 15px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--type-body-size);
  line-height: 1;
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease), box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease), background var(--mf-duration-standard, 180ms) var(--mf-ease);
}
#url::placeholder { color: var(--text-faint); }
#url:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
button {
  min-width: 132px;
  height: 54px;
  padding: 0 24px;
  border-radius: var(--r);
  border: 1px solid var(--text);
  cursor: pointer;
  background: var(--text);
  color: #ffffff;
  font-family: var(--mono);
  font-weight: 700;
  font-size: var(--type-ui-size);
  letter-spacing: 0;
  box-shadow: 0 10px 24px rgba(31, 35, 40, 0.12);
  transition: transform var(--mf-duration-standard, 180ms) var(--mf-ease), filter var(--mf-duration-standard, 180ms) var(--mf-ease), box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease);
}
button:hover {
  filter: none;
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(31, 35, 40, 0.16);
}
button:active { transform: translateY(1px) scale(0.99); }
button:disabled { opacity: 0.45; cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.provider-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 10px 2px 0;
  padding: 3px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.72);
}

.provider-option {
  min-width: 0;
  width: auto;
  height: 32px;
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: calc(var(--r) - 2px);
  background: transparent;
  color: var(--text-faint);
  box-shadow: none;
  font-size: 11px;
  font-weight: 700;
}

.provider-option:hover {
  filter: none;
  transform: none;
  box-shadow: none;
  color: var(--text);
}

.provider-option.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(31, 35, 40, 0.08);
}

/* input-mode toggle (Market URL vs Theme) — same chip styling as the provider toggle, placed above the form. */
.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin: 0 2px 10px;
  padding: 3px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.72);
}
.mode-option {
  min-width: 0;
  width: auto;
  height: 32px;
  min-height: 32px;
  padding: 0 13px;
  border: 0;
  border-radius: calc(var(--r) - 2px);
  background: transparent;
  color: var(--text-faint);
  box-shadow: none;
  font-size: 11px;
  font-weight: 700;
}
.mode-option:hover { filter: none; transform: none; box-shadow: none; color: var(--text); }
.mode-option.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(31, 35, 40, 0.08);
}

/* theme textarea — mirrors #url, but multi-line + vertically resizable. */
#theme {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 54px;
  padding: 14px 15px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  box-shadow: none;
  transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease), box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease), background var(--mf-duration-standard, 180ms) var(--mf-ease);
}
#theme::placeholder { color: var(--text-faint); }
#theme:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px var(--accent-soft);
}
[hidden] { display: none !important; }

.examples {
  margin: 12px 2px 0;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-faint);
  display: flex; gap: 14px; align-items: baseline; flex-wrap: wrap;
}
.examples a {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px dashed rgba(47, 127, 193, 0.32);
  padding-bottom: 1px;
}
.examples a:hover { color: var(--accent-3); border-color: var(--accent-3); }

.workspace-tabs {
  display: inline-flex;
  gap: 3px;
  margin: 0 0 18px;
  padding: 3px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.72);
}

.workspace-tab {
  min-width: 0;
  width: auto;
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: calc(var(--r) - 2px);
  background: transparent;
  color: var(--text-faint);
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
  /* Own transition, not the inherited `button` one: that list omits color/background, so without this the
     active pill's box-shadow eased in while its fill and text snapped — three properties of one state change
     landing at different times. Switched constantly (the primary nav for all four operator tabs), so this
     stays well under "should this animate" territory: fast enough to read as instant, not as waiting. */
  transition:
    background var(--mf-duration-fast, 120ms) var(--mf-ease),
    color var(--mf-duration-fast, 120ms) var(--mf-ease),
    box-shadow var(--mf-duration-fast, 120ms) var(--mf-ease);
}

.workspace-tab:hover {
  filter: none;
  transform: none;
  box-shadow: none;
  color: var(--text);
}

.workspace-tab.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(31, 35, 40, 0.08);
}

.workspace-pane {
  min-width: 0;
}

.status {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 9px 13px;
  border: 1px solid var(--border-soft);
  border-left: 2px solid var(--accent);
  border-radius: 8px;
  background: var(--panel);
  margin-bottom: 18px;
}
.status.err { color: var(--neg); border-left-color: var(--neg); }
.hidden { display: none; }

/* two columns */
/* minmax(0, 1fr) is load-bearing: it lets the result column shrink instead of
   expanding to the table's min-content (which was forcing the whole layout too wide). */
.muted {
  color: var(--text-dim);
  max-width: min(100%, 68ch);
}

@media (max-width: 960px) {
  .home-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: 42px;
  }

  .home-hero h1 {
    font-size: 26px;
  }

}

@media (max-width: 620px) {
  main {
    width: min(calc(100% - 20px), 1320px);
    padding-bottom: 48px;
  }

  .home-main {
    padding-top: 12px;
  }

  .home-hero {
    gap: 22px;
    padding: 32px 0 20px;
  }

  .home-hero h1 {
    font-size: 22px;
  }

  .home-hero .sub {
    font-size: var(--type-body-size);
  }

  .workspace-tabs {
    display: flex;
    width: 100%;
  }

  .workspace-tab {
    flex: 1 1 0;
    padding: 0 10px;
  }

  .command-band {
    padding: 10px;
  }

  form {
    flex-direction: column;
  }

  #url {
    flex: none;
  }

  button {
    width: 100%;
  }

  .panel {
    padding: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto; }
  .diff-skeleton-row { animation: none; }
  .recomp-record > summary::before { transition: none; }
}

/* Measurement surfaces (dashboard + detail) */
.navlink { color: var(--accent); text-decoration: none; border-bottom: 1px solid rgba(47, 127, 193, 0.32); }
.navlink:hover { color: var(--accent-3); border-bottom-color: var(--accent-3); }
.hidden { display: none !important; }

.index-main {
  position: relative;
  z-index: 1;
  padding-top: 20px;
}

.index-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 920px);
  align-items: center;
  padding: 36px 0 16px;
}

/* The detail page renders its own header inside #detail (index name left, big value top-right), so the shared
   hero is hidden there entirely — no tall empty title block above the value. */
body.detail-view .index-hero { display: none; }

.index-hero::before {
  content: "";
  position: absolute;
  inset: 18px 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(32, 36, 42, 0.2), transparent);
}

.index-hero header {
  max-width: 920px;
}

.index-hero h1 {
  max-width: 940px;
  font-family: var(--mono);
  font-size: var(--type-title-size);
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.12;
  text-wrap: balance;
}

.index-hero .sub {
  width: min(100%, 760px);
  max-width: none;
  font-size: var(--type-body-size);
}

#dashboard,
#detail {
  position: relative;
}

#empty {
  width: min(100%, 760px);
  margin: 12px 0 0;
  padding: 18px 20px;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent-3);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: var(--deck-shadow);
}

.index-sort-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  width: 100%;
  margin: 0 0 14px;
}

.index-sort-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.index-sort-button {
  min-width: 46px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border-soft);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--text-dim);
  font-size: var(--type-ui-size);
  box-shadow: none;
}

.index-sort-button:hover {
  border-color: var(--accent);
  color: var(--text);
}

.index-sort-button.active {
  border-color: rgba(32, 36, 42, 0.22);
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(31, 35, 40, 0.08);
}

/* Custom date-range row — the "Custom" option on both a range toolbar (.index-sort-buttons on the Measurement
   list, .chart-range on the detail page). Same scale/recipe as the segmented buttons it sits under. */
.range-custom {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.range-custom-input {
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  border-radius: calc(var(--r) - 2px);
  background: #ffffff;
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--mf-font-size-label);
}
.range-custom-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.range-custom-sep { color: var(--text-faint); font-size: 11px; }
.range-custom-apply {
  min-width: 0;
  width: auto;
  height: 28px;
  min-height: 28px;
  padding: 0 12px;
  font-size: var(--mf-font-size-label);
  font-weight: 700;
  border-radius: calc(var(--r) - 2px);
  border: 1px solid var(--border-soft);
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
}
.range-custom-apply:hover { box-shadow: 0 8px 18px rgba(31, 35, 40, 0.1); }
.range-custom-error { font-size: 11px; color: var(--neg); }
.range-custom-error:empty { display: none; }

.idx-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
}

.idx-card {
  position: relative;
  display: grid;
  /* No hard px floor on identity/spark (unlike a fixed minmax(300px,…)) — they shrink proportionally with the
     viewport instead of overflowing .idx-card's box (which clips via overflow:hidden). Keeps identity ‖ spark
     ‖ value side by side (left-right) at every width, rather than ever stacking spark below identity. */
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr) minmax(162px, auto);
  grid-template-areas: "identity spark value" "meta spark value";
  align-items: center;
  gap: 8px 22px;
  min-height: 104px;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  padding: 15px 16px;
  box-shadow: var(--deck-shadow);
  cursor: pointer;
  transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease), box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease), transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.idx-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.idx-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--border-soft);
  opacity: 1;
}

.idx-card:hover {
  border-color: rgba(32, 36, 42, 0.18);
  box-shadow: var(--deck-shadow-strong);
  transform: translateX(2px);
}

.idx-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.idx-name { font-family: var(--mono); font-size: 17px; font-weight: 600; line-height: 1.3; text-wrap: pretty; color: var(--text); }
/* The thesis title is a real <a> (the row's keyboard/screen-reader nav target) but should read as the row title,
   not a classic underlined link. It stays block-level (it replaced a <div>) and only reveals link affordances on
   hover/focus. */
.thesis-title-link { display: block; text-decoration: none; color: var(--text); }
.thesis-title-link:hover { color: var(--accent); }
.thesis-title-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.idx-scale { font: 11px var(--mono); color: var(--text-faint); letter-spacing: 0; margin: 0 0 6px; text-transform: uppercase; }
.idx-val { font-family: var(--mono); font-size: 30px; font-weight: 600; line-height: 1.08; margin: 16px 0 4px; color: var(--text); }
.idx-chg { font-family: var(--mono); font-size: 12.5px; }
.idx-row-meta { grid-area: meta; min-width: 0; align-self: center; }
.idx-row-main { grid-area: identity; min-width: 0; text-align: left; align-self: end; }
.idx-row-date { margin-top: 0; color: var(--text-faint); font-size: var(--type-caption-size); text-transform: uppercase; }
.idx-row-value {
  grid-area: value;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  text-align: center;
  white-space: nowrap;
  align-self: center;
  justify-self: end;
}
.idx-card .idx-val { margin: 0 0 4px; font-size: 24px; }
.idx-row-spark { grid-area: spark; min-width: 0; align-self: stretch; display: flex; align-items: center; }
.idx-card .spark { width: 100%; height: 48px; margin: 0; display: block; }
.idx-spark-panel {
  display: grid;
  grid-template-rows: 16px 52px 16px;
  justify-content: center;
  gap: 6px;
  min-height: 96px;
  width: 100%;
}
.idx-spark-line {
  min-width: 0;
  align-self: center;
}
.idx-spark-dir {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  width: 100%;
  font: 11px var(--mono);
  text-transform: uppercase;
  color: var(--text-faint);
}
.idx-spark-dir-high { align-items: start; padding: 0 2px 0 0; }
.idx-spark-dir-low { align-items: end; padding: 0 2px 0 0; }
.idx-dir-low { color: var(--dir-low); }
.idx-dir-high { color: var(--dir-high); }
.idx-gauge-value {
  margin: 0;
  font-size: 22px;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}
.idx-gauge-change {
  width: 100%;
  margin-top: -4px;
  text-align: right;
}
.idx-row.pos,
.idx-row.neg,
.idx-row.zero { --spark-color: #3d444c; }

.pos { color: var(--pos); } .neg { color: var(--neg); } .zero { color: var(--zero); }

.crumb { font-family: var(--mono); font-size: 12.5px; margin: 0; }
.crumb a, .seed-note { color: var(--accent); text-decoration: none; }
.crumb a { border-bottom: 1px dotted rgba(47, 127, 193, 0.42); }
.crumb a:hover { color: var(--accent-3); border-bottom-color: var(--accent-3); }

/* Detail header: index identity (left) sits parallel with the big value (top-right) — no boxed panel/padding. */
.detail-eyebrow { margin: 0 0 8px; }
.detail-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 40px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.detail-id { min-width: min(100%, 520px); }
.detail-back-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.back-link {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--border-soft);
  border-radius: calc(var(--r) - 3px);
  background: var(--panel);
}
.back-link:hover {
  background: var(--surface-hover);
}
.detail-name { font-family: var(--mono); font-size: 26px; font-weight: 600; line-height: 1.12; margin: 0; text-wrap: balance; color: var(--text); }
.detail-val {
  display: grid;
  justify-content: flex-end;
  text-align: right;
  margin-left: auto;
}
.detail-val .scale-badge { margin-top: 5px; }
.scale-badge { font-family: var(--mono); font-size: 12.5px; color: var(--text-faint); }
.seed-note { font-size: 11px; color: var(--mixed); border: 1px solid var(--border-soft); border-radius: 6px; padding: 0 6px; margin-left: 6px; }
.resolve-note { margin: -4px 0 12px; padding-left: 2px; font-size: 12px; }

/* re-analysis (use case 2) */
.reanalyze-btn {
  min-width: 0;
  width: auto;
  height: 28px;
  min-height: 28px;
  margin-left: 12px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: calc(var(--r) - 2px);
  border: 1px solid var(--border-soft);
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
  vertical-align: middle;
}
.reanalyze-btn:hover { filter: none; transform: none; box-shadow: 0 8px 18px rgba(31, 35, 40, 0.1); }
.reanalyze-status { font-family: var(--mono); font-size: 12px; color: var(--accent); margin: 0 0 10px; min-height: 0; }
.reanalyze-status:empty { display: none; }
.reanalyze-status.err { color: var(--neg); }
.detail-desc {
  margin: 9px 0 0;
  max-width: 72ch;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-dim, var(--text));
}
.evolved-note { margin: -4px 0 12px; padding-left: 2px; font-size: 12px; }

#detail > h2 {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 24px 0 10px;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin: 8px 0 10px;
}
.chart-range {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-soft);
  border-radius: calc(var(--r) - 2px);
  background: rgba(255, 255, 255, 0.72);
}
.chart-range-button {
  width: auto;
  min-width: 38px;
  height: 26px;
  min-height: 26px;
  padding: 0 9px;
  border: 0;
  border-radius: calc(var(--r) - 4px);
  background: transparent;
  box-shadow: none;
  color: var(--text-faint);
  font-size: 11px;
}
.chart-range-button:hover {
  transform: none;
  filter: none;
  box-shadow: none;
  color: var(--text);
  background: var(--surface-hover);
}
.chart-range-button.active {
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(31, 35, 40, 0.08);
}

/* Single column: #chart-wrap is the ONLY child (the Index detail's direction rail — a bull/bear pole axis next
   to the chart — was retired with the Index surface and is never rendered here). A stale second `54px` track
   used to reserve dead space for that rail, leaving the chart 66px narrower than every other full-width element
   on the page (header, facet grid, holdings table) — a visible misalignment. */
.chart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  margin: 0 0 24px;
}

.chart-wrap {
  position: relative;
  background:
    linear-gradient(rgba(32, 36, 42, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 36, 42, 0.032) 1px, transparent 1px),
    #ffffff;
  background-size: 30px 30px, 30px 30px, 100% 100%;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  margin: 0;
  box-shadow: var(--deck-shadow);
}

.chart { width: 100%; height: 320px; display: block; }
.chart .line { fill: none; stroke: var(--chart-line); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; filter: none; }
.chart .area { opacity: 1; }
.chart .axis0 { stroke: rgba(133, 142, 154, 0.3); stroke-dasharray: 2 5; }
/* axis + annotation type: smaller, lightly tracked, lighter weight — reads as fine captions, not chunky labels */
.chart .ytick, .chart .xtick { fill: var(--text-faint); font: 10px var(--mono); letter-spacing: 0.04em; opacity: 0.85; }
.chart .xtick.end { text-anchor: end; }
.chart .dot { fill: var(--chart-line); filter: none; }
.chart .vline { stroke: rgba(133, 142, 154, 0.34); stroke-dasharray: 2 3; }
/* Historical series can still use a quieter prior segment outside the Measurement Details chart. */
.chart .line.prior { stroke: var(--text-faint); opacity: 0.55; stroke-width: 1.6; }
.chart .area.prior { opacity: 0.4; }
.chart .dot.prior { fill: var(--text-faint); opacity: 0.7; }
/* Composition / Recomposition Record tabs — component-local (own data-comp-tab/-panel attributes), independent
   of the page-level .workspace-tabs wiring in app.js; same visual language, scoped state only. */
.comp-tabs {
  display: inline-flex;
  gap: 3px;
  margin: 28px 0 16px;
  padding: 3px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.72);
}
.comp-tab {
  height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: calc(var(--r) - 2px);
  background: transparent;
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.comp-tab:hover { color: var(--text); }
.comp-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.comp-tab.active { background: #ffffff; color: var(--text); box-shadow: 0 4px 12px rgba(31, 35, 40, 0.08); }

/* Recomposition Record: each event is its own native disclosure; expanding reveals the diff table. */
.recomp-records { display: flex; flex-direction: column; gap: 2px; }
.recomp-empty { padding: 8px 0; }
.recomp-record { border-bottom: 1px solid var(--border-soft); }
.recomp-record:last-child { border-bottom: none; }
.recomp-record > summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 4px;
  cursor: pointer;
  list-style: none;
}
.recomp-record > summary::-webkit-details-marker { display: none; }
.recomp-record > summary::before {
  content: "›";
  display: inline-block;
  width: 12px;
  color: var(--text-faint);
  transform: rotate(0deg);
  transition:transform var(--mf-duration-fast, 120ms) var(--mf-ease);
}
.recomp-record[open] > summary::before { transform: rotate(90deg); }
.recomp-record > summary:hover .recomp-date { color: var(--accent); }
.recomp-date { color: var(--text); font-variant-numeric: tabular-nums; font-weight: 700; }
.recomp-summary { color: var(--text-faint); font-size: 13px; }
.recomp-detail { padding: 0 4px 18px 20px; }
.recomp-rationale { margin: 0 0 12px; font-size: 13px; }
.recomp-unavailable, .recomp-filtered { font-size: 12.5px; margin: 10px 0 0; }

/* diff sections — Added / Removed / Reweighted, each a labeled group of diff-rows (market | price | sensitivity |
   weight). One shared column header sits above all three; a section is omitted entirely when it has no rows. */
.diff-row {
  display: grid;
  /* price/sensitivity need room for a full before→after comparison ("0.000 → 0.080", "↑0.12 → ↑0.09"), not just
     a single value — sized for the compare case since Reweighted rows are the ones that actually use it. */
  grid-template-columns: minmax(0, 1fr) 130px 130px 220px;
  align-items: center;
  gap: 14px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.diff-section:last-of-type .diff-row:last-child { border-bottom: none; }
.diff-row-head {
  padding: 0 4px 8px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.diff-row-head span:not(:first-child) { text-align: right; }
.diff-cell-price, .diff-cell-sens { text-align: right; font-variant-numeric: tabular-nums; }
.diff-cell-weight { display: flex; justify-content: flex-end; }
/* Measurement recomposition diff: NAV rows are market identity + compact metric cards. Scoped to .nav-recomp so
   the Index-era 4-col constituent diff stays untouched. */
.nav-recomp .diff-row { grid-template-columns: minmax(0, 1fr) minmax(260px, 340px); align-items: stretch; }
.recomp-facet { font-size: 12px; }
/* .sens-cell / .weight-cell carry a margin-right tuned for the constituents table's info-tip icon footprint
   (see thInfo above); this view has no info-tips on its column headers, so that margin would misalign the
   cell content against the plain-text "sensitivity" / "weight" headers. Three-class selectors (not two) so
   these reliably beat the equal-or-lower-specificity base rules regardless of source order. */
.diff-row .diff-cell-sens .sens-cell { margin-right: 0; }
.diff-row .diff-cell-weight .weight-cell { margin-right: 0; }
.diff-section { margin-top: 18px; }
.diff-section:first-of-type { margin-top: 10px; }
.diff-section-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 0 4px 6px;
  font-size: 12px;
  font-weight: 700;
}
.diff-section-count { color: var(--text-faint); font-weight: 500; }
.diff-section-added .diff-section-label { color: var(--pos); }
.diff-section-removed .diff-section-label { color: var(--neg); }
.diff-section-reweighted .diff-section-label { color: var(--recomp-marker); }

/* price / sensitivity: a single value for Added & Removed, a before→after comparison for Reweighted */
.metric-single { font-variant-numeric: tabular-nums; }
.metric-compare { display: inline-flex; align-items: baseline; gap: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.metric-arrow { color: var(--text-faint); font-size: 11px; }
.metric-after { font-weight: 600; }

/* weight: reuses the Composition tab's weight-cell/weight-pie/weight-pct verbatim (diffWeightPie in dashboard.js) —
   the "before" pie is muted/gray, the "after" pie is the normal accent-filled pie, same size so the arc fill is
   directly comparable at a glance. */
.weight-compare { display: inline-flex; align-items: center; gap: 6px; }
/* compound selectors (not just .weight-pie-muted) so these reliably beat the base .weight-pie rule regardless
   of source order — both are single-class selectors of equal specificity otherwise. */
.weight-pie.weight-pie-muted {
  background:
    radial-gradient(circle at center, #ffffff 0 42%, transparent 44%),
    conic-gradient(var(--text-faint) 0 var(--weight-share), rgba(133, 142, 154, 0.14) var(--weight-share) 100%);
  border-color: var(--border-soft);
  opacity: 0.8;
}
.weight-pie.weight-pie-empty { background: none; border: 1px dashed var(--border-soft); }
.weight-delta { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12px; }

/* skeleton rows shown until constituents-history resolves (product register: skeletons, not spinners) */
.diff-skeleton { display: flex; flex-direction: column; gap: 8px; padding: 6px 0; }
.diff-skeleton-row {
  height: 34px;
  border-radius: calc(var(--r) - 2px);
  background: linear-gradient(90deg, var(--bg-soft) 25%, var(--border-soft) 37%, var(--bg-soft) 63%);
  background-size: 400% 100%;
  animation: diff-shimmer 1.4s ease-in-out infinite;
}
@keyframes diff-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.tip {
  position: fixed;
  pointer-events: none;
  background: var(--panel-hi);
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  padding: 6px 10px;
  font: 12px var(--mono);
  color: var(--text);
  z-index: 20;
  white-space: nowrap;
  box-shadow: var(--deck-shadow);
}
.tip .detail-usdc-money {
  vertical-align: -2px;
}

/* What-if controls live in the constituents table itself. */
.constituents-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.scenario-reset-main {
  width: auto;
  min-width: 0;
  height: 34px;
  min-height: 34px;
  margin-left: auto;
  padding: 0 14px;
  border-radius: calc(var(--r) - 2px);
  border: 1px solid var(--border-soft);
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 4px 12px rgba(31, 35, 40, 0.08);
  font-size: 11px;
}
.scenario-reset-main:hover {
  transform: none;
  box-shadow: 0 8px 18px rgba(31, 35, 40, 0.1);
}
.scenario-reset-main:disabled {
  border-color: var(--border-soft);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: none;
}
.prob-cell {
  min-width: 250px;
  text-align: left;
}
.prob-values {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "context delta"
    "line delta";
  align-items: center;
  gap: 2px 10px;
  min-height: 38px;
  font-variant-numeric: tabular-nums;
  text-align: left;
  white-space: nowrap;
}
.prob-context {
  grid-area: context;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}
.prob-line {
  grid-area: line;
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  text-align: left;
}
.prob-now {
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.15;
}
.prob-now.pos {
  color: var(--pos);
}
.prob-now.neg {
  color: var(--neg);
}
.prob-now.zero {
  color: var(--text);
}
.prob-arrow {
  min-width: 14px;
  color: var(--text-faint);
  text-align: center;
  font-size: 11px;
  line-height: 1;
}
.prob-arrow:empty {
  display: none;
}
.prob-scenario {
  color: var(--text-faint);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.15;
}
.prob-scenario.zero {
  display: none;
}
.prob-scenario.pos {
  color: var(--pos);
}
.prob-scenario.neg {
  color: var(--neg);
}
.prob-delta {
  grid-area: delta;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(133, 142, 154, 0.18);
  background: rgba(133, 142, 154, 0.08);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1;
}
.prob-delta:empty {
  display: none;
}
.prob-delta.pos {
  border-color: rgba(22, 148, 92, 0.38);
  background: rgba(22, 148, 92, 0.11);
  color: var(--pos);
}
.prob-delta.neg {
  border-color: rgba(217, 76, 104, 0.42);
  background: rgba(217, 76, 104, 0.12);
  color: var(--neg);
}
.prob-slider {
  appearance: none;
  width: 100%;
  height: 14px;
  margin: 7px 0 0;
  background: transparent;
  accent-color: var(--accent);
  vertical-align: middle;
}
.prob-slider::-webkit-slider-runnable-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(133, 142, 154, 0.34);
}
.prob-slider::-webkit-slider-thumb {
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4.5px;
  border: 1px solid rgba(47, 127, 193, 0.92);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 5px rgba(31, 35, 40, 0.16);
}
.prob-slider::-moz-range-track {
  height: 3px;
  border-radius: 999px;
  background: rgba(133, 142, 154, 0.34);
}
.prob-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 1px solid rgba(47, 127, 193, 0.92);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 2px 5px rgba(31, 35, 40, 0.16);
}
.prob-slider:disabled {
  opacity: 0.34;
}
.weight-cell {
  display: inline-grid;
  grid-template-columns: 17px auto;
  align-items: center;
  gap: 6px;
  margin-right: 19px;
  font-variant-numeric: tabular-nums;
}
.weight-pie {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  justify-self: start;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 0 42%, transparent 44%),
    conic-gradient(var(--accent) 0 var(--weight-share), rgba(133, 142, 154, 0.18) var(--weight-share) 100%);
  border: 1px solid rgba(47, 127, 193, 0.38);
  box-shadow: none;
}
.weight-pct {
  justify-self: end;
  text-align: right;
}
.constituents-intro {
  margin: 8px 0 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-faint);
}
.constituents-intro .intro-with { color: var(--pos); font-weight: 600; }
.constituents-intro .intro-against { color: var(--neg); font-weight: 600; }
.th-label {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
  margin-left: auto;
  line-height: 1;
  white-space: nowrap;
}
.th-label.weight-head {
  width: 70px;
}
.th-label.beta-head {
  width: 92px;
}
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-left: 0;
  vertical-align: middle;
  outline: none;
}
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border: 1px solid rgba(133, 142, 154, 0.38);
  border-radius: 50%;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  text-transform: none;
}
.info-bubble {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  display: none;
  width: min(260px, 64vw);
  padding: 8px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: var(--deck-shadow-strong);
  color: var(--text-dim);
  font: 11px/1.45 var(--mono);
  text-align: left;
  text-transform: none;
  white-space: normal;
}
.info-tip:hover .info-icon,
.info-tip:focus .info-icon,
.info-tip:focus-within .info-icon {
  border-color: rgba(47, 127, 193, 0.68);
  color: var(--text);
}
.info-tip:hover .info-bubble,
.info-tip:focus .info-bubble,
.info-tip:focus-within .info-bubble {
  display: block;
}
.tbl tbody tr.scenario-driver td {
  background: rgba(45, 138, 111, 0.08);
}
.tbl tbody tr.scenario-driver td:first-child {
  border-left: 2px solid var(--accent-3);
}

/* market-name: the primary identifier in any constituent/diff row — bolder + full-contrast so it reads as the
   headline of the row regardless of whether this particular market has a live link right now (conCell above). */
.market-name { font-weight: 600; color: var(--text); }
/* constituent Polymarket deep links + the hover "as of <date>" marker on the constituents table */
.tbl a.mlink,
.diff-row a.mlink { color: var(--accent); text-decoration: none; border-bottom: 1px dotted rgba(47, 127, 193, 0.42); }
.tbl a.mlink:hover,
.diff-row a.mlink:hover { color: var(--accent-3); border-bottom-color: var(--accent-3); }
.con-asof { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--text-faint); margin-left: 8px; }
.con-asof.hover { color: var(--accent); }
.con-asof.scenario { color: var(--accent-3); }
.con-hint { font-weight: 400; font-size: 14px; }

.movers { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 8px; }
.chip {
  font-family: var(--mono);
  font-size: 12px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 4px 9px;
  background: var(--panel);
}

.tbl-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: var(--deck-shadow);
}
.tbl { width: 100%; min-width: 720px; table-layout: fixed; border-collapse: collapse; font-family: var(--mono); font-size: 13.5px; }
.tbl col.col-price { width: 250px; }
.tbl col.col-weight { width: 96px; }
.tbl col.col-beta { width: 136px; }
.tbl .weight-col,
.tbl .beta-col {
  text-align: right;
}
.tbl .sens-cell,
.diff-row .sens-cell {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 4px;
  margin-right: 19px;
  font-variant-numeric: tabular-nums;
}
.tbl .sens-cell .sens-dir,
.diff-row .sens-cell .sens-dir { font-size: 11px; line-height: 1; }
.tbl .sens-cell.sens-pos .sens-dir,
.diff-row .sens-cell.sens-pos .sens-dir { color: var(--pos); }
.tbl .sens-cell.sens-neg,
.diff-row .sens-cell.sens-neg { color: var(--neg); }
.tbl .sens-cell.sens-zero,
.diff-row .sens-cell.sens-zero { color: var(--text-faint); }
.tbl th {
  text-align: right;
  color: var(--text-faint);
  font-weight: 700;
  padding: 10px 13px;
  border-bottom: 1px solid var(--border-soft);
  letter-spacing: 0;
  background: var(--surface-muted);
  text-transform: uppercase;
}
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl td { text-align: right; padding: 10px 13px; border-bottom: 1px solid var(--border-soft); }
.tbl tbody tr:hover td { background: var(--surface-hover); }
.tbl .mono { color: var(--text-dim); }

.view-row {
  margin-bottom: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px;
  grid-auto-rows: min-content;
  align-items: center;
  column-gap: 14px;
  background: var(--panel);
}
.view-row svg { grid-row: 1 / span 2; grid-column: 2; }
.view-head { font-weight: 600; }
.view-name { line-height: 1.45; overflow-wrap: anywhere; color: var(--text); }
.view-type { font-family: var(--mono); font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0; font-weight: 400; }
.view-val { font-family: var(--mono); font-size: 13px; margin-top: 2px; }
.view-flag { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0; text-transform: uppercase; color: var(--mixed); border: 1px solid var(--border); padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.stale { color: var(--neg); }

/* Local measurement admin */
.admin-main { width: min(1240px, calc(100% - 32px)); }
.admin-shell {
  position: relative;
  z-index: 1;
}
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 8px 0 14px;
}
.admin-tools,
.admin-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.admin-filter {
  width: min(420px, 42vw);
  min-width: 220px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--r);
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
}
.admin-filter:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.compact-button,
.danger-button {
  min-width: 0;
  width: auto;
  height: 42px;
  min-height: 42px;
  padding: 0 14px;
  font-size: 12px;
}
.compact-link {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
  background: var(--panel);
}
.compact-link:hover {
  color: var(--accent-3);
  border-color: rgba(45, 138, 111, 0.44);
}
.danger-button {
  border-color: rgba(217, 76, 104, 0.58);
  background: rgba(217, 76, 104, 0.14);
  color: var(--neg);
  box-shadow: none;
}
.danger-button:hover {
  box-shadow: 0 8px 18px rgba(31, 35, 40, 0.1);
}
.admin-state,
.admin-count {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11px;
}
.admin-state.writer { color: var(--pos); border-color: rgba(22, 148, 92, 0.34); }
.admin-state.readonly { color: var(--mixed); border-color: rgba(89, 98, 112, 0.34); }

/* pane header — the compact per-tab title + one-line purpose that shows once the shared hero is hidden on the
   Review / Admin / History tabs (calm, institutional; carries context the hero used to provide). */
.pane-head { margin: 2px 0 16px; }
.pane-head h2 {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1.2;
  color: var(--text);
  margin: 0 0 4px;
}
.pane-sub {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text-dim);
  margin: 0;
  max-width: 72ch;
  text-wrap: pretty;
}

/* admin-only settings row */
.admin-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 2px 0 12px;
}
.analysis-settings {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin: 2px 0 0;
}
.analysis-settings-hint { font-size: 12px; }
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  border-radius: 999px;
  background: var(--border);
  transition: background var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.switch input:checked + .switch-track { background: var(--pos); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: 0.5; }
.switch:has(input:disabled) { cursor: default; }
.switch-label { font-size: 12.5px; color: var(--text); }
.admin-settings-hint { font-size: 11.5px; }
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: var(--deck-shadow);
}
.admin-table {
  width: 100%;
  min-width: 720px; /* keep columns intact on narrow screens; .admin-table-wrap scrolls horizontally instead of squishing the ID into one char per line */
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12.5px;
}
.admin-table th {
  text-align: left;
  color: var(--text-faint);
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-muted);
  text-transform: uppercase;
}
.admin-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
  /* Scanned rapidly while scrolling a dense table — closer to "hover tens of times" than "occasional", so
     this stays deliberately shorter than the review queue's row transition above it. */
  transition: background var(--mf-duration-fast, 120ms) var(--mf-ease);
}
.admin-table tbody tr:hover td { background: var(--surface-hover); }
.admin-name {
  min-width: 230px;
  font-family: var(--mono);
  font-weight: 600;
}
.admin-name a {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted rgba(47, 127, 193, 0.32);
}
.admin-name a:hover {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.mono { font-family: var(--mono); }
.id-cell {
  color: var(--text-dim);
  white-space: nowrap; /* keep the id on one line — the table (min-width) + .admin-table-wrap scroll horizontally instead of char-wrapping */
}
.admin-value {
  display: block;
  margin-top: 2px;
  color: var(--text);
}
.admin-actions { text-align: right; }

/* Admin table rows are THESES: the per-share cell carries BOTH directions (a thesis with only one direction
   shows a muted dash for the missing side, not an empty cell). The two sides sit side by side on one line —
   stacking them made every row two lines tall, which is half the reason the table needed two screens. */
.admin-nav-pair { display: flex; flex-direction: row; align-items: baseline; gap: 12px; }
.admin-nav-side { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.admin-nav-side.muted { color: var(--text-faint); }
.admin-nav-hist { color: var(--dir-low); font-size: 11px; }

/* Index Admin — expandable full-parameter detail */
.idx-expand {
  appearance: none;
  width: 18px;
  height: 18px;
  margin-right: 7px;
  padding: 0;
  border: 1px solid var(--border-soft);
  border-radius: 5px;
  background: var(--panel);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  vertical-align: baseline;
}
.idx-expand:hover { color: var(--accent); border-color: var(--accent-soft); }
.admin-table tbody tr.idx-open td { background: var(--surface-hover); }
.admin-table tbody tr.admin-detail-row td,
.admin-table tbody tr.admin-detail-row:hover td {
  padding: 0 12px 14px;
  background: var(--surface-muted);
}
.idx-detail { padding-top: 12px; }
.idx-detail-desc {
  margin: 0 0 10px;
  max-width: 72ch;
  color: var(--text-dim);
  font-size: 12.5px;
}
.idx-detail-params {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 24px;
  margin-bottom: 12px;
}
.idx-detail-param { display: flex; flex-direction: column; gap: 2px; }
.idx-detail-param .k {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}
.idx-detail-param .v { font-family: var(--mono); font-size: 13px; color: var(--text); }
.idx-detail-param .v.muted { color: var(--text-faint); }
.idx-detail-param .v.pos { color: var(--pos); }
.idx-detail-param .v.neg { color: var(--neg); }
.idx-detail-param .unit { font-size: 10px; color: var(--text-faint); }
.idx-detail-note { margin: -4px 0 10px; font-size: 11px; }
.idx-con-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--panel);
}
.idx-con-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 12px;
}
.idx-con-table th {
  text-align: right;
  white-space: nowrap;
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-muted);
  color: var(--text-faint);
  font-weight: 700;
  cursor: help;
}
.idx-con-table th:first-child { text-align: left; }
.idx-con-table td {
  text-align: right;
  white-space: nowrap;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
}
.idx-con-table tbody tr:last-child td { border-bottom: none; }
.idx-con-table td.con-market {
  text-align: left;
  white-space: normal;
  min-width: 220px;
}
.idx-con-table td.pos { color: var(--pos); }
.idx-con-table td.neg { color: var(--neg); }
.idx-con-table td.zero { color: var(--text-dim); }
.idx-con-table .mlink {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dotted rgba(47, 127, 193, 0.32);
}
.idx-con-table .mlink:hover { color: var(--accent); border-bottom-color: var(--accent); }
.idx-detail-loading { padding: 14px 2px; font-size: 12px; }
.idx-detail-error { padding: 12px 2px; font-size: 12px; color: var(--neg); }
.link-retry {
  appearance: none;
  border: none;
  background: none;
  padding: 0 0 0 6px;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* Local analysis history */
.history-shell {
  position: relative;
  z-index: 1;
}
.history-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.88fr) minmax(0, 1.12fr);
  gap: 16px;
  align-items: start;
}
.history-list,
.history-detail {
  min-width: 0;
}
.history-row {
  cursor: pointer;
}
.history-row.selected td {
  background: var(--accent-soft);
}
.history-run-button {
  display: grid;
  width: 100%;
  min-height: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  text-align: left;
}
.history-run-button:hover {
  transform: none;
  filter: none;
  box-shadow: none;
}
.history-input {
  color: var(--text);
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.history-run-id {
  margin-top: 2px;
  color: var(--text-faint);
  font-size: 11px;
}
.status-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
}
.status-badge.complete {
  color: var(--pos);
  border-color: rgba(22, 148, 92, 0.34);
  background: rgba(22, 148, 92, 0.09);
}
.status-badge.error {
  color: var(--neg);
  border-color: rgba(217, 76, 104, 0.38);
  background: rgba(217, 76, 104, 0.1);
}
.status-badge.aborted {
  color: var(--mixed);
  border-color: rgba(89, 98, 112, 0.36);
  background: rgba(89, 98, 112, 0.1);
}
.status-badge.running,
.status-badge.pending,
.status-badge.retrying {
  color: var(--accent);
  border-color: rgba(47, 127, 193, 0.36);
  background: rgba(47, 127, 193, 0.1);
}
/* Recompose-run terminal statuses: a run that ended badly reads like an error, one that ended with nothing to do
   reads like a neutral outcome. */
.status-badge.failed,
.status-badge.timed_out {
  color: var(--neg);
  border-color: rgba(217, 76, 104, 0.38);
  background: rgba(217, 76, 104, 0.1);
}
.status-badge.noop,
.status-badge.superseded {
  color: var(--mixed);
  border-color: rgba(89, 98, 112, 0.36);
  background: rgba(89, 98, 112, 0.1);
}
.recompose-runs {
  margin-bottom: 18px;
}
.history-detail {
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: var(--panel);
  padding: 16px;
  box-shadow: var(--deck-shadow);
}
.history-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}
.history-detail-head h2 {
  margin: 9px 0 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.history-detail-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 7px;
}
.history-detail-meta span {
  height: 24px;
  padding: 2px 7px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  color: var(--text-faint);
  background: #ffffff;
  font-size: 11px;
}
.history-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin: 14px 0 0;
}
.history-summary-grid div {
  min-width: 0;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.history-summary-grid dt {
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
}
.history-summary-grid dd {
  margin: 3px 0 0;
  color: var(--text);
  overflow-wrap: anywhere;
}
.history-section {
  margin-top: 18px;
}
.history-section h3 {
  margin: 0 0 10px;
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
}
.history-artifact {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.history-artifact div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
}
.history-label {
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
}
.history-events {
  display: grid;
  gap: 8px;
}
.history-event {
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: #ffffff;
  overflow: hidden;
}
.history-event summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  padding: 9px 11px;
  color: var(--text);
  font-weight: 600;
}
.history-event summary span {
  color: var(--text-faint);
  font-weight: 400;
}
.history-event pre {
  max-height: 360px;
  margin: 0;
  padding: 11px;
  overflow: auto;
  border-top: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 960px) {
  .index-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-top: 42px;
  }

  .index-hero h1 {
    font-size: var(--type-title-mobile);
  }

}

@media (max-width: 760px) {
  /* The nav detail header's title ‖ value pairing is unconditional (see .nav-detail-top) — this just keeps
     the title compact once the column has narrowed a lot. */
  .nav-detail-top .detail-name { font-size: 20px; }
  .view-row { grid-template-columns: 1fr; }
  .view-row svg { grid-column: 1; grid-row: auto; width: 100%; margin-top: 10px; }
  .history-layout {
    grid-template-columns: 1fr;
  }
  .history-detail-head,
  .history-detail-meta {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
  }
  .history-summary-grid {
    grid-template-columns: 1fr;
  }
  .history-artifact div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .constituents-head {
    align-items: flex-start;
  }
  /* Narrow width: WRAP the toolbar instead of stacking every control full-width (which turned light toolbars
     like Review's Refresh + Dashboard into a column of full-width blocks). Only the search field goes full-width. */
  .admin-toolbar { flex-wrap: wrap; align-items: flex-start; row-gap: 10px; }
  .admin-tools,
  .admin-meta { flex-wrap: wrap; align-items: center; }
  .admin-filter { flex: 1 1 100%; width: 100%; min-width: 0; }
  /* review detail's sticky publish bar: keep buttons in ≤2 rows (primary full-width, then reject/unpublish) so
     the sticky bar stays short and doesn't blanket the form. */
  .review-actions-final { flex-wrap: wrap; }
  .review-actions-final .review-actions-spacer { display: none; }
  .review-actions-final .review-publish { flex: 1 1 100%; }
  .review-actions-final .danger-button { flex: 1 1 auto; }
}

@media (max-width: 620px) {
  .index-main { padding-top: 12px; }
  .index-hero { gap: 18px; padding: 32px 0 20px; }
  .index-hero h1 { font-size: var(--type-title-mobile); line-height: 1.12; }
  .index-hero .sub { font-size: var(--type-body-size); }
  .index-sort-toolbar,
  .index-sort-buttons,
  .index-sort-button {
    width: 100%;
  }
  .index-sort-button {
    flex: 1 1 30%;
  }
  .idx-spark-panel {
    grid-template-rows: 14px 46px 14px;
    min-height: 88px;
    gap: 7px;
    align-self: center;
  }
  .idx-spark-dir {
    font-size: 10px;
  }
  .chart-head {
    justify-content: stretch;
  }
  .chart-range {
    width: 100%;
  }
  .chart-range-button {
    flex: 1 1 0;
    min-width: 0;
  }
  .chart-layout {
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 22px;
  }
  .chart { height: 260px; }
  /* Quiet, compact chip aligned right — not a full-width primary-looking bar for a control that's disabled
     until you actually move a slider. */
  .scenario-reset-main {
    height: 30px;
    min-height: 30px;
    padding: 0 12px;
    box-shadow: none;
  }

  /* Constituents: a 720px fixed table can't fit a phone — lay each market out as a stacked card instead of
     forcing a horizontal scroll. The header row is hidden; weight/sensitivity get inline labels via ::before. */
  .tbl-wrap { overflow-x: visible; padding: 0 14px; }
  .tbl { min-width: 0; display: block; font-size: 13px; }
  .tbl colgroup, .tbl thead { display: none; }
  .tbl tbody { display: block; }
  .tbl tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "market market"
      "price  price"
      "weight sens";
    align-items: start;
    gap: 12px 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-soft);
  }
  .tbl tbody tr:last-child { border-bottom: none; }
  .tbl td { display: block; padding: 0; border: none; text-align: left; }
  .tbl td:first-child { grid-area: market; }
  .tbl td.prob-cell { grid-area: price; min-width: 0; }
  .tbl td.weight-col { grid-area: weight; }
  .tbl td.beta-col { grid-area: sens; }
  .tbl td.weight-col::before,
  .tbl td.beta-col::before {
    display: block;
    margin-bottom: 5px;
    color: var(--text-faint);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .tbl td.weight-col::before { content: "weight"; }
  .tbl td.beta-col::before { content: "sensitivity"; }
  .weight-cell { width: auto; margin-right: 0; }
  .sens-cell { margin-right: 0; justify-content: flex-start; }
  .prob-slider { width: 100%; }

  /* Recomposition diff rows: same stacked treatment as the constituent table above. */
  .comp-tabs { width: 100%; }
  .comp-tab { flex: 1 1 50%; }
  .diff-row-head { display: none; }
  .diff-row {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "market market"
      "price  sens"
      "weight weight";
    gap: 8px 16px;
    padding: 14px 4px;
  }
  .diff-cell-market { grid-area: market; }
  .diff-cell-price { grid-area: price; text-align: left; }
  .diff-cell-sens { grid-area: sens; text-align: left; }
  .diff-cell-weight { grid-area: weight; justify-content: flex-start; }
  .diff-cell-price::before,
  .diff-cell-sens::before {
    display: block;
    margin-bottom: 5px;
    color: var(--text-faint);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }
  .diff-cell-price::before { content: "price"; }
  .diff-cell-sens::before { content: "sensitivity"; }
  /* Measurement recomposition diff has no sensitivity column — stack market / p_dir / weight instead. */
  .nav-recomp .diff-row { grid-template-areas: "market market" "price weight"; }
  .nav-recomp .diff-cell-price::before { content: "p_dir"; }
}

/* resolved/closed legs — a member pinned at its settled 0/1 value (not a live quote). */
.resolved-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.05em 0.42em;
  border-radius: 999px;
  vertical-align: middle;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--bg-soft);
}
.resolved-badge.res-yes { color: var(--pos); border-color: rgba(22, 148, 92, 0.35); background: rgba(22, 148, 92, 0.10); }
.resolved-badge.res-no { color: var(--neg); border-color: rgba(217, 76, 104, 0.35); background: rgba(217, 76, 104, 0.10); }
.resolved-badge.res-closed { color: var(--text-dim); }
/* the row's live-quote affordances are moot once settled — mute it so resolved legs read as "done" */
tr.con-resolved { opacity: 0.74; }
tr.con-resolved .prob-slider { opacity: 0.5; }

/* ── Thematic NAV ($-denominated products, shown alongside the factor indices) ────────────────────── */

/* LONG/SHORT position badge — direction is a POSITION, not a value judgment. The "LONG"/"SHORT" text always carries
   the meaning (never colour-only); long and short are visually distinct but both fully legible. */
.nav-dir-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.nav-dir-badge.long { color: var(--accent); border-color: rgba(47, 127, 193, 0.4); background: rgba(47, 127, 193, 0.12); }
.nav-dir-badge.short { color: var(--neg); border-color: rgba(217, 76, 104, 0.42); background: rgba(217, 76, 104, 0.12); }

/* Explicit, easy-to-catch LONG/SHORT switch — a prominent segmented control modelled on .chart-range but bigger and
   bolder. It flips between the long and short of the SAME theme. Both labels stay legible; the active side is filled. */
.nav-dir-switch {
  display: inline-flex;
  align-items: stretch;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: var(--deck-shadow);
}
.nav-dir-switch-btn {
  width: auto;
  min-width: 74px;
  height: 32px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: calc(var(--r) - 4px);
  background: transparent;
  box-shadow: none;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
}
.nav-dir-switch-btn:hover:not(.active):not(:disabled) { color: var(--text); background: var(--surface-hover); }
.nav-dir-switch-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.nav-dir-switch-btn.long.active { color: #ffffff; background: var(--accent); border-color: var(--accent); }
.nav-dir-switch-btn.short.active { color: #ffffff; background: var(--neg); border-color: var(--neg); }

/* Compact Long/Short toggle for a LIST row (dashboard card / admin row) — same semantics as .nav-dir-switch (the
   detail page's bigger switch) but sized to sit inline in a card's value column. Toggling it swaps which side's
   $/sparkline/move% the row displays; it does NOT navigate (the row itself does, on click outside the toggle). */
.thesis-dir-switch {
  display: inline-flex;
  align-items: stretch;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border-soft);
  border-radius: calc(var(--r) - 4px);
  background: var(--panel);
  margin-bottom: 6px;
}
.thesis-dir-btn {
  width: auto;
  min-width: 44px;
  height: 20px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: calc(var(--r) - 6px);
  background: transparent;
  box-shadow: none;
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
}
.thesis-dir-btn:hover:not(.active) { color: var(--text); background: var(--surface-hover); }
.thesis-dir-btn.long.active { color: #ffffff; background: var(--accent); border-color: var(--accent); }
.thesis-dir-btn.short.active { color: #ffffff; background: var(--neg); border-color: var(--neg); }

/* Group the switch, hero, and context as a right-aligned column (matching .nav-hero). */
.nav-detail-val { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; grid-area: val; }
.nav-detail-val .nav-hero-slot { width: 100%; }

.nav-dashboard { margin-top: 20px; }
.nav-dashboard .idx-list { margin-top: 0; }
.nav-dashboard .measurement-list { margin-top: 0; }

body.dashboard-view {
  background:
    linear-gradient(90deg, rgba(17, 19, 22, 0.026) 1px, transparent 1px),
    #fffefa;
  background-size: 96px 100%;
}

body.dashboard-view::before {
  opacity: 0.18;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), transparent 34%),
    linear-gradient(90deg, transparent 0, rgba(17, 19, 22, 0.026) 1px, transparent 1px);
  background-size: 100% 100%, 96px 100%;
}

body.dashboard-view::after {
  opacity: 0.12;
}

body.dashboard-view main {
  width: min(var(--mf-layout-app-max), calc(100% - var(--mf-space-16)));
  padding: 32px 0 64px;
}

body.dashboard-view #dashboard,
body.dashboard-view .index-main,
body.dashboard-view .measurement-list-hero,
body.dashboard-view .sr-only {
  --list-graphite: var(--mf-text-strong, #111316);
  --list-ink: var(--mf-text-primary, #1b2026);
  --list-muted: var(--mf-text-secondary, #65707a);
  --list-faint: var(--mf-text-disabled, #9aa3ad);
  --list-panel: var(--mf-surface-panel, #fffefa);
  --list-line: var(--mf-border-subtle, rgba(17, 19, 22, 0.105));
  --list-line-strong: var(--mf-border-default, rgba(17, 19, 22, 0.18));
  --list-cyan: var(--mf-signal-accent, #74deeb);
  --list-cyan-soft: var(--mf-color-accent-soft, rgba(116, 222, 235, 0.18));
  --list-pos: var(--mf-status-positive, #168765);
  --list-neg: var(--mf-status-negative, #c85261);
  --list-sans: var(--mf-font-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  --list-mono: var(--mf-font-mono, "SF Mono", Menlo, Consolas, monospace);
  color: var(--list-ink);
  font-family: var(--list-sans);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

body.dashboard-view .measurement-list-hero {
  position: relative;
  z-index: 70;
  display: block;
  padding: 14px 0 14px;
}

body.dashboard-view .measurement-list-hero::before {
  display: none;
}

.measurement-list-hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas:
    "logo tabs actions";
  align-items: center;
  gap: 12px 22px;
  width: 100%;
  max-width: none;
  min-width: 0;
}

.index-hero .measurement-list-hero-inner {
  width: 100%;
  max-width: none;
}

.measurement-list-logo {
  grid-area: logo;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  width: 188px;
  max-width: 100%;
  border-bottom: 0;
  text-decoration: none;
}

.measurement-list-logo img {
  display: block;
  width: 100%;
  height: auto;
}

.dashboard-product-tabs {
  grid-area: tabs;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}

.dashboard-product-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: auto;
  min-height: 0;
  min-width: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--list-muted);
  font-family: var(--list-sans);
  font-size: 14px;
  font-weight: 560;
  letter-spacing: 0.005em;
  line-height: 1;
  text-decoration: none;
  transition: color var(--mf-duration-standard, 180ms) var(--mf-ease);
}

.dashboard-product-tab:hover {
  color: var(--list-graphite);
}

.dashboard-product-tab.active {
  border: 0;
  background: transparent;
  color: var(--list-graphite);
  font-weight: 650;
  box-shadow: none;
}

.dashboard-product-tab.active::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -7px;
  left: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--list-cyan);
}

.dashboard-product-tab-soon {
  cursor: default;
}

.dashboard-product-tab-soon::after {
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 9px);
  left: 50%;
  z-index: 90;
  width: max-content;
  max-width: 180px;
  padding: 6px 8px;
  border: 1px solid rgba(17, 19, 22, 0.11);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.96);
  color: var(--list-graphite);
  box-shadow: 0 12px 24px rgba(17, 19, 22, 0.08);
  font-size: 10.5px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -2px);
  transition:
    opacity var(--mf-duration-standard, 180ms) var(--mf-ease),
    transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}

.dashboard-product-tab-soon:hover,
.dashboard-product-tab-soon:focus-visible {
  color: var(--list-graphite);
  outline: none;
}

.dashboard-product-tab-soon:hover::after,
.dashboard-product-tab-soon:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.measurement-list-actions {
  grid-area: actions;
  align-self: center;
  justify-self: end;
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.measurement-list-actions .auth-trigger.is-signed-in {
  max-width: 168px;
}

/* Trend taxonomy navigation lives in dashboard-category-navigation.css. */

body.dashboard-view .index-sort-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  width: auto;
  margin: 0;
}

body.dashboard-view .index-sort-buttons {
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(17, 19, 22, 0.085);
  border-radius: 12px;
  background: rgba(255, 254, 250, 0.64);
  box-shadow: none;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
  overflow-x: visible;
  scrollbar-width: none;
}

body.dashboard-view .index-sort-buttons::-webkit-scrollbar {
  display: none;
}

body.dashboard-view .index-sort-button {
  position: relative;
  flex: 0 0 auto;
  min-width: 40px;
  width: auto;
  height: 30px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--list-muted);
  box-shadow: none;
  font-family: var(--list-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  transition:
    background var(--mf-duration-standard, 180ms) var(--mf-ease),
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    color var(--mf-duration-standard, 180ms) var(--mf-ease),
    transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}

body.dashboard-view .index-sort-button:hover {
  border-color: rgba(17, 19, 22, 0.075);
  background: rgba(255, 255, 255, 0.58);
  color: var(--list-graphite);
  transform: translateY(-1px);
  box-shadow: none;
}

body.dashboard-view .index-sort-button:active {
  transform: translateY(0);
}

body.dashboard-view .index-sort-button.active {
  border-color: rgba(83, 191, 205, 0.48);
  background: rgba(235, 252, 255, 0.78);
  color: var(--list-graphite);
  box-shadow: none;
}

body.dashboard-view .range-custom {
  flex: 0 0 auto;
  justify-content: flex-end;
  flex-wrap: nowrap;
  margin-top: 0;
}

body.dashboard-view .range-custom-input,
body.dashboard-view .range-custom-apply {
  height: 30px;
  min-height: 30px;
  border-color: rgba(17, 19, 22, 0.095);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.86);
  color: var(--list-graphite);
  font-size: 12px;
}

body.dashboard-view .range-custom-input:focus {
  outline: none;
  border-color: rgba(83, 191, 205, 0.68);
  box-shadow: none;
}

body.dashboard-view .range-custom-apply {
  width: auto;
  min-width: 0;
  padding: 0 10px;
  font-family: var(--list-sans);
  font-weight: var(--mf-font-weight-semibold);
  letter-spacing: 0;
}

body.dashboard-view .range-custom-input {
  font-family: var(--list-sans);
  font-weight: var(--mf-font-weight-medium);
  letter-spacing: 0;
}

body.dashboard-view .range-custom-apply:hover {
  transform: translateY(-1px);
  box-shadow: none;
  border-color: rgba(83, 191, 205, 0.42);
  background: #f4fdff;
}

.measurement-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  width: 100%;
  margin-top: 0;
}

/* ── Trends list skeleton ─────────────────────────────────────────────────────────────────────────
   The list used to collapse to a single line of "Loading measurements..." on an otherwise blank page,
   so every category or range change blanked the whole grid and popped it back. That is the most
   repeated jarring change in the product — this is the surface users browse. These placeholders hold
   the card grid's shape while the fetch is in flight, so the layout no longer collapses and rebuilds.
   Shimmer and register match the .diff-skeleton / .mf-loading-line treatment already used elsewhere
   ("product register: skeletons, not spinners", per .diff-skeleton above). */
.measurement-skeleton {
  display: grid;
  grid-template-rows: 1fr auto;
  min-height: 232px;
  overflow: hidden;
  border: 1px solid var(--list-line);
  border-radius: 16px;
  background: rgba(255, 254, 250, 0.76);
  box-shadow: 0 14px 30px rgba(17, 19, 22, 0.04);
}
/* Mirrors .measurement-card-main's own columns/areas so the placeholder and the real card put their
   thumbnail, copy and sparkline in the same places — the swap moves nothing. */
.measurement-skeleton-main {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  grid-template-areas:
    "image copy"
    ".     spark";
  align-items: start;
  gap: 12px 15px;
  padding: 20px 20px 8px;
}
.measurement-skeleton-thumb { grid-area: image; width: 88px; aspect-ratio: 1; border-radius: 16px; }
.measurement-skeleton-copy { grid-area: copy; display: grid; gap: 9px; }
.measurement-skeleton-spark { grid-area: spark; height: 34px; margin-top: 10px; border-radius: 8px; }
.measurement-skeleton-dirs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0 20px 20px;
}
.measurement-skeleton-dir { height: 54px; border-radius: 12px; }
.mf-skel {
  background: linear-gradient(90deg, rgba(17, 19, 22, 0.06), rgba(116, 222, 235, 0.2), rgba(17, 19, 22, 0.06));
  background-size: 200% 100%;
  animation: mf-shimmer 1.2s linear infinite;
}
.mf-skel-line { height: 12px; border-radius: 999px; }

/* Detail hero skeleton. Columns and gap mirror .nav-detail-top's own three-column grid so the arriving
   page settles into this shape instead of replacing a blank screen. */
.nav-detail-skeleton {
  display: grid;
  grid-template-columns: 168px minmax(300px, 1fr) clamp(320px, 27vw, 390px);
  align-items: start;
  column-gap: clamp(20px, 2.4vw, 32px);
  margin: 3px 0 0;
  padding: 18px 0 0;
}
.nav-detail-skeleton-image { height: 195px; border-radius: 18px; }
.nav-detail-skeleton-id { display: grid; gap: 11px; min-width: 0; }
.nav-detail-skeleton-title { height: 30px; width: 68%; border-radius: 8px; }
.nav-detail-skeleton-id .mf-skel-line:nth-child(2) { width: 96%; }
.nav-detail-skeleton-id .mf-skel-line:nth-child(3) { width: 80%; }
.nav-detail-skeleton-meta { width: 44%; margin-top: 6px; }
.nav-detail-skeleton-val { display: grid; gap: 14px; }
.nav-detail-skeleton-dirs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.nav-detail-skeleton-dir { height: 66px; border-radius: 12px; }
.nav-detail-skeleton-cta { height: 46px; border-radius: 10px; }
@media (max-width: 1024px) {
  /* Matches the header's own stacking breakpoint. */
  .nav-detail-skeleton { grid-template-columns: 1fr; row-gap: 14px; }
  .nav-detail-skeleton-image { width: 96px; height: 96px; }
}

/* Uneven widths so the block reads as a title over wrapped description text rather than a bar chart. */
.measurement-skeleton-copy .mf-skel-line:nth-child(1) { width: 72%; }
.measurement-skeleton-copy .mf-skel-line:nth-child(2) { width: 92%; }
.measurement-skeleton-copy .mf-skel-line:nth-child(3) { width: 56%; }
@media (prefers-reduced-motion: reduce) {
  /* Keep the placeholder blocks — they are the layout, not decoration — but stop the travelling sheen. */
  .mf-skel { animation: none; }
}

.measurement-card {
  --spark-color: #65707a;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  /* Row 1 (image/title/desc/spark) absorbs whatever extra height the grid row-stretch gives this card
     over its neighbors (a longer, wrapped title mainly); row 2 (the direction buttons) always sits flush
     against the bottom, so the buttons line up across a row regardless of how many lines the title took. */
  grid-template-rows: 1fr auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--list-line);
  border-radius: 16px;
  background: rgba(255, 254, 250, 0.76);
  color: var(--list-ink);
  box-shadow: 0 14px 30px rgba(17, 19, 22, 0.04);
  cursor: pointer;
  transition:
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    background var(--mf-duration-standard, 180ms) var(--mf-ease),
    box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease),
    transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}

.measurement-card.pos {
  --direction-tone: #5f8782;
  --spark-color: #5f8782;
}

.measurement-card.neg {
  --direction-tone: #9b6971;
  --spark-color: #9b6971;
}

.measurement-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--list-cyan);
  opacity: 0;
  transition: opacity var(--mf-duration-standard, 180ms) var(--mf-ease);
}

.measurement-card:hover {
  border-color: rgba(83, 191, 205, 0.48);
  background: rgba(255, 254, 250, 0.92);
  box-shadow: 0 18px 34px rgba(17, 19, 22, 0.055);
  transform: translateY(-2px);
}

.measurement-card:hover::before {
  opacity: 1;
}

.measurement-card-main,
.measurement-directions {
  min-width: 0;
  padding: 20px;
}

.measurement-card-main {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  grid-template-rows: auto auto;
  grid-template-areas:
    "image copy"
    ". spark";
  align-items: start;
  gap: 12px 15px;
  padding-bottom: 8px;
}

.measurement-card-image {
  grid-area: image;
  width: 88px;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid rgba(17, 19, 22, 0.105);
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(116, 222, 235, 0.13), rgba(255, 254, 250, 0.72)),
    rgba(255, 254, 250, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.measurement-card-image.has-image {
  background: #f7f5ef;
}

.measurement-card-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Thumbnails are loading="lazy", so they arrive after the card has already painted and snap in. Fading
   them softens that. Deliberately an ANIMATION keyed off .img-ready rather than an `opacity: 0` floor
   released by the class: if the onload handler never fires, the default here is a fully visible image
   (today's behaviour), not an invisible one. A cosmetic fade must not be able to hide the artwork on
   the main browse surface. Token duration, so reduced-motion collapses it — carrying the literal fallback
   every design-system token reference in THIS file needs (see the :root alias block). */
.measurement-card-image.img-ready img,
.nav-topic-image.img-ready img {
  animation: mf-img-in var(--mf-duration-standard, 180ms) var(--mf-ease);
}
@keyframes mf-img-in {
  from { opacity: 0; }
}

.measurement-card-image-empty {
  border-style: dashed;
  opacity: 0.42;
}

.measurement-card-copy {
  grid-area: copy;
  min-width: 0;
  max-width: none;
}

.measurement-card-title {
  display: block;
  color: var(--list-graphite);
  font-family: var(--list-sans);
  font-size: 20px;
  font-weight: 650;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-decoration: none;
  text-wrap: balance;
}

.measurement-card-title:hover {
  color: #11687b;
}

.measurement-card-auto {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

/* Quieted for the list card — the rebalanced/created stamp is provenance, not a headline. The detail page's
   .nav-detail-top .detail-source-row usage (below, near .nav-topic-image) gets the same quiet treatment. */
.measurement-card-auto .measurement-auto-stamp {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--list-faint);
  font-weight: 500;
}

.measurement-card-auto .measurement-live-dot {
  width: 5px;
  height: 5px;
  background: var(--list-faint);
  box-shadow: none;
  animation: none;
}

.measurement-auto-stamp {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  min-width: 0;
  max-width: 100%;
  padding: 0 10px;
  border: 1px solid rgba(83, 191, 205, 0.34);
  border-radius: 999px;
  background: rgba(235, 252, 255, 0.68);
  color: #176273;
  font-family: var(--list-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.measurement-live-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--list-cyan);
  box-shadow: 0 0 0 0 rgba(116, 222, 235, 0.42);
  animation: measurement-live-pulse 2.4s ease-out infinite;
}

/* The live dot pulses forever beside "Rebalanced Nh ago" on every Trends card and on the detail page, and
   had no reduced-motion cover — an unbounded decorative loop is exactly what the preference exists to stop.
   The stamp's text carries the meaning on its own, so dropping the pulse costs no information. */
@media (prefers-reduced-motion: reduce) {
  .measurement-live-dot { animation: none; }
}

@keyframes measurement-live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(116, 222, 235, 0.42); }
  70% { box-shadow: 0 0 0 7px rgba(116, 222, 235, 0); }
  100% { box-shadow: 0 0 0 0 rgba(116, 222, 235, 0); }
}

.measurement-card-desc {
  display: -webkit-box;
  margin: 8px 0 0;
  overflow: hidden;
  color: var(--list-muted);
  font-family: var(--list-sans);
  font-size: 13.5px;
  line-height: 1.38;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.measurement-card-spark {
  grid-area: spark;
  align-self: start;
  justify-self: center;
  width: min(100%, 360px);
  min-width: 0;
  height: 52px;
  margin: 8px 0 2px;
  opacity: 0.72;
  pointer-events: none;
}

.measurement-card-spark .spark {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.measurement-card-spark .spark path {
  stroke-width: 1.45;
}

.measurement-card-spark.is-empty {
  opacity: 0;
}

.measurement-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.measurement-card-meta > span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  min-width: 0;
  max-width: 100%;
  padding: 0 9px;
  border: 1px solid var(--list-line);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.8);
  color: var(--list-muted);
  font-family: var(--list-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
}

.measurement-list {
  gap: 16px;
}

.measurement-card {
  border-color: rgba(17, 19, 22, 0.115);
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.94), rgba(255, 254, 250, 0.78)),
    rgba(255, 254, 250, 0.88);
  box-shadow:
    0 18px 36px rgba(17, 19, 22, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.68);
}

.measurement-card::before {
  width: 2px;
  opacity: 0;
}

.measurement-card:hover::before {
  opacity: 0.82;
}

.measurement-card-main {
  grid-template-columns: 88px minmax(0, 1fr);
  grid-template-areas:
    "image copy"
    "spark spark";
  gap: 12px 15px;
  padding: 18px 18px 9px;
}

.measurement-card-image {
  width: 88px;
  border-radius: 16px;
}

.measurement-card-title {
  font-size: 19px;
  line-height: 1.08;
}

.measurement-card-auto {
  margin-top: 7px;
}

.measurement-card-desc {
  margin-top: 9px;
  color: rgba(83, 94, 104, 0.9);
  line-height: 1.46;
}

.measurement-card-meta {
  margin-top: 9px;
}

.measurement-card-spark {
  position: relative;
  justify-self: stretch;
  width: 100%;
  height: 50px;
  margin: 5px 0 0;
  opacity: 0.82;
}

.measurement-card-spark .spark {
  height: 48px;
}

.market-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  min-width: 0;
  max-width: 100%;
  padding: 0 9px;
  border: 1px solid rgba(17, 19, 22, 0.085);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.72);
  color: rgba(103, 113, 121, 0.86);
  font-family: var(--list-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
  white-space: nowrap;
}

.market-source-prefix {
  display: inline;
}

.market-source-logo {
  display: block;
  width: auto;
  height: 14px;
  max-width: 94px;
  filter: brightness(0) saturate(100%);
  opacity: 0.68;
}

.measurement-directions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  position: relative;
  align-content: stretch;
  gap: 0;
  padding: 3px;
  border: 0;
  border-radius: 13px;
  background: rgba(17, 19, 22, 0.045);
  box-shadow: inset 0 1px 2px rgba(17, 19, 22, 0.05);
}

.measurement-direction-frame {
  position: relative;
  margin: 0 18px 18px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
}

.measurement-dir-option {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "name"
    "value";
  grid-template-rows: auto auto;
  align-items: start;
  gap: 0;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  padding: 10px 13px 11px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--list-muted);
  box-shadow: none;
  overflow: hidden;
  text-align: left;
  text-transform: none;
  cursor: pointer;
  transition:
    background var(--mf-duration-standard, 180ms) var(--mf-ease),
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease);
}

.measurement-dir-option::before,
.measurement-dir-option::after {
  content: none;
}

.measurement-dir-option:hover:not(:disabled) {
  border-color: transparent;
  background: rgba(255, 254, 250, 0.5);
}

.measurement-dir-option.active {
  border-color: rgba(17, 19, 22, 0.05);
  background: var(--list-panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 1px 2px rgba(17, 19, 22, 0.045),
    0 4px 10px rgba(17, 19, 22, 0.06);
}

.measurement-dir-option.short .measurement-dir-name,
.measurement-dir-option.short .measurement-dir-value {
  justify-self: start;
  padding-left: 0;
  text-align: left;
}

.measurement-dir-name {
  grid-area: name;
  overflow: hidden;
  justify-self: start;
  padding-right: 0;
  color: var(--list-faint);
  font-family: var(--list-sans);
  font-size: 12px;
  font-weight: 620;
  letter-spacing: 0.01em;
  line-height: 1.08;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  text-overflow: clip;
  white-space: normal;
  text-align: left;
  transition: color var(--mf-duration-standard, 180ms) var(--mf-ease);
}

.measurement-dir-option.active .measurement-dir-name {
  color: var(--list-muted);
  font-weight: 660;
}

.measurement-dir-value {
  grid-area: value;
  justify-self: start;
  margin-top: 3px;
  color: var(--list-graphite);
  font-family: var(--list-sans);
  font-size: 24px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: left;
  font-variant-numeric: tabular-nums;
  transition:
    color var(--mf-duration-standard, 180ms) var(--mf-ease),
    font-weight var(--mf-duration-standard, 180ms) var(--mf-ease);
}

.measurement-dir-value.pos {
  color: var(--list-pos);
}

.measurement-dir-value.neg {
  color: var(--list-neg);
}

.measurement-dir-option:not(.active) .measurement-dir-value {
  color: var(--list-muted);
  font-weight: 560;
  opacity: 1;
}

@media (max-width: 1240px) {
  .measurement-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .measurement-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  body.dashboard-view main {
    width: min(100% - 24px, 1420px);
    padding-top: 24px;
  }
  .measurement-list-hero-inner {
    gap: 14px;
  }
  .measurement-list-logo {
    width: 174px;
  }
  .dashboard-product-tabs {
    justify-self: center;
  }
  body.dashboard-view .index-sort-toolbar {
    justify-content: flex-start;
  }
  body.dashboard-view .range-custom {
    justify-content: flex-start;
  }
  .measurement-card {
    grid-template-columns: 1fr;
  }
  .measurement-dir-value {
    font-size: 22px;
  }
}

@media (max-width: 760px) {
  .measurement-list-hero-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "logo actions"
      "tabs tabs";
    gap: 12px 14px;
  }
  .dashboard-product-tabs {
    justify-self: center;
  }
}

@media (max-width: 520px) {
  .measurement-list-hero-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "logo actions"
      "tabs tabs";
    align-items: center;
    gap: 12px 10px;
  }
  .measurement-list-logo {
    width: 142px;
    max-width: 100%;
  }
  .measurement-list-actions {
    align-self: center;
    justify-self: end;
    max-width: min(190px, 52vw);
  }
  .measurement-list-actions .auth-shell,
  .measurement-list-actions .auth-shell-view,
  .measurement-list-actions .auth-trigger {
    max-width: 100%;
  }
  .dashboard-product-tabs {
    justify-self: stretch;
    width: 100%;
  }
  .dashboard-product-tab {
    flex: 1 1 0;
    min-width: 0;
  }
  body.dashboard-view .index-sort-buttons {
    width: 100%;
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .category-filter-toolbar,
  .category-filter-buttons,
  .category-minor-filter-toolbar,
  .category-minor-filter-buttons {
    width: 100%;
  }
  body.dashboard-view .index-sort-button {
    width: auto;
    flex: 0 0 auto;
  }
  body.dashboard-view .range-custom {
    flex: 1 0 100%;
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
    margin-top: 4px;
  }
  .measurement-dir-option {
    padding: 9px 11px 10px;
  }
  .measurement-dir-value {
    font-size: 20px;
  }
  .measurement-card-main {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 0 12px;
  }
  .measurement-card-image {
    width: 64px;
    border-radius: 13px;
  }
}

/* NAV card — reuses the idx-row grid; the value column is a plain $ readout (no gauge). */
.nav-scale { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.nav-flags { font: 11px var(--mono); color: var(--text-faint); text-transform: none; }
.nav-pole { font-size: 12px; margin-top: 3px; line-height: 1.35; }
.nav-row-value { justify-content: center; gap: 2px; }
.nav-val { font-family: var(--mono); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.idx-card .nav-val { font-size: 22px; margin: 0; }
.nav-row-value .scale-badge { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.nav-row-value .idx-gauge-change { position: static; transform: none; margin-top: 2px; }

.nav-hero { display: flex; flex-direction: column; align-items: flex-end; text-align: right; gap: 4px; }
.nav-hero-value { font-family: var(--mono); font-weight: 600; font-size: 40px; line-height: 1; margin: 0; font-variant-numeric: tabular-nums; color: var(--text); }
.nav-hero .idx-gauge-change { position: static; transform: none; font-size: 13px; width: auto; text-align: right; }
.nav-hero-scale { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.detail-usdc-money {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  /* No gap — since the icon is now a plain "$" glyph (not a distinct coin graphic), it should sit flush
     against the number like normal currency notation ("$0.41", not "$ 0.41"). */
  gap: 0;
  color: currentColor;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  white-space: nowrap;
}
.detail-usdc-icon {
  flex: 0 0 auto;
  line-height: 1;
}
.nav-hero-usdc {
  gap: 9px;
}

/* NAV facet-composition cards — the stable skeleton. Own card language (not borrowed): --panel/--border-soft/
   --r/--deck-shadow match every other card on the page (.idx-card, #empty), where the retired .xv-basis-card
   this used to reuse had drifted onto its own --bg-soft/--border/hardcoded-radius, no-shadow treatment. */
.nav-facet-title { margin-top: 26px; }
.nav-facet-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.nav-facet-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  box-shadow: var(--deck-shadow);
}
.nav-facet-head {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 14.5px;
  line-height: 1.35;
  color: var(--text);
}
.nav-facet-rule {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
}
.nav-facet-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nav-facet-members { font-size: 11.5px; color: var(--text-faint); }
/* A thin rule separates the editorial facts above (label, rule, held side, member count — the stable
   skeleton) from the live stats below (weight, $ value) — the same "stable vs. live" split the rest of the
   page draws between the facet skeleton and the daily-marked holdings table. */
.nav-facet-stats {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
}
.nav-facet-weight-col { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.nav-facet-weight {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
}
.nav-facet-weight-label {
  margin-left: 5px;
  font-size: 10.5px;
  font-weight: 400;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.nav-facet-weight-bar {
  width: 100%;
  max-width: 130px;
  height: 3px;
  border-radius: 999px;
  background: var(--border-soft);
  overflow: hidden;
}
.nav-facet-weight-bar span { display: block; height: 100%; background: var(--accent-3); border-radius: inherit; }
.nav-facet-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}

/* NAV holdings table — reuses .tbl; facet column + a min-width so it scrolls on narrow screens. */
.nav-tbl { table-layout: auto; }
.nav-tbl .nav-col-facet { color: var(--text-dim); text-align: left; }
.nav-facet-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav-chart-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.nav-chart-note { padding: 20px 16px; }
.nav-chart-rebase-note { font-family: var(--mono); font-size: 12px; margin: 6px 0 0; }
.nav-chart-rebase-note .detail-usdc-money {
  vertical-align: -2px;
}

/* Formal Measurement Detail layout. */
/* The 96px vertical hairline grid is gone: fifteen full-height rules were the single largest line-area on the
   page, and once the ground carries a real value step the panels no longer need a ruled field behind them to
   read as objects. DESIGN.md 4.5/4.6 amended alongside this (hairlines-create-structure, and the grid as
   background signature) — approved rather than assumed. */
body.detail-view,
body.portfolio-view {
  background: var(--mf-color-canvas, #f6f5f2);
}

body.detail-view main,
body.portfolio-view main {
  width: min(1200px, calc(100% - 64px));
  padding: 46px 0 64px;
}

/* Portfolio keeps the header/product tabs (it is a tab, not a drill-down) but hides the trends surface. */
body.portfolio-view main { padding-top: 8px; }
body.portfolio-view #dashboard { display: none; }

body.detail-view #detail,
body.portfolio-view #detail {
  --detail-graphite: var(--mf-text-strong, #111316);
  --detail-ink: var(--mf-text-primary, #1b2026);
  --detail-muted: var(--mf-text-secondary, #65707a);
  --detail-faint: var(--mf-text-disabled, #9aa3ad);
  --detail-paper: var(--mf-surface-subtle, #f6f7f4);
  --detail-panel: var(--mf-surface-panel, #fffefa);
  --detail-line: var(--mf-border-subtle, rgba(17, 19, 22, 0.105));
  --detail-line-strong: var(--mf-border-default, rgba(17, 19, 22, 0.18));
  --detail-cyan: var(--mf-signal-accent, #74deeb);
  --detail-cyan-soft: var(--mf-color-accent-soft, rgba(116, 222, 235, 0.18));
  --detail-chart-line: var(--mf-chart-line, #61777d);
  --detail-chart-line-prior: var(--mf-chart-line-prior, rgba(101, 112, 122, 0.52));
  --detail-chart-area: var(--mf-chart-area, rgba(116, 222, 235, 0.13));
  --detail-chart-paper: var(--mf-chart-paper, #fbfcfa);
  --detail-chart-ink: var(--mf-chart-ink, #182026);
  --detail-chart-muted: var(--mf-chart-muted, #59666d);
  --detail-chart-faint: var(--mf-chart-faint, #909a9f);
  --detail-chart-rule: var(--mf-chart-rule, rgba(24, 32, 38, 0.10));
  --detail-chart-rule-strong: var(--mf-chart-rule-strong, rgba(24, 32, 38, 0.28));
  --detail-chart-area-pos: var(--mf-chart-area-positive, rgba(22, 135, 101, 0.075));
  --detail-chart-area-neg: var(--mf-chart-area-negative, rgba(200, 82, 97, 0.07));
  --detail-pos: var(--mf-status-positive, #168765);
  --detail-neg: var(--mf-status-negative, #c85261);
  --detail-shadow: var(--mf-shadow-detail, 0 22px 54px rgba(17, 19, 22, 0.065));
  --detail-label: rgba(77, 88, 99, 0.86);
  --detail-copy-muted: rgba(101, 112, 125, 0.86);
  --detail-copy-soft: rgba(101, 112, 125, 0.74);
  --detail-sans: var(--mf-font-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  --detail-mono: var(--mf-font-mono, "SF Mono", Menlo, Consolas, monospace);
  color: var(--detail-ink);
  font-family: var(--detail-sans);
  font-variant-numeric: normal;
}

:where(body.detail-view #detail) :where(button, input, select, textarea),
:where(body.portfolio-view #detail) :where(button, input, select, textarea) {
  font-family: var(--detail-sans);
}

body.detail-view #detail .crumb {
  color: var(--detail-muted);
  font-family: var(--detail-sans);
  font-size: 12.5px;
  font-weight: 560;
  letter-spacing: 0;
}

body.detail-view #detail .crumb a {
  color: var(--detail-graphite);
  border-bottom-color: rgba(17, 19, 22, 0.22);
}

body.detail-view #detail .crumb a:hover {
  color: var(--detail-graphite);
  border-bottom-color: rgba(17, 19, 22, 0.62);
}

body.detail-view #detail .back-link {
  height: 30px;
  padding: 0 10px;
  border-color: var(--detail-line);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.68);
  color: var(--detail-label);
  font-family: var(--detail-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
}

body.detail-view #detail .back-link:hover {
  background: var(--detail-panel);
}

body.detail-view #detail .constituents-head,
body.detail-view #detail .diff-row-head,
body.detail-view #detail .recomp-summary,
body.detail-view #detail .status-badge,
body.detail-view #detail .resolved-badge {
  text-transform: none;
  letter-spacing: 0;
}

body.detail-view #detail .status-badge,
body.detail-view #detail .resolved-badge {
  border-radius: 0;
  font-family: var(--detail-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
}

.nav-screen {
  min-width: 0;
  min-height: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.nav-screen-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
}
.nav-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 15px;
  min-width: 0;
  padding: 0;
}
.nav-detail-logo {
  display: inline-flex;
  align-items: center;
  width: 188px;
  height: auto;
  border-bottom: 0;
  text-decoration: none;
}
.crumb .nav-detail-logo,
.crumb .nav-detail-logo:hover {
  border-bottom: 0;
}
.nav-detail-logo img {
  display: block;
  width: 100%;
  height: auto;
}
@media (max-width: 820px) {
  .nav-detail-logo {
    width: 174px;
  }
}
.detail-brand-row {
  position: relative;
  z-index: 70;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.auth-shell-detail {
  margin-left: auto;
}
.detail-back-row {
  grid-area: back;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin: 0;
}
/* Three columns now, not two: the topic image sits beside the identity text rather than nested inside it, so
   it can stretch (align-items:stretch) to match whichever of the OTHER two columns is taller — in practice
   almost always the Theme Direction column, since its content (two fixed labels, a switch, a Buy button)
   barely varies, while identity text does. That is what keeps the image's bottom edge flush with the Buy
   button's without a hardcoded height: the image has no intrinsic height opinion of its own to fight with. */
.nav-detail-top {
  display: grid;
  grid-template-columns: 168px minmax(300px, 1fr) clamp(320px, 27vw, 390px);
  grid-template-areas:
    "back  back     ."
    "image identity val";
  align-items: stretch;
  column-gap: clamp(20px, 2.4vw, 32px);
  row-gap: 8px;
  margin: 3px 0 0;
  padding: 18px 0 0;
}
.nav-detail-top .detail-id {
  grid-area: identity;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "name"
    "desc"
    "source"
    "position"
    "prov";
  align-items: start;
  min-width: 0;
}
.nav-detail-top .detail-name {
  grid-area: name;
  margin: 0;
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 32px;
  font-weight: 590;
  letter-spacing: -0.015em;
  line-height: 1.05;
}
.nav-detail-top .nav-pole {
  grid-area: pole;
  align-self: start;
  width: max-content;
  max-width: 100%;
  margin-top: 2px;
  border-color: var(--detail-line);
  background: rgba(255, 254, 250, 0.66);
  color: var(--detail-muted);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.055em;
  text-transform: none;
}
.nav-detail-top .detail-desc-wrap {
  grid-area: desc;
  margin: 8px 0 0;
}
.nav-detail-top .detail-desc {
  margin: 0;
  color: var(--detail-muted);
  font-family: var(--detail-sans);
  font-size: 14.5px;
  line-height: 1.48;
}
.detail-desc-wrap.is-collapsed .detail-desc {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}
.detail-desc-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  margin: 6px 0 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
.detail-desc-toggle:hover {
  transform: none;
  box-shadow: none;
  text-decoration: underline;
}
.detail-desc-toggle:active {
  transform: none;
}
.nav-detail-top .detail-source-row {
  grid-area: source;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-self: start;
  gap: 7px;
  min-width: 0;
  margin-top: 10px;
}
.nav-detail-top .market-source-badge {
  grid-area: source;
  justify-self: start;
  margin-top: 10px;
  border-color: rgba(88, 99, 108, 0.13);
  background: rgba(255, 254, 250, 0.54);
  color: rgba(103, 113, 121, 0.9);
  font-family: var(--detail-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
}
.nav-detail-top .detail-source-row .market-source-badge,
.nav-detail-top .detail-source-row .measurement-auto-stamp {
  grid-area: auto;
  margin-top: 0;
}
.nav-detail-top .detail-source-row .measurement-auto-stamp {
  font-family: var(--detail-sans);
  /* Quieted to match the dashboard card's stamp — provenance, not a headline. */
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--detail-faint);
  font-weight: 500;
}
.nav-detail-top .detail-source-row .measurement-live-dot {
  width: 5px;
  height: 5px;
  background: var(--detail-faint);
  box-shadow: none;
  animation: none;
}
.nav-owned-position-host {
  grid-area: position;
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: calc(620px + 64px + 15px);
  margin-top: 12px;
}
.nav-owned-position-host[hidden] {
  display: none;
}
.nav-owned-position {
  --owned-position-tone: var(--mf-pos);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto 18px;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 52px;
  padding: 8px 10px 8px 12px;
  border: 1px solid rgba(17, 19, 22, 0.12);
  border-left: 3px solid var(--owned-position-tone);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.82);
  color: var(--detail-ink);
  font-family: var(--detail-sans);
  text-decoration: none;
  transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease), background-color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.nav-owned-position:hover {
  border-color: rgba(17, 19, 22, 0.22);
  border-left-color: var(--owned-position-tone);
  background: #fffefa;
}
.nav-owned-position:focus-visible {
  outline: 2px solid var(--detail-cyan);
  outline-offset: 2px;
}
.nav-owned-position[data-position-tone="building"] { --owned-position-tone: #a8641f; }
.nav-owned-position[data-position-tone="rebalancing"] { --owned-position-tone: #2775ca; }
.nav-owned-position[data-position-tone="attention"] { --owned-position-tone: var(--mf-neg); }
.nav-owned-position[data-position-tone="closed"],
.nav-owned-position[data-position-tone="neutral"] { --owned-position-tone: var(--detail-faint); }
.nav-owned-position-main,
.nav-owned-position-value {
  display: grid;
  gap: 3px;
  min-width: 0;
}
.nav-owned-position-main small,
.nav-owned-position-value small {
  color: var(--detail-faint);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
}
.nav-owned-position-main strong {
  overflow: hidden;
  color: var(--detail-ink);
  font-size: 13.5px;
  font-weight: 590;
  letter-spacing: 0;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-owned-position[data-position-direction="long"] .nav-owned-position-main strong { color: var(--mf-pos); }
.nav-owned-position[data-position-direction="short"] .nav-owned-position-main strong { color: var(--mf-neg); }
.nav-owned-position-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--detail-muted);
  font-size: 12px;
  font-weight: 560;
  line-height: 1;
  white-space: nowrap;
}
.nav-owned-position-status i {
  width: 6px;
  height: 6px;
  flex: none;
  border-radius: 50%;
  background: var(--owned-position-tone);
}
.nav-owned-position-value {
  justify-items: end;
  padding-left: 12px;
  border-left: 1px solid rgba(17, 19, 22, 0.1);
}
.nav-owned-position-amount {
  color: var(--detail-ink);
  font-family: var(--detail-mono);
  font-size: 13.5px;
  font-weight: 600;
}
.nav-owned-position .nav-owned-position-amount .mf-usdc-icon {
  width: 13px;
  height: 13px;
}
.nav-owned-position-arrow {
  display: inline-flex;
  align-items: center;
  color: var(--detail-faint);
}
.nav-owned-position-arrow svg {
  width: 18px;
  height: 11px;
}
@media (max-width: 640px) {
  .nav-owned-position {
    grid-template-columns: minmax(0, 1fr) auto 18px;
    gap: 8px 10px;
  }
  .nav-owned-position-value {
    grid-column: 1 / 3;
    justify-items: start;
    padding: 0;
    border-left: 0;
  }
  .nav-owned-position-arrow {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}
/* No aspect-ratio: giving it one would make WIDTH follow the stretched height, and that width then eats into
   the identity-text column's own space — which can wrap the title/description onto more lines, growing the
   row, growing the image, growing the row again. A fixed column width (168px, set on .nav-detail-top above)
   breaks that loop; only height responds to the row. */
.nav-detail-top .nav-topic-image { grid-area: image; align-self: stretch; }
.nav-topic-image {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--detail-line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(116, 222, 235, 0.10), rgba(255, 254, 250, 0.72)),
    rgba(255, 254, 250, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}
.nav-topic-image.has-image {
  background: var(--detail-panel);
}
/* position:absolute + inset:0, not width/height:100% in normal flow: a percentage height on the <img> can't
   resolve until the grid row's own auto-size is known, and the row's auto-size (in the "image" track) needs
   the img's contribution — a real circular dependency. Percentage-height resolution failing mid-cycle falls
   back to the img's OWN intrinsic aspect ratio (whatever photo happens to be loaded), which silently
   overrode the fixed 168px column and made .nav-detail-top's row taller than Theme Direction actually needs
   — a few pixels in some cases, tens of pixels with a very tall/narrow source photo. Taking the img out of
   flow removes it from that sizing pass entirely; .nav-topic-image (position:relative) is the sized box. */
.nav-topic-image img {
  display: block;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.nav-topic-image-empty {
  display: block;
  border-style: dashed;
  opacity: 0.52;
  pointer-events: none;
}
.nav-detail-val {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  gap: 0;
  grid-area: val;
  align-self: start;
}
.nav-detail-val .nav-hero-slot {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.nav-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 31px;
  min-width: 0;
}
.nav-section-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.nav-section-head h2 {
  margin: 0;
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: 0;
  text-transform: none;
}
.nav-section-head > span {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(17, 19, 22, 0.09);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.84);
  color: var(--detail-label);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-align: right;
}
.nav-direction-panel {
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  justify-self: end;
  gap: 11px;
  height: auto;
  width: min(100%, 500px);
}

.nav-direction-frame {
  position: relative;
  padding: 0;
  border: 0;
  border-radius: 14px;
  background: transparent;
}

.nav-dir-switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
  gap: 0;
  padding: 4px;
  border: 0;
  border-radius: 14px;
  background: rgba(17, 19, 22, 0.045);
  box-shadow: inset 0 1px 2px rgba(17, 19, 22, 0.05);
}

.nav-dir-switch-btn {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "copy copy"
    "value price";
  grid-template-rows: auto auto;
  align-items: start;
  align-content: start;
  gap: 3px;
  min-width: 0;
  min-height: 0;
  height: auto;
  overflow: hidden;
  padding: 14px 18px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--detail-muted);
  box-shadow: none;
  text-align: left;
  text-transform: none;
  cursor: pointer;
  transition:
    background var(--mf-duration-standard, 180ms) var(--mf-ease),
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.nav-dir-switch-btn::before,
.nav-dir-switch-btn::after {
  content: none;
}
.nav-dir-switch-btn:hover:not(:disabled) {
  border-color: transparent;
  background: rgba(255, 254, 250, 0.5);
}
.nav-dir-switch-btn:active:not(:disabled) {
  transform: scale(0.99);
}
.nav-dir-switch-btn.long.active,
.nav-dir-switch-btn.short.active {
  color: var(--detail-graphite);
  border-color: rgba(17, 19, 22, 0.05);
  background: var(--detail-panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 1px 2px rgba(17, 19, 22, 0.045),
    0 4px 10px rgba(17, 19, 22, 0.06);
}
.nav-dir-copy {
  grid-area: copy;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  padding: 0;
  text-align: left;
  z-index: 1;
}

.nav-dir-switch-btn.short .nav-dir-copy {
  justify-content: flex-start;
  text-align: left;
}

.nav-dir-label {
  color: var(--detail-faint);
  font-family: var(--detail-sans);
  font-size: 13px;
  font-weight: 620;
  line-height: 1.15;
  letter-spacing: 0.01em;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  transition: color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.nav-dir-switch-btn.active .nav-dir-label {
  color: var(--detail-muted);
  font-weight: 660;
}
.nav-dir-value {
  grid-area: value;
  justify-self: start;
  align-self: baseline;
  /* min-width:0 lets this grid item actually shrink to its track instead of overflowing into the price
     column beside it (the grid default is to never size below content — the classic overlap trap); nowrap
     +hidden is a safety net for an unusually wide percentage, not something normal values should ever hit. */
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  margin: 4px 0 0;
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 22px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.01em;
  text-align: left;
  font-variant-numeric: tabular-nums;
  z-index: 1;
  transition:
    color var(--mf-duration-standard, 180ms) var(--mf-ease),
    font-weight var(--mf-duration-standard, 180ms) var(--mf-ease);
}

.nav-dir-switch-btn.short .nav-dir-value {
  justify-self: start;
  text-align: left;
}

.nav-dir-value.pos { color: var(--detail-pos); }
.nav-dir-value.neg { color: var(--detail-neg); }

.nav-dir-switch-btn:not(.active) .nav-dir-value {
  color: var(--detail-muted);
  font-weight: 560;
  opacity: 1;
}
/* Share price is deliberately quiet — the % change stays the number your eye lands on first. No pos/neg
   tint here (that signal already lives on .nav-dir-value); this is just "what a share costs right now". */
.nav-dir-price {
  grid-area: price;
  justify-self: end;
  align-self: baseline;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  margin: 4px 0 0;
  color: var(--detail-faint);
  font-family: var(--detail-sans);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.2;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.nav-analysis-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(320px, 27vw, 390px);
  align-items: stretch;
  gap: clamp(28px, 3.4vw, 52px);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
}
.nav-chart-panel,
.nav-driver-panel {
  min-width: 0;
}
.nav-chart-panel {
  padding-top: 14px;
  border-top: 0;
}
.nav-chart-head {
  align-items: end;
  min-height: 58px;
  margin: 0 0 12px;
}
.nav-chart-title-block {
  min-width: min(100%, 430px);
}
.nav-chart-title-block h2 {
  margin: 0;
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.15;
  text-transform: none;
}
.nav-chart-subtitle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 5px 0 0;
  color: var(--detail-chart-muted);
  font-family: var(--detail-sans);
  font-size: 12px;
  font-weight: 520;
  line-height: 1.2;
}
/* The value is deliberately just a quiet secondary number next to the chart title — the direction switcher
   in the header owns the % change and stays the page's top visual priority. Its color tracks pos/neg the same
   way the chart line and direction switcher do (gain vs. the window-open baseline); scrubbing the chart or
   focusing a Key Event repaints both the number and its color for that specific point. */
.nav-chart-value-amount {
  color: var(--detail-graphite);
  font-weight: 660;
  transition: color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.nav-chart-value-amount.pos { color: var(--detail-pos); }
.nav-chart-value-amount.neg { color: var(--detail-neg); }
.nav-chart-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
  margin-left: auto;
}
.nav-chart-rebase-note {
  display: none;
}
.nav-chart-layout {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 0;
}
/* Methodology footnote, not a headline — quiet caption below the chart rather than a second paragraph. */
.nav-chart-continuity {
  margin: 10px 0 0;
  color: var(--detail-faint);
  font-family: var(--detail-sans);
  font-size: 11px;
  line-height: 1.4;
}
.nav-chart-panel .chart-range {
  gap: 2px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--detail-chart-rule-strong);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  flex-wrap: nowrap;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-chart-panel .chart-range::-webkit-scrollbar {
  display: none;
}
.nav-chart-panel .chart-range-button {
  position: relative;
  flex: 0 0 auto;
  min-width: 38px;
  height: 34px;
  min-height: 34px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--detail-muted);
  font-family: var(--detail-sans);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-font-weight-semibold);
  letter-spacing: 0.03em;
  transition:
    background var(--mf-duration-standard, 180ms) var(--mf-ease),
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    color var(--mf-duration-standard, 180ms) var(--mf-ease),
    transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.nav-chart-panel .chart-range-button:hover {
  border-bottom-color: var(--detail-chart-rule-strong);
  background: transparent;
  color: var(--detail-graphite);
  transform: none;
}
.nav-chart-panel .chart-range-button:active {
  transform: translateY(0);
}
.nav-chart-panel .chart-range-button:focus-visible {
  /* Inset (not the site-wide default 2px outset) so keyboard focus never gets clipped into a stray line by
     this row's horizontal scroll — the ring stays fully inside the button regardless of scroll position. */
  outline: 2px solid var(--detail-cyan);
  outline-offset: -2px;
}
.nav-chart-panel .chart-range-button.active {
  border-bottom-color: var(--detail-cyan);
  background: transparent;
  box-shadow: none;
  color: var(--detail-graphite);
}
.nav-chart-panel .range-custom {
  flex: 0 0 auto;
  margin: 0;
  gap: 6px;
  flex-wrap: nowrap;
  color: var(--detail-copy-soft);
}
.nav-chart-panel .range-custom-input,
.nav-chart-panel .range-custom-apply {
  height: 30px;
  min-height: 30px;
  border-color: rgba(17, 19, 22, 0.095);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.86);
  color: var(--detail-graphite);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}
.nav-chart-panel .range-custom-input {
  width: 108px;
  padding: 0 8px;
  font-family: var(--detail-sans);
}
.nav-chart-panel .range-custom-apply {
  width: auto;
  min-width: 0;
  padding: 0 9px;
  font-family: var(--detail-sans);
  font-weight: var(--mf-font-weight-semibold);
}
.nav-chart-panel .range-custom-sep {
  color: var(--detail-copy-soft);
  font-size: 11px;
}
.nav-chart-panel .range-custom-input:focus {
  border-color: rgba(83, 191, 205, 0.72);
  box-shadow: none;
}
.nav-chart-panel .range-custom-apply:hover {
  box-shadow: none;
  border-color: rgba(83, 191, 205, 0.42);
  background: #f4fdff;
  transform: translateY(-1px);
}
@media (max-width: 620px) {
  .nav-chart-controls {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
  .nav-chart-panel .chart-range {
    width: 100%;
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .nav-chart-panel .range-custom {
    flex: 1 0 100%;
    width: 100%;
    justify-content: flex-start;
    margin-top: 4px;
  }
}
.nav-chart-frame {
  position: relative;
  min-width: 0;
}
.nav-chart-frame .chart-wrap {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}
.nav-chart-frame .chart {
  height: 288px;
}
.nav-chart-frame .chart .line {
  stroke: var(--detail-chart-line);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.05;
  opacity: 0.96;
  vector-effect: non-scaling-stroke;
}
.nav-chart-frame .chart .nav-window-line.pos { stroke: var(--detail-pos); }
.nav-chart-frame .chart .nav-window-line.neg { stroke: var(--detail-neg); }
.nav-chart-frame .chart .line.prior {
  stroke: var(--detail-chart-line-prior);
  stroke-width: 1.35;
  opacity: 1;
}
.nav-chart-frame .chart .area {
  fill: transparent;
  opacity: 1;
}
.nav-chart-frame .chart .nav-window-area.pos { fill: var(--detail-chart-area-pos); }
.nav-chart-frame .chart .nav-window-area.neg { fill: var(--detail-chart-area-neg); }
.nav-chart-frame .chart .area.prior {
  opacity: 0.38;
}
.nav-chart-frame .chart .dot {
  fill: var(--detail-panel);
  stroke: var(--detail-chart-line);
  stroke-width: 1.65;
  vector-effect: non-scaling-stroke;
}
.nav-chart-frame .chart .dot.pos { stroke: var(--detail-pos); }
.nav-chart-frame .chart .dot.neg { stroke: var(--detail-neg); }
.nav-chart-frame .chart .nav-window-baseline {
  stroke: var(--detail-chart-rule-strong);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.nav-chart-frame .chart .nav-window-start-dot,
.nav-chart-frame .chart .nav-window-end-dot {
  fill: var(--detail-chart-paper);
  stroke: var(--detail-chart-line);
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
}
.nav-chart-frame .chart .nav-window-end-dot.pos { stroke: var(--detail-pos); }
.nav-chart-frame .chart .nav-window-end-dot.neg { stroke: var(--detail-neg); }
/* Only the empty-state "1 tick in this window" hint still uses this — every other tick/gridline/axis label
   was removed for a Robinhood-style bare line (the exact date/value now only ever surfaces on hover). */
.nav-chart-frame .chart .xtick {
  fill: var(--detail-copy-soft);
  font: 10.5px var(--detail-mono);
  letter-spacing: 0;
}
body.detail-view #tip.tip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 16px;
  min-width: 196px;
  max-width: min(280px, calc(100vw - 24px));
  padding: 11px 14px;
  border: 1px solid rgba(17, 19, 22, 0.07);
  border-radius: 12px;
  background: var(--detail-panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.75),
    0 1px 2px rgba(17, 19, 22, 0.05),
    0 14px 30px rgba(17, 19, 22, 0.11);
  color: var(--detail-chart-ink);
  white-space: normal;
}
body.detail-view #tip.tip.hidden { display: none; }
body.detail-view #tip.tip time {
  grid-column: 1;
  color: var(--detail-chart-faint);
  font-family: var(--detail-sans);
  font-size: 11px;
  font-weight: 560;
  letter-spacing: 0.005em;
}
body.detail-view #tip.tip .tip-measurement {
  grid-column: 1;
  overflow: hidden;
  color: var(--detail-chart-muted);
  font-family: var(--detail-sans);
  font-size: 11.5px;
  font-weight: 610;
  text-overflow: ellipsis;
  white-space: nowrap;
}
body.detail-view #tip.tip .tip-value {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  justify-self: end;
  font-family: var(--detail-sans);
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.012em;
}
/* Key Events — an append-only news/result history. Events stay out of the chart until a list interaction asks
   for one focus line, keeping dense sports feeds from turning the price path into a marker wall. */
.nav-chart-frame .chart .news-event-focus-band {
  fill: rgba(83, 191, 205, 0.075);
  pointer-events: none;
}
.nav-chart-frame .chart .news-event-focus-line {
  stroke: var(--mf-signal-accent-ink);
  stroke-width: 1.35;
  stroke-dasharray: 3 3;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.nav-chart-frame .chart .news-event-focus-line.is-pinned {
  stroke-width: 1.8;
  stroke-dasharray: none;
}
.nav-chart-frame .chart .news-event-focus-dot {
  fill: var(--detail-chart-paper);
  stroke: var(--mf-signal-accent-ink);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}
.nav-chart-frame .chart .news-event-focus-dot.is-pinned {
  fill: var(--detail-cyan);
}
.nav-key-events {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-self: stretch;
  min-width: 0;
  min-height: 0;
  padding: 24px 0 0;
  overflow: hidden;
  border-top: 1px solid var(--mf-border-default);
  border-left: 0;
  color: var(--detail-ink);
  font-family: var(--detail-sans);
}
.nav-analysis-grid > .nav-key-events {
  padding: 14px 0 0 clamp(20px, 2vw, 28px);
  border-top: 0;
  border-left: 1px solid var(--mf-border-default);
}
/* min-height matches .nav-chart-head so "Key Events" sits level with the chart title next to it, even though
   this header is now a single line where the chart title block is two. */
.nav-key-events-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  margin-bottom: 12px;
}
.nav-key-events-head h2 {
  margin: 0;
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 18px;
  font-weight: 680;
  letter-spacing: 0;
  line-height: 1.2;
}
.nav-key-events-head-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
  max-width: 150px;
  color: var(--detail-chart-muted);
  font-size: 11px;
  line-height: 1.25;
  text-align: right;
}
body.detail-view #detail .nav-key-events :where(button) {
  width: auto;
  min-width: 0;
  height: auto;
  min-height: 0;
  margin: 0;
  border-radius: var(--r);
  box-shadow: none;
  font-family: var(--detail-sans);
  letter-spacing: 0;
  text-transform: none;
}
.nav-key-events-restore,
.nav-key-events-page button {
  padding: 6px 10px;
  border: 1px solid var(--detail-line-strong);
  border-radius: var(--r);
  background: var(--detail-panel);
  color: var(--detail-graphite);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.nav-key-events-restore:hover,
.nav-key-events-page button:hover {
  border-color: rgba(83, 191, 205, 0.58);
  background: #f4fdff;
  transform: none;
}
/* A scroll container still sizes to its content, so this needs to stay definite — it is the viewport height,
   not a floor. Scaled to the tallest the rail can be without dwarfing the chart column beside it. */
.nav-key-events-scroll {
  position: relative;
  min-height: 0;
  height: clamp(430px, 46vh, 580px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  border-block: 1px solid var(--detail-line-strong);
  background: rgba(255, 254, 250, 0.42);
  scrollbar-width: thin;
  scrollbar-color: var(--detail-line-strong) transparent;
}
.nav-key-events.has-events .nav-key-events-scroll {
  height: clamp(430px, 46vh, 580px);
}
.nav-key-events-list {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-key-events-month {
  position: sticky;
  top: 0;
  z-index: 3;
  padding: 8px 12px 7px 4px;
  background: var(--detail-chart-paper);
  color: var(--detail-chart-muted);
  font-family: var(--detail-sans);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
}
.nav-key-event {
  position: relative;
  content-visibility: auto;
  contain-intrinsic-size: 72px;
}
.nav-key-event article {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  min-width: 0;
  margin: 1px 0;
  padding: 8px 10px;
  border-radius: var(--r);
  background: transparent;
  transition:background var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.nav-key-event:hover article,
.nav-key-event:focus-within article {
  background: var(--mf-surface-hover);
}
.nav-key-event.is-selected article {
  background: var(--mf-surface-selected);
}
/* The dot carries the curator's 3-5 impact grade, so the highest-stakes events are findable in a scan without
   spending a row-level chip on it. A ring (not a fill) reads as "selected" so it doesn't fight the impact color. */
.nav-key-event-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mf-border-strong);
}
.nav-key-event[data-key-event-impact="4"] .nav-key-event-dot {
  background: var(--detail-chart-muted);
}
.nav-key-event[data-key-event-impact="5"] .nav-key-event-dot {
  width: 8px;
  height: 8px;
  background: var(--detail-graphite);
}
.nav-key-event.is-selected .nav-key-event-dot {
  background: var(--mf-signal-accent-ink);
  box-shadow: 0 0 0 3px var(--mf-signal-accent);
}
.nav-key-event.is-outside:not(.is-selected) .nav-key-event-tag.is-note {
  border-color: rgba(138, 100, 45, 0.42);
  color: #8a642d;
}
.nav-key-event-focus {
  display: block;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}
.nav-key-event-focus:hover,
.nav-key-event-focus:active {
  background: transparent;
  filter: none;
  transform: none !important;
}
.nav-key-event-focus:disabled {
  cursor: default;
  opacity: 1;
}
.nav-key-event-focus:focus-visible,
.nav-key-event-source:focus-visible,
.nav-key-events-restore:focus-visible,
.nav-key-events-page button:focus-visible,
.nav-key-events-scroll:focus-visible {
  outline: 2px solid var(--mf-signal-accent-ink);
  outline-offset: -2px;
}
.nav-key-event-time {
  flex: none;
  color: var(--detail-chart-muted);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  white-space: nowrap;
}
/* Two lines is the whole row budget. Longer headlines ellipsize; the full text stays reachable through the
   button tooltip and the source link. */
.nav-key-event-focus strong {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  color: var(--detail-graphite);
  font-size: 13.5px;
  font-weight: 620;
  line-height: 1.35;
}
.nav-key-event[data-key-event-impact="5"] .nav-key-event-focus strong {
  font-weight: 700;
}
.nav-key-event-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
  min-width: 0;
  color: var(--mf-text-secondary);
  font-size: 10.5px;
  line-height: 1.3;
}
/* No ring. A 999px stroke around a 9.5px word was the densest cluster of line on the page — 7 chips paid 28
   painted edges, 22% of the whole detail page, and the rail grows that count with every event it loads. The
   chip is now a token RECESSED into the paper: page-ground fill on a panel, so the value step that separates
   panel from canvas does the same job one level down. Radius stays — the pill is the chip's shape identity,
   not its boundary. */
.nav-key-event-tag {
  flex: none;
  padding: 2px 7px;
  border: 0;
  border-radius: 999px;
  background: var(--mf-color-canvas, #f6f5f2);
  color: var(--detail-chart-muted);
  font-family: var(--detail-sans);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.4;
  white-space: nowrap;
}
/* Pinned keeps its cyan fill — that is a real state signal, and the fill alone now carries it.
   Ink is explicit: --detail-graphite on this cyan measured 3.93:1, under AA for 9.5px text. That was
   pre-existing (removing the ring does not touch text contrast) but it surfaced while measuring the
   de-ringed chips, and --mf-text-strong on the same fill is 11.87:1. */
.nav-key-event-tag.is-pinned {
  background: var(--mf-signal-accent);
  color: var(--mf-text-strong, #111316);
}
/* A note used a dashed ring to read as softer than a solid tag. With rings gone the same distinction is made
   by absence of fill: the base chips are recessed tokens, a note is bare text on the panel. */
.nav-key-event-tag.is-note {
  background: transparent;
  color: var(--detail-muted);
}
/* Sits on the meta line rather than in a bordered row of its own: one publisher name never justified 30px
   plus a divider. `flex: 1 1 0` gives it a zero base size, so a long masthead ellipsizes in the space left
   over instead of wrapping the row to a third line. */
.nav-key-event-source {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  flex: 1 1 0;
  min-width: 0;
  border-left: 0;
  color: var(--mf-text-secondary);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.3;
  text-decoration: none;
}
/* A primary source (a ministry, a regulator, a filing) is stronger evidence than a wire report, and its own
   name says so better than a generic badge would. */
.nav-key-event-source.is-official {
  color: var(--detail-graphite);
  font-weight: 700;
}
.nav-key-event-source:hover {
  color: var(--detail-graphite);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.nav-key-event-source > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-key-events-page {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 12px;
  border-top: 1px solid var(--detail-line);
  background: var(--detail-chart-paper);
  color: var(--detail-chart-muted);
  font-size: 12px;
}
.nav-key-events-sentinel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  pointer-events: none;
}
.nav-key-events-error {
  color: var(--detail-neg);
}
.nav-key-events-empty {
  display: grid;
  min-height: 260px;
  place-items: center;
  padding: 24px;
  color: var(--detail-chart-muted);
  font-size: 13px;
  text-align: center;
}
.nav-key-event-skeleton {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 74px;
  padding: 12px 10px;
}
.nav-key-event-skeleton span {
  width: min(520px, 68%);
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(90deg, rgba(24, 32, 38, 0.04), rgba(24, 32, 38, 0.1), rgba(24, 32, 38, 0.04));
  background-size: 200% 100%;
  animation: diff-shimmer 1.4s ease-in-out infinite;
}
.nav-key-event-skeleton span:last-child {
  width: min(310px, 44%);
  height: 9px;
}
@media (max-width: 620px) {
  .nav-key-events {
    padding-top: 20px;
  }
  .nav-key-events-head {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 10px;
  }
  .nav-key-events-head-meta {
    justify-items: start;
    max-width: none;
    width: 100%;
    text-align: left;
  }
  .nav-key-events.has-events .nav-key-events-scroll {
    min-height: min(74dvh, 620px);
    -webkit-overflow-scrolling: touch;
  }
  .nav-key-event article {
    gap: 4px;
    padding: 11px 10px 12px;
  }
  .nav-key-events-month {
    padding-right: 12px;
    padding-left: 4px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .nav-key-event article {
    transition: none;
  }
  .nav-key-event-skeleton span {
    animation: none;
  }
}
.nav-driver-panel {
  display: grid;
  grid-template-rows: 46px minmax(0, 1fr);
  gap: 9px;
}
.nav-driver-list {
  display: grid;
  align-content: start;
  gap: 0;
  height: auto;
  min-height: 288px;
  overflow: auto;
  overscroll-behavior: contain;
  padding-right: 0;
  border: 1px solid var(--detail-line);
  background: rgba(255, 254, 250, 0.72);
  scrollbar-gutter: stable;
}
.nav-driver-list::-webkit-scrollbar {
  width: 8px;
}
.nav-driver-list::-webkit-scrollbar-track {
  background: rgba(17, 19, 22, 0.035);
}
.nav-driver-list::-webkit-scrollbar-thumb {
  background: rgba(17, 19, 22, 0.16);
}
.nav-driver-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 47px;
  min-width: 0;
  padding: 7px 11px 7px 14px;
  border: 0;
  border-bottom: 1px solid var(--detail-line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  box-shadow: none;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
}
.nav-driver-card:last-child {
  border-bottom: 0;
}
.nav-driver-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--driver-accent, var(--detail-cyan));
}
.nav-driver-card:hover,
.nav-driver-card.active {
  background: #f4fdff;
}
.nav-driver-card.active {
  box-shadow: inset 0 0 0 1px rgba(83, 191, 205, 0.42);
}
.nav-driver-pie {
  position: relative;
  grid-column: 2;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: end;
  width: 22px;
  height: 22px;
  border: 1px solid rgba(17, 19, 22, 0.1);
  border-radius: 999px;
  background:
    conic-gradient(var(--driver-accent, var(--detail-cyan)) var(--driver-share), rgba(17, 19, 22, 0.08) 0);
}
.nav-driver-pie::after {
  content: attr(data-tip);
  position: absolute;
  top: 50%;
  right: 32px;
  z-index: 4;
  display: none;
  min-width: 38px;
  padding: 4px 6px;
  border: 1px solid rgba(17, 19, 22, 0.1);
  background: rgba(255, 254, 250, 0.96);
  box-shadow: none;
  color: var(--detail-graphite);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 650;
  text-align: center;
  white-space: nowrap;
  transform: translate(4px, -50%);
}
.nav-driver-pie::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(17, 19, 22, 0.06);
  border-radius: inherit;
  background: var(--detail-panel);
}
.nav-driver-pie:hover::after,
.nav-driver-card:focus-visible .nav-driver-pie::after {
  display: block;
}
.nav-driver-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.nav-driver-name {
  overflow: hidden;
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 12.5px;
  font-weight: 680;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-driver-note {
  display: -webkit-box;
  overflow: hidden;
  color: var(--detail-copy-muted);
  font-family: var(--detail-sans);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.2;
  text-overflow: ellipsis;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
.nav-driver-count {
  display: none;
  color: var(--detail-copy-muted);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 650;
  white-space: nowrap;
}
.nav-basket-shell {
  display: grid;
  gap: 9px;
  margin-top: 0;
}
.nav-basket-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 0;
}
.nav-basket-title {
  flex: 1 1 auto;
  margin-right: 0;
}
.nav-basket-title > span {
  margin-left: auto;
}
.nav-basket-tabs.comp-tabs {
  margin: 0;
  gap: 3px;
  padding: 3px;
  border-color: var(--detail-line);
  border-radius: 0;
  background: rgba(255, 254, 250, 0.72);
}
.nav-basket-tabs.comp-tabs .comp-tab {
  width: auto;
  min-width: 92px;
  height: 28px;
  padding: 0 10px;
  border-radius: 0;
  color: var(--detail-muted);
  font-family: var(--detail-sans);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
}
.nav-basket-tabs.comp-tabs .comp-tab:hover {
  color: var(--detail-graphite);
}
.nav-basket-tabs.comp-tabs .comp-tab.active {
  background: #eefdff;
  box-shadow: inset 0 0 0 1px rgba(83, 191, 205, 0.4);
  color: var(--detail-graphite);
}
.nav-factor-clear {
  display: none;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 0;
  height: 28px;
  min-height: 28px;
  padding: 0 11px;
  border: 1px solid rgba(83, 191, 205, 0.52);
  border-radius: 0;
  background: #effcff;
  color: var(--detail-graphite);
  box-shadow: none;
  font-family: var(--detail-sans);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background var(--mf-duration-standard, 180ms) var(--mf-ease),
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.nav-factor-clear:hover {
  border-color: rgba(83, 191, 205, 0.48);
  background: #f4fdff;
  color: var(--detail-graphite);
  box-shadow: none;
  transform: none;
}
.nav-factor-clear.active {
  display: inline-flex;
}
.nav-update-records.recomp-records {
  gap: 8px;
}
.nav-recomp .nav-update-record {
  border: 1px solid var(--detail-line);
  background: rgba(255, 254, 250, 0.72);
}
.nav-recomp .nav-update-record:last-child {
  border-bottom: 1px solid var(--detail-line);
}
.nav-recomp .nav-update-record[open] {
  border-color: rgba(83, 191, 205, 0.48);
  background: rgba(244, 253, 255, 0.5);
}
.nav-recomp .nav-update-record > summary {
  display: grid;
  grid-template-columns: 12px auto minmax(240px, 1fr);
  grid-template-areas:
    "twist main stats";
  align-items: center;
  gap: 12px;
  padding: 12px;
}
.nav-recomp .nav-update-record > summary::before {
  grid-column: 1;
  grid-area: twist;
  margin-top: 2px;
}
.nav-update-summary-main {
  display: flex;
  align-items: baseline;
  gap: 9px;
  flex-wrap: wrap;
  grid-area: main;
  min-width: 0;
}
.nav-update-record .recomp-date {
  color: var(--detail-label);
  font-family: var(--detail-mono);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}
.nav-update-record .recomp-summary {
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.28;
  white-space: normal;
}
.nav-update-stats {
  display: flex;
  grid-area: stats;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.nav-update-stat {
  display: grid;
  gap: 1px;
  min-width: 76px;
  padding: 6px 8px;
  border: 1px solid rgba(17, 19, 22, 0.08);
  background: rgba(255, 255, 255, 0.58);
  text-align: right;
}
.nav-update-stat b {
  color: var(--detail-graphite);
  font-family: var(--detail-mono);
  font-size: 12px;
  font-weight: 750;
  line-height: 1;
}
.nav-update-stat small {
  overflow: hidden;
  color: var(--detail-copy-muted);
  font-family: var(--detail-mono);
  font-size: 9.5px;
  font-weight: 650;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-update-stat.pos b {
  color: var(--detail-pos);
}
.nav-update-stat.neg b {
  color: var(--detail-neg);
}
.nav-update-stat.warn b {
  color: var(--recomp-marker);
}
.nav-update-stat.muted b {
  color: var(--detail-copy-muted);
}
.nav-recomp .recomp-detail {
  padding: 2px 12px 16px 36px;
}
.nav-recomp .recomp-rationale {
  margin: 0 0 12px;
  max-width: 76ch;
  padding: 10px 12px;
  border: 1px solid rgba(17, 19, 22, 0.08);
  border-left: 3px solid rgba(83, 191, 205, 0.58);
  background: rgba(255, 255, 255, 0.58);
  color: var(--detail-muted);
  font-family: var(--detail-sans);
  font-size: 12.5px;
  line-height: 1.5;
}
.nav-recomp .diff-section {
  margin-top: 14px;
  max-width: 760px;
}
.nav-recomp .diff-section-head {
  padding: 0 0 7px;
  font-family: var(--detail-sans);
  text-transform: none;
}
.nav-recomp .diff-row {
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: none;
  align-items: start;
  gap: 16px;
  padding: 9px 0;
  border-color: rgba(17, 19, 22, 0.08);
}
.nav-recomp .diff-cell-market {
  display: grid;
  grid-area: auto;
  align-content: start;
  gap: 5px;
  min-width: 0;
}
.nav-recomp .recomp-market-title {
  display: block;
  min-width: 0;
}
.nav-recomp .recomp-market-title .mlink,
.nav-recomp .recomp-market-title .market-name {
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: none;
}
.nav-recomp .recomp-market-title .mlink:hover {
  color: var(--detail-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.nav-recomp .recomp-market-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}
.nav-recomp .recomp-market-meta .resolved-badge {
  margin: 0;
}
.nav-recomp .recomp-facet {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid rgba(17, 19, 22, 0.08);
  background: rgba(255, 255, 255, 0.6);
  color: var(--detail-copy-muted);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.2;
}
.nav-recomp .diff-cell-metrics {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}
.nav-recomp .diff-metric {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-content: center;
  align-items: baseline;
  gap: 8px;
  min-height: 0;
  min-width: 0;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--detail-graphite);
  text-align: right;
  white-space: nowrap;
}
.nav-recomp .diff-metric small {
  color: var(--detail-copy-muted);
  font-family: var(--detail-mono);
  font-size: 9.5px;
  font-weight: 650;
  line-height: 1;
}
.nav-recomp .diff-metric b,
.nav-recomp .metric-before {
  font-family: var(--detail-mono);
  font-size: 12.5px;
  font-weight: 750;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.nav-recomp .metric-before {
  color: var(--detail-copy-muted);
  font-weight: 650;
}
.nav-recomp .diff-metric-flow {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 2px 6px;
  min-width: 0;
}
.nav-recomp .diff-metric .pos,
.nav-recomp .weight-delta.pos {
  color: var(--detail-pos);
}
.nav-recomp .diff-metric .neg,
.nav-recomp .weight-delta.neg {
  color: var(--detail-neg);
}
.nav-recomp .diff-metric .zero,
.nav-recomp .weight-delta.zero {
  color: var(--detail-copy-muted);
}
.nav-recomp .weight-delta {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  padding: 1px 5px;
  border: 1px solid rgba(17, 19, 22, 0.08);
  background: rgba(255, 254, 250, 0.75);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 750;
  line-height: 1;
}
.nav-update-empty {
  margin: 0;
  padding: 18px 12px;
  border: 1px solid var(--detail-line);
  background: rgba(255, 254, 250, 0.72);
  color: var(--detail-muted);
  font-family: var(--detail-sans);
  font-size: 13px;
}
.nav-holding-list {
  display: grid;
  gap: 7px;
}
.nav-holding-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 58px 148px;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--detail-line);
  border-radius: 0;
  background: rgba(255, 254, 250, 0.72);
  box-shadow: none;
  transition:
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    background var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.nav-holding-card:hover {
  border-color: rgba(17, 19, 22, 0.16);
  background: var(--detail-panel);
}
.nav-holding-card a.mlink {
  color: var(--detail-graphite);
  text-decoration: none;
  border-bottom: 1px dotted rgba(17, 19, 22, 0.28);
}
.nav-holding-card a.mlink:hover {
  color: var(--detail-graphite);
  border-bottom-color: rgba(17, 19, 22, 0.6);
}
.nav-holding-main {
  min-width: 0;
}
.nav-holding-market {
  overflow: hidden;
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-holding-facet {
  margin-top: 3px;
  overflow: hidden;
  color: var(--detail-copy-muted);
  font-family: var(--detail-sans);
  font-size: 11.5px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-holding-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
.nav-holding-side span:last-child {
  color: var(--detail-copy-muted);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 650;
}
.nav-side-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 22px;
  padding: 0 9px;
  border-radius: 0;
  font-family: var(--detail-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1;
}
.nav-side-pill.yes {
  color: var(--detail-pos);
  border: 1px solid rgba(22, 148, 92, 0.26);
  background: rgba(22, 148, 92, 0.1);
}
.nav-side-pill.no {
  color: var(--detail-neg);
  border: 1px solid rgba(217, 76, 104, 0.28);
  background: rgba(217, 76, 104, 0.1);
}
.nav-holding-side span.nav-side-pill {
  color: var(--detail-graphite);
  font-family: var(--detail-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
}
.nav-holding-side span.nav-side-pill.yes {
  color: var(--detail-pos);
}
.nav-holding-side span.nav-side-pill.no {
  color: var(--detail-neg);
}
.nav-holding-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.nav-holding-stats span {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: 0;
}
.nav-holding-stats b {
  color: var(--detail-graphite);
  font-family: var(--detail-mono);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.1;
}
.nav-holding-stats small {
  color: var(--detail-copy-muted);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.1;
}
.nav-empty-card {
  padding: 18px;
  border: 1px solid var(--detail-line);
  border-radius: 0;
  background: var(--detail-panel);
}
.nav-recomp .diff-row-head {
  text-transform: none;
}

/* Admin NAV section. */
.admin-nav-section { margin-top: 26px; }
.admin-nav-toolbar { align-items: center; }
.admin-nav-head { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text); margin: 0; }

/* ── Review tab (PRESENTATION_PIPELINE_PLAN.md) — queue left, editorial detail right. ─────────────────── */
.review-layout {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
  margin-top: 18px;
}
/* Queue column: a sticky "Newest first · shown/total" header over a scrollable, self-refreshing list. The list
   scrolls on its own so a 40-item queue never pushes the editorial detail off the bottom of the page. */
.review-queue-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; position: sticky; top: 12px; }
.review-queue-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.review-queue-shown { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.review-queue { display: flex; flex-direction: column; gap: 6px; max-height: calc(100dvh - 190px); overflow-y: auto; padding-right: 2px; }
/* The row is a CONTAINER (open + remove are its two buttons) — a button can't nest inside a button. */
.review-item {
  display: flex;
  align-items: stretch;
  gap: 0;
  min-width: 0;
  border: 1px solid var(--detail-line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12.5px;
  /* The row itself owns the transition — .review-item-open's `transition: none` correctly cancels the
     INHERITED button lift/shadow (it's a flat list row, not a raised CTA), but border-color and background
     live here on the parent and had no transition of their own, so hover/active snapped instantly. Reviewers
     move through this queue one row at a time, not dozens of times a minute, so a short ease-out reads as
     responsive rather than sluggish. */
  transition:
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    background var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.review-item-open {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  height: auto; /* override the global button { height: 54px } — the row grows to fit name + badges + blocker */
  min-height: 0;
  padding: 9px 4px 9px 12px;
  text-align: left;
  border: 0;
  border-radius: 12px 0 0 12px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-size: 12.5px;
  font-weight: 400;
  transition: none;
}
.review-item-open:hover { transform: none; box-shadow: none; }
.review-item:hover { border-color: rgba(116, 222, 235, 0.72); background: #ffffff; }
.review-item.active { border-color: rgba(116, 222, 235, 0.95); background: rgba(235, 252, 255, 0.78); box-shadow: none; }
.review-item-name { font-size: 13px; font-weight: 700; line-height: 1.3; }
.review-item-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.review-item-age { font-size: 10.5px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
/* Remove is deliberately quiet until the row is hovered — it deletes the measurement, so it must not read as a
   sibling of "open", but it also must not need a trip to the Admin tab. */
.review-item-remove {
  flex: 0 0 auto;
  min-width: 0;
  width: 30px;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0 12px 12px 0;
  background: transparent;
  color: var(--text-faint);
  box-shadow: none;
  font-size: 12px;
  font-weight: 700;
  opacity: 0;
  transition:opacity var(--mf-duration-fast, 120ms) var(--mf-ease), color var(--mf-duration-fast, 120ms) var(--mf-ease);
}
.review-item:hover .review-item-remove,
.review-item-remove:focus-visible { opacity: 1; }
.review-item-remove:hover { transform: none; box-shadow: none; color: var(--neg); background: rgba(217, 76, 104, 0.09); }
.review-blockers { font-size: 11px; color: var(--neg); max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
}

/* publication lifecycle badges — shared by the review queue, list cards (local writer), and detail. */
.pub-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  font-family: var(--list-sans, var(--detail-sans, var(--sans)));
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  vertical-align: middle;
}
.pub-badge.pub-draft { color: var(--text-dim); background: var(--surface-muted); }
.pub-badge.pub-review, .pub-badge.pub-in_review { color: var(--accent); border-color: rgba(47, 127, 193, 0.4); background: var(--accent-soft); }
.pub-badge.pub-rejected { color: var(--neg); border-color: rgba(217, 76, 104, 0.4); background: rgba(217, 76, 104, 0.09); }
.pub-badge.pub-published { color: var(--accent-3); border-color: rgba(45, 138, 111, 0.4); background: rgba(45, 138, 111, 0.09); }
.pub-badge.pub-unpublished { color: var(--mixed); background: var(--surface-muted); }
.pub-badge.pub-update { color: var(--dir-high); border-color: rgba(47, 111, 159, 0.4); background: rgba(47, 111, 159, 0.09); }
.pub-badge.pub-stale { color: var(--dir-low); border-color: rgba(199, 119, 47, 0.4); background: rgba(199, 119, 47, 0.09); }
.pub-badge.pub-diverged { color: var(--neg); border-color: rgba(217, 76, 104, 0.4); }
.pub-badge.pub-category { color: var(--text); border-color: rgba(116, 222, 235, 0.48); background: rgba(235, 252, 255, 0.8); }

.review-detail { min-width: 0; }
/* back-to-queue affordance — only shown on narrow screens, where selecting an item hides the queue (below). */
.review-back {
  display: none;
  align-items: center;
  gap: 6px;
  margin: 0 0 12px;
  padding: 7px 12px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: var(--panel);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.review-back:hover { border-color: rgba(47, 127, 193, 0.5); }
.review-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.review-detail-name { font-size: 22px; line-height: 1.15; font-weight: 800; margin: 0; letter-spacing: 0; }

/* ── Review detail — composed editorial layout (header · credibility strip · sized editor · media) ────────── */
.rv-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 0 0 14px; }
.rv-head-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.rv-provenance { font-family: var(--mono); font-size: 11px; }

/* credibility strip — a glanceable one-line gate signal, not a full panel */
.rv-cred-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
  margin: 0 0 18px; padding: 9px 14px;
  border: 1px solid var(--border-soft); border-radius: 12px;
  background: rgba(47, 127, 193, 0.045);
  font-family: var(--mono); font-size: 12px;
}
.rv-cred-chip { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); }
.rv-cred-chip b { color: var(--text-faint); font-weight: 700; font-size: 10px; letter-spacing: 0.05em; text-transform: uppercase; }
.rv-cred-chip.ok { color: var(--pos); }
.rv-cred-chip.warn { color: var(--dir-low); }
.rv-verifier { margin-left: auto; }
.rv-verifier > summary { cursor: pointer; color: var(--accent); font-size: 11.5px; font-weight: 700; list-style: none; }
.rv-verifier > summary::-webkit-details-marker { display: none; }
.rv-verifier > summary::before { content: "▸ "; }
.rv-verifier[open] > summary::before { content: "▾ "; }
.rv-verifier .review-verification {
  flex-basis: 100%; margin-top: 8px; max-width: 720px;
  font-size: 12px; line-height: 1.5; color: var(--text-dim); white-space: pre-wrap;
  max-height: 150px; overflow-y: auto; padding: 8px 10px;
  border: 1px solid var(--border-soft); border-radius: 8px; background: rgba(255, 255, 255, 0.7);
}

/* editor: a readable form column beside the theme-image aside */
.rv-editor { display: grid; grid-template-columns: minmax(0, 1fr) 268px; gap: 26px; align-items: start; margin: 0 0 16px; }
.rv-fields { display: flex; flex-direction: column; gap: 17px; max-width: 620px; min-width: 0; }
.rv-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rv-field-label {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--text); letter-spacing: 0.01em;
}
.rv-field-label .muted { font-size: 11px; font-weight: 400; color: var(--text-faint); letter-spacing: 0; }
.rv-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 20px; }
/* short fields are sized to their content instead of sprawling the full column width */
.rv-field-title > .review-input { max-width: 440px; }
.rv-field-tagline > .review-input { max-width: 560px; }
.rv-save { margin-top: 3px; }
.rv-media { min-width: 0; }
.rv-media .review-image-card { position: sticky; top: 12px; }

@media (max-width: 980px) {
  .rv-editor { grid-template-columns: 1fr; }
  .rv-field-grid { grid-template-columns: 1fr; }
  .rv-media .review-image-card { position: static; }
  .rv-verifier { margin-left: 0; }
}

.review-panel {
  margin: 0 0 12px;
  border: 1px solid var(--detail-line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.86);
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(31, 35, 40, 0.04);
}
.review-panel > summary { cursor: pointer; font-size: 14.5px; line-height: 1.25; font-weight: 800; color: var(--text); }
.review-panel > summary::marker { color: var(--text-faint); }
/* primary edit surface — lifted + tinted so it reads as the main work area. */
.review-panel-primary { background: #ffffff; border-color: rgba(116, 222, 235, 0.4); box-shadow: 0 6px 18px rgba(31, 35, 40, 0.06); }
/* the publish gate — accent rail + soft tint, kept open so credibility is seen before the decision. */
.review-panel-gate { border-left: 3px solid var(--accent); background: rgba(47, 127, 193, 0.05); }
.review-panel-gate > summary { color: var(--accent); }
/* secondary maintenance panels recede. */
.review-panel-muted { background: var(--surface-muted); box-shadow: none; }
.review-panel-muted > summary { color: var(--text-dim); font-weight: 700; }
.review-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.review-presentation-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(230px, 300px);
  gap: 18px;
  align-items: start;
}
.review-field-stack { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.review-direction-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.review-category-fields { display: grid; grid-template-columns: minmax(150px, 0.7fr) minmax(0, 1.3fr); gap: 10px; }
.review-label { display: flex; flex-direction: column; gap: 6px; font-family: var(--mono); font-size: 12.5px; font-weight: 600; color: var(--text); letter-spacing: 0.01em; }
.review-label .muted { font-size: 11px; font-weight: 400; color: var(--text-faint); letter-spacing: 0; }
.review-label-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.review-input {
  width: 100%;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--detail-line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
}
.review-input:focus { outline: none; border-color: rgba(116, 222, 235, 0.95); box-shadow: 0 0 0 3px rgba(116, 222, 235, 0.16); }
.review-counter { color: var(--text-faint); font-size: 11px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.review-counter.over { color: var(--neg); font-weight: 700; background: rgba(217, 76, 104, 0.1); padding: 1px 6px; border-radius: 999px; }
.review-facets { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.review-facet-row { display: grid; grid-template-columns: minmax(120px, 0.8fr) 1fr 1.2fr; gap: 6px; align-items: center; }
.review-facet-id { font-size: 11px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Composition audit tree (read-only): Factor head + its market rows, dense on purpose — DESIGN.md §1.1 lets an
   internal operator surface stay tight so long as it shares the semantic tokens. */
.review-comp { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.review-comp-factor { border: 1px solid var(--mf-border-subtle, var(--border)); border-radius: 6px; overflow: hidden; }
.review-comp-factor-head,
.review-comp-member { display: grid; gap: 8px; align-items: baseline; padding: 4px 8px; }
.review-comp-factor-head { grid-template-columns: 1fr auto 56px; background: var(--mf-surface-sunken, var(--bg-alt)); font-weight: 700; font-size: 12px; }
.review-comp-member { grid-template-columns: 1fr 40px 56px 72px; font-size: 11.5px; border-top: 1px solid var(--mf-border-subtle, var(--border)); }
.review-comp-member.is-unpriced { opacity: 0.72; }
.review-comp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review-comp-side,
.review-comp-count { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.review-comp-weight { font-family: var(--mono); text-align: right; font-variant-numeric: tabular-nums; }
.review-comp-flags { font-size: 10.5px; color: var(--text-faint); text-align: right; }
.review-comp-sigma { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.review-image-upload input[type="file"] { font-size: 11px; padding: 4px; }
.review-image-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--detail-line);
  border-radius: 14px;
  background: rgba(252, 254, 254, 0.84);
}
.review-image-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--text-dim);
}
.review-image-preview {
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 200px;
  margin: 0 auto;
  aspect-ratio: 1 / 1; /* matches .measurement-card-image's 1:1 thumbnail; .nav-topic-image is portrait now — it stretches to the detail hero's row height, not a fixed square */
  overflow: hidden;
  border: 1px dashed var(--detail-line);
  border-radius: 14px;
  background: rgba(245, 249, 249, 0.72);
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 11.5px;
}
.review-image-preview.has-image { border-style: solid; background: #ffffff; }
.review-image-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.review-image-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 34px;
  color: var(--text-dim);
  font-size: 11.5px;
  line-height: 1.35;
}
.review-image-meta a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.review-image-meta small { color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review-image-query-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.review-image-status { min-height: 16px; font-size: 11.5px; }
.review-cred { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-dim); }
.review-verification { font-size: 12px; }
.review-side { font-family: var(--mono); font-size: 11.5px; margin-right: 8px; }
.review-blocker-list { list-style: none; margin: 4px 0 10px; padding: 0; color: var(--neg); font-size: 12.5px; }
.review-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
/* the approve/publish bar sticks to the viewport bottom so publish is always reachable on a long form. */
.review-actions-final {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  background: rgba(251, 251, 248, 0.92);
  backdrop-filter: blur(6px);
  box-shadow: 0 -2px 12px rgba(31, 35, 40, 0.07);
}
.review-actions-spacer { flex: 1 1 auto; }
.review-publish {
  border-color: rgba(45, 138, 111, 0.6);
  background: rgba(45, 138, 111, 0.14);
  color: var(--accent-3);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(45, 138, 111, 0.12);
}
.review-publish:hover:not(:disabled) { background: rgba(45, 138, 111, 0.22); box-shadow: 0 4px 12px rgba(45, 138, 111, 0.18); }
.review-publish:disabled { opacity: 0.5; cursor: not-allowed; background: var(--surface-muted); color: var(--text-faint); box-shadow: none; }

/* blocker banner — prominent, top of the detail, replaces the old faint bottom list. */
.review-blocker-slot:empty { display: none; }
.review-blocker-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 14px;
  padding: 11px 14px;
  border: 1px solid rgba(217, 76, 104, 0.3);
  border-left: 3px solid var(--neg);
  border-radius: 12px;
  background: rgba(217, 76, 104, 0.08);
  color: var(--text);
  font-size: 12.5px;
  line-height: 1.4;
}
.review-blocker-banner strong { color: var(--neg); }
.review-blocker-icon { font-size: 13px; line-height: 1.4; }

/* credibility — the publish gate, surfaced as a scannable grid + a verifier readout. */
.review-cred-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; margin-top: 10px; }
.review-cred-item { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.review-cred-key { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-faint); }
.review-cred-val { font-size: 12.5px; color: var(--text); line-height: 1.35; }
.review-cred-val.ok { color: var(--pos); font-weight: 700; }
.review-cred-val.warn { color: var(--dir-low); font-weight: 700; }
.review-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.review-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(199, 119, 47, 0.35);
  background: rgba(199, 119, 47, 0.09);
  color: var(--dir-low);
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
}
.review-ok { color: var(--pos); font-size: 12px; font-weight: 600; }
.review-cred-verifier { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border-soft); display: flex; flex-direction: column; gap: 5px; }
.review-cred-verifier .review-verification {
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-dim);
  max-height: 130px;
  overflow-y: auto;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--border-soft);
  white-space: pre-wrap;
}

/* live regenerate status with an inline spinner while streaming. */
.review-status-live { display: inline-flex; align-items: center; gap: 7px; min-height: 18px; font-size: 12px; }
.review-status-live:not(:empty)::before {
  content: "";
  width: 11px; height: 11px;
  border: 2px solid rgba(47, 127, 193, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: review-spin 0.7s linear infinite;
}

/* empty / loading / error states in the queue + detail. */
.review-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 180px; text-align: center; color: var(--text-faint); padding: 24px; }
.review-state p { margin: 0; font-size: 13px; color: var(--text-dim); }
.review-state p.muted { font-size: 11.5px; }
.review-state-icon { font-size: 26px; line-height: 1; }
.review-state-icon.ok { color: var(--pos); }
.review-state-icon.warn { color: var(--dir-low); }
.review-spinner {
  width: 22px; height: 22px;
  border: 2.5px solid rgba(47, 127, 193, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: review-spin 0.7s linear infinite;
}
@keyframes review-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  /* Same treatment as .mf-transfer-spinner elsewhere in this file — the two-tone ring already reads as
     "in progress" without spinning it. */
  .review-status-live:not(:empty)::before,
  .review-spinner { animation: none; }
}

/* preview banner on ?preview=1 detail views. */
.preview-banner {
  margin: 0 0 12px;
  padding: 7px 12px;
  border: 1px dashed rgba(199, 119, 47, 0.55);
  border-radius: var(--r);
  color: var(--dir-low);
  background: rgba(199, 119, 47, 0.07);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
}
.preview-banner-exit { color: var(--accent); text-decoration: underline; font-weight: 700; }

@media (max-width: 880px) {
  .review-layout { grid-template-columns: 1fr; }
  .review-presentation-grid { grid-template-columns: 1fr; }
  .review-direction-fields { grid-template-columns: 1fr; }
  .review-category-fields { grid-template-columns: 1fr; }
  .review-cred-grid { grid-template-columns: 1fr; }
  /* Master-detail: the queue and detail can't sit side-by-side here, so show ONE at a time. With an item
     selected, hide the queue and give the detail the full width (a "← Queue" button returns to the list). */
  .review-layout.review-has-selection .review-queue-col { display: none; }
  .review-queue-col { position: static; }
  .review-queue { max-height: none; }
  .review-back { display: inline-flex; }
}

@media (max-width: 720px) {
  /* the NAV card populates the same areas as an index card; keep the value column right-aligned. */
  .nav-row-value { align-items: flex-end; text-align: right; }
  .nav-hero { align-items: flex-start; text-align: left; }
  .nav-hero .idx-gauge-change,
  .nav-hero-scale { justify-content: flex-start; }
  .nav-detail-val { align-items: flex-start; }
}

@media (max-width: 1024px) {
  /* The header stacks in lockstep with .nav-analysis-grid below it (same breakpoint): both go full-width at
     the same point, so the identity column's right edge keeps landing on the chart's right edge instead of
     drifting narrower while the chart (already single-column here) stays wide. */
  .nav-detail-top {
    grid-template-columns: 1fr;
    grid-template-areas:
      "back"
      "image"
      "identity"
      "val";
    row-gap: 10px;
  }
  /* Stacked layout has no "tallest sibling column" for the image to stretch against, so it goes back to a
     fixed, modest size of its own instead of the desktop 168px-wide/full-height treatment. */
  .nav-topic-image {
    width: 96px;
    height: 96px;
    align-self: start;
  }
  .nav-analysis-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .nav-key-events,
  .nav-analysis-grid > .nav-key-events {
    padding: 24px 0 0;
    border-top: 1px solid var(--mf-border-default);
    border-left: 0;
  }
  .nav-key-events-scroll,
  .nav-key-events.has-events .nav-key-events-scroll {
    min-height: clamp(460px, 56vh, 640px);
  }
  /* Touch: the source link grows to a full-size target and takes the meta line's height with it, which keeps
     it inline — no line of its own wedged between the timestamp and the headline. */
  .nav-key-event-source,
  body.detail-view #detail .nav-key-events :where(.nav-key-events-restore, .nav-key-events-page button) {
    min-height: var(--mf-control-height-touch);
  }
  .nav-driver-panel {
    grid-template-rows: auto auto;
  }
  .nav-driver-list {
    height: auto;
    min-height: 0;
    max-height: 280px;
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1025px) and (max-width: 1199px) {
  .nav-analysis-grid > .nav-key-events .nav-key-events-head {
    min-height: calc(58px + 2rem);
  }
}

@media (max-width: 620px) {
  .nav-key-events,
  .nav-analysis-grid > .nav-key-events {
    padding-top: 20px;
  }
  .nav-key-events-scroll,
  .nav-key-events.has-events .nav-key-events-scroll {
    min-height: min(74dvh, 620px);
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 800px) {
  body.detail-view main {
    width: min(100% - 24px, 1420px);
    padding-top: 32px;
  }
  .nav-detail-logo {
    width: 174px;
    height: auto;
  }
  .nav-detail-val {
    align-items: stretch;
  }
  .nav-topic-image {
    width: 64px;
    height: 64px;
  }
  .nav-dir-value {
    font-size: 20px;
  }
  .nav-dir-price {
    font-size: 12px;
  }
  .nav-analysis-grid {
    margin-top: 18px;
  }
  .nav-chart-head {
    align-items: stretch;
    flex-direction: column;
  }
  .nav-chart-title-block {
    width: 100%;
    max-width: none;
  }
  .nav-chart-controls {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
  .nav-chart-panel .chart-range {
    width: 100%;
  }
  .nav-chart-frame {
    padding-left: 0;
  }
  .nav-driver-list {
    grid-template-columns: 1fr;
  }
  .nav-basket-head {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .nav-basket-tabs.comp-tabs {
    width: auto;
    margin-left: 0;
  }
  .nav-holding-card {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main side"
      "stats stats";
    align-items: start;
    gap: 10px 12px;
  }
  .nav-holding-main {
    grid-area: main;
  }
  .nav-holding-side {
    grid-area: side;
  }
  .nav-holding-stats {
    grid-area: stats;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nav-holding-stats span {
    align-items: flex-end;
  }
  .nav-recomp .nav-update-record > summary {
    grid-template-columns: 12px minmax(0, 1fr);
    grid-template-areas:
      "twist main"
      ". stats";
    gap: 10px;
  }
  .nav-update-stats {
    justify-content: flex-start;
    width: 100%;
  }
  .nav-update-stat {
    flex: 1 1 72px;
    text-align: left;
  }
  .nav-update-record .recomp-summary {
    white-space: normal;
  }
  .nav-recomp .recomp-detail {
    padding: 0 12px 14px;
  }
  .nav-recomp .diff-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 10px 0;
  }
  .nav-recomp .diff-cell-metrics {
    justify-content: flex-end;
  }
}

@media (max-width: 520px) {
  .nav-chart-result-marker {
    right: 6px;
    min-width: 82px;
    padding: 7px 7px 6px;
  }
  .nav-chart-result-marker b {
    font-size: 14px;
  }
  .nav-chart-result-marker > span {
    font-size: 9px;
  }
}

@media (max-width: 520px) {
  .detail-brand-row {
    align-items: center;
  }
  .nav-detail-logo {
    width: 142px;
  }
  .auth-shell-detail {
    max-width: min(190px, 52vw);
  }
  .auth-shell-detail .auth-shell-view,
  .auth-shell-detail .auth-trigger {
    max-width: 100%;
  }
  .nav-dir-switch-btn {
    padding: 11px 13px 12px;
  }
  .nav-dir-value {
    font-size: 18px;
  }
  .nav-dir-price {
    font-size: 11px;
  }
  .nav-holding-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .nav-recomp .diff-cell-metrics {
    justify-content: flex-start;
  }
  .nav-recomp .diff-metric {
    text-align: left;
  }
  .nav-recomp .diff-metric-flow {
    justify-content: flex-start;
  }
}

/* ── Image asset placeholders + credit (IMAGE_ASSET_PIPELINE_PLAN.md P2) ───────────────────────── */
.measurement-card-image.is-ph,
.nav-topic-image.is-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: linear-gradient(135deg, hsl(var(--ph-hue, 210) 52% 44%), hsl(calc(var(--ph-hue, 210) + 42) 58% 26%));
}
.ph-initials {
  font: 700 20px/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.02em;
  user-select: none;
}
.measurement-card-image.is-ph .ph-initials {
  font-size: 30px;
}
.nav-topic-image.is-ph .ph-initials {
  font-size: 37px;
}
.measurement-card-image.img-failed,
.nav-topic-image.img-failed { opacity: 0.6; }
.nav-topic-credit {
  margin: 6px 0 0;
  max-width: 44ch;
  font-size: 11px;
  line-height: 1.3;
  color: var(--muted, #8a94a6);
}
.nav-topic-credit a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* Per-facet thumbnail (P3) */
.nav-facet-thumb {
  width: 36px; height: 36px;
  border-radius: 8px;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 8px;
  flex: 0 0 auto;
}

/* ═══════════════════════════════════════════════════════════════════════════════════════════════
   In-product trading — buy entry, wizard modal, portfolio, custody illustrations.
   Aligned to DESIGN.md: sans for product language, mono only for numeric/address data,
   warm-paper surfaces, hairline structure, measured cyan, strong CTAs only at payment/build moments,
   direction-card conventions. Light warm product only (dark-as-default is a banned pattern).
   Security copy states only structural guarantees; the live-trade escrow window is disclosed honestly.
   ═══════════════════════════════════════════════════════════════════════════════════════════════ */

:root {
  /* Three intentional weight levels. Deliberately only three: no webfont is loaded (Inter is declared but
     never fetched), so the fallback family resolves every weight in 600-699 to one face and every weight in
     700-799 to another — a finer ladder than this renders identically and only reads as precision. */
  --mf-pf-weight-body: var(--mf-font-weight-regular, 400);
  --mf-pf-weight-middle: var(--mf-font-weight-semibold, 600);
  --mf-pf-weight-heading: var(--mf-font-weight-bold, 700);
  --mf-sans: var(--mf-font-sans, var(--list-sans, var(--detail-sans, Inter, "Helvetica Neue", Arial, sans-serif)));
  --mf-mono: var(--mf-font-mono, var(--list-mono, var(--detail-mono, "SF Mono", Menlo, Consolas, monospace)));
  --mf-canvas: var(--mf-surface-canvas, var(--list-panel, var(--detail-panel, #fffefa)));
  --mf-paper: var(--mf-surface-subtle, #f6f7f4);
  --mf-graphite: var(--mf-text-strong, var(--list-graphite, var(--detail-graphite, #111316)));
  --mf-ink: var(--mf-text-primary, var(--list-ink, var(--detail-ink, #1b2026)));
  --mf-muted: var(--mf-text-secondary, var(--list-muted, var(--detail-muted, #65707a)));
  --mf-faint: var(--mf-text-disabled, var(--list-faint, var(--detail-faint, #9aa3ad)));
  --mf-line: var(--mf-border-subtle, var(--list-line, var(--detail-line, rgba(17, 19, 22, 0.105))));
  --mf-line-strong: var(--mf-border-default, var(--list-line-strong, var(--detail-line-strong, rgba(17, 19, 22, 0.18))));
  --mf-cyan: var(--mf-signal-accent, var(--list-cyan, var(--detail-cyan, #74deeb)));
  --mf-cyan-soft: var(--mf-color-accent-soft, var(--list-cyan-soft, var(--detail-cyan-soft, rgba(116, 222, 235, 0.18))));
  --mf-cyan-ink: var(--mf-signal-accent-ink, #08758a);
  --mf-pos: var(--mf-status-positive, var(--list-pos, var(--detail-pos, #168765)));
  --mf-neg: var(--mf-status-negative, var(--list-neg, var(--detail-neg, #c85261)));
  --mf-pos-soft: var(--mf-color-positive-soft, rgba(22, 135, 101, 0.11));
  --mf-neg-soft: var(--mf-color-negative-soft, rgba(200, 82, 97, 0.10));
  --mf-warn: var(--mf-status-warning, #96631c);
  --mf-warn-soft: var(--mf-color-warning-soft, rgba(150, 99, 28, 0.10));
  --mf-radius: var(--mf-radius-md, 8px);
  --mf-control-radius: var(--mf-radius-sm, 6px);
  --mf-lift: var(--mf-shadow-overlay, 0 20px 42px rgba(31, 35, 40, 0.13));
  --mf-card: var(--mf-shadow-card, 0 18px 36px rgba(17, 19, 22, 0.05));
  --mf-ease: var(--mf-ease-standard, cubic-bezier(0.16, 1, 0.3, 1));
}

/* INVARIANT for this file: every design-system token referenced anywhere in styles.css MUST carry a
   literal fallback — `var(--mf-duration-standard, 180ms)`, never bare.
   public/trading/index.html loads /styles.css WITHOUT /design-system.css, and --mf-duration-* are defined
   only there. A bare reference is then invalid at computed-value time, which does not fall back to the
   property's initial value — it invalidates the ENTIRE shorthand, so the transition or animation silently
   does not run. It fails on one surface only, with no console error and nothing for a test to catch.
   The aliases above are the reason motion easing is spelled var(--mf-ease) rather than
   var(--mf-ease-standard) in this file: --mf-ease is defined right here, so it survives standalone.
   auth.css and trend-detail-trust.css use bare tokens deliberately — both always load beside
   design-system.css, so the constraint does not apply to them. */

/* Neutralize the global <button> base (min-width/height/dark-fill/shadow) so the .mf-* component styles own it. */
#mf-modal-host button:not(.mf-btn),
.mf-portfolio button:not(.mf-btn),
.mf-buy-btn,
.nav-trade-btn {
  min-width: 0;
  width: auto;
  height: auto;
  box-shadow: none;
}
#mf-modal-host button:not(.mf-btn):hover,
.mf-portfolio button:not(.mf-btn):hover { transform: none; box-shadow: none; }

/* ── detail-page Buy entry (below the Direction cards) ─────────────────────────────────────────── */
.nav-trade-row { display: flex; flex-direction: column; gap: 7px; margin-top: 11px; }
.nav-trade-btn {
  flex: 1;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 46px;
  padding: 13px 18px;
  border: 1px solid #102f35;
  border-radius: 8px;
  background: #102f35;
  color: #fffefa;
  cursor: pointer;
  font-family: var(--mf-sans);
  font-size: 14px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    0 14px 28px rgba(16, 47, 53, 0.16);
  transition:
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    background var(--mf-duration-standard, 180ms) var(--mf-ease),
    box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease),
    transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.nav-trade-btn:hover {
  border-color: #0c424b;
  background: #0c424b;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    0 18px 34px rgba(16, 47, 53, 0.22);
  transform: translateY(-1px);
}
.nav-trade-btn:disabled,
.nav-trade-btn:disabled:hover {
  border-color: var(--mf-line-strong);
  background: var(--mf-paper);
  color: var(--mf-muted);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}
.nav-trade-btn:disabled .nav-trade-arrow { background: transparent; color: var(--mf-faint); }
.nav-trade-cap-reason { margin: 0; color: var(--mf-warn); font-size: 12px; line-height: 1.45; }
.nav-trade-btn:focus-visible { outline: 2px solid var(--mf-cyan); outline-offset: 2px; }
.nav-trade-label { font-weight: 720; font-size: 14px; line-height: 1.2; color: inherit; }
.nav-trade-arrow {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(116, 222, 235, 0.18);
  color: var(--mf-cyan);
  font-family: var(--mf-mono);
  font-size: 13px;
  line-height: 1;
  transform: translateY(-0.5px);
}
/* ── modal shell ──────────────────────────────────────────────────────────────────────────────── */
body.mf-modal-open { overflow: hidden; }
#mf-modal-host .mf-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(17, 19, 22, 0.32); backdrop-filter: blur(2px); }
#mf-modal-host .mf-modal {
  position: fixed; z-index: 91; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 32px)); max-height: min(88vh, 800px); display: flex; flex-direction: column;
  background: var(--mf-canvas); border: 1px solid rgba(17, 19, 22, 0.14); border-radius: var(--mf-radius);
  box-shadow: var(--mf-lift); font-family: var(--mf-sans); font-size: 14px; color: var(--mf-ink);
}
/* Modal entrance. openModal() rebuilds #mf-modal-host wholesale, so a mount animation runs once with no JS timer
   and nothing to clean up. Only a FRESH open carries .mf-modal-enter — a modal replacing one already on screen
   keeps its position instead of re-scaling. Durations are the design-system tokens, which
   prefers-reduced-motion already collapses to 0.01ms, so this needs no separate reduced-motion branch —
   with the literal fallback this file requires (see the :root alias block), or the whole shorthand is
   invalid at /trading/ and the entrance silently never runs.
   Entrance only, deliberately: a dialog appearing from nowhere is the jarring half. Dismissal is a decision the
   user already made, and removing it instantly reads as responsive rather than abrupt. */
#mf-modal-host .mf-scrim.mf-modal-enter {
  animation: mf-scrim-in var(--mf-duration-standard, 180ms) var(--mf-ease);
}
#mf-modal-host .mf-modal.mf-modal-enter {
  animation: mf-modal-in var(--mf-duration-deliberate, 260ms) var(--mf-ease);
}
@keyframes mf-scrim-in {
  from { opacity: 0; }
}
/* translate(-50%, -50%) is .mf-modal's centering transform — it has to be carried through BOTH keyframes, or the
   dialog animates in from the viewport's top-left corner instead of growing in place. */
@keyframes mf-modal-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
#mf-modal-host .mf-modal.mf-modal-tracking,
#mf-modal-host .mf-modal.mf-modal-budget {
  width: min(680px, calc(100vw - 32px));
  max-height: min(94vh, 840px);
}
#mf-modal-host .mf-modal.mf-modal-budget {
  max-height: min(calc(100vh - 24px), 840px);
}
.mf-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px 14px; border-bottom: 1px solid var(--mf-line); background: var(--mf-canvas); }
.mf-modal-title { font-family: var(--mf-sans); font-weight: 700; font-size: 20px; line-height: 1.12; color: var(--mf-graphite); }
.mf-modal-close {
  min-width: 0 !important; width: auto !important; height: auto !important; padding: 2px 6px !important; border: 0 !important;
  background: none !important; box-shadow: none !important;
  font-family: var(--mf-sans); font-size: 20px; line-height: 1; color: var(--mf-faint); cursor: pointer;
}
.mf-modal-close:hover { color: var(--mf-ink); }
.mf-modal-body { padding: 18px 24px 20px; overflow-y: auto; }
.mf-modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 24px 18px; border-top: 1px solid var(--mf-line); background: var(--mf-canvas); }
.mf-modal.mf-modal-budget .mf-modal-foot { padding: 10px 24px 12px; }

.mf-step-label { font-family: var(--mf-sans); font-size: 13px; font-weight: 680; letter-spacing: 0; text-transform: none; color: var(--mf-muted); margin: 0 0 8px; }
.mf-copy { font-family: var(--mf-sans); font-size: 14px; color: var(--mf-muted); line-height: 1.55; margin: 0 0 10px; }
.mf-copy.neg { color: var(--mf-neg); }
.mf-hint { font-family: var(--mf-sans); font-size: 13px; color: var(--mf-faint); line-height: 1.5; margin: 9px 0 0; }
.mf-min-hint { margin-top: -5px; }
.mf-min-hint.is-error {
  color: var(--mf-neg);
  font-weight: 620;
}
.mf-min-hint.is-error .mf-usdc-inline,
.mf-min-hint.is-error .mf-usdc-inline strong {
  color: var(--mf-neg);
}
.mf-hint b { font-family: var(--mf-mono); color: var(--mf-muted); font-weight: 600; }
.mf-usdc-icon { width: 16px; height: 16px; flex: none; display: block; }
.mf-usdc-badge,
.mf-usdc-inline,
.mf-amount-token {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.mf-usdc-badge {
  color: #2775ca;
  font-weight: var(--mf-pf-weight-middle);
  vertical-align: -3px;
}
.mf-usdc-badge span,
.mf-amount-token span {
  font-family: var(--mf-sans);
  letter-spacing: 0;
}
.mf-usdc-inline {
  color: var(--mf-muted);
  vertical-align: -3px;
}
.mf-usdc-inline strong {
  font-family: var(--mf-mono);
  color: var(--mf-muted);
  font-weight: var(--mf-pf-weight-middle);
  font-variant-numeric: tabular-nums;
}
.mf-usdc-cap {
  color: var(--mf-muted);
  vertical-align: -3px;
}
.mf-usdc-cap .mf-usdc-icon {
  width: 15px;
  height: 15px;
}
.mf-usdc-cap span {
  display: none;
}
.mf-contract {
  margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--mf-line-strong); border-radius: var(--mf-control-radius);
  font-family: var(--mf-sans); font-size: 13px; color: var(--mf-muted); line-height: 1.5;
}

.mf-steps {
  list-style: none;
  margin: 0 0 12px;
  padding: 2px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.72);
}
.mf-steps li {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: var(--mf-control-radius);
  background: transparent;
  color: var(--mf-muted);
}
.mf-steps li.active {
  border-color: rgba(83, 191, 205, 0.48);
  background: rgba(235, 252, 255, 0.78);
  color: var(--mf-graphite);
}
.mf-steps li.done { color: var(--mf-ink); }
.mf-step-num {
  flex: none;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: var(--mf-control-radius);
  background: #fffefa;
  border: 1px solid var(--mf-line-strong);
  font-family: var(--mf-mono);
  font-size: 11px;
  font-weight: 650;
}
.mf-steps li.active .mf-step-num {
  background: #fffefa;
  border-color: rgba(83, 191, 205, 0.68);
  color: var(--mf-cyan-ink);
}
.mf-steps b { display: block; font-size: 13px; font-weight: 680; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.mf-ticket {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
  padding: 12px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.74);
  margin-bottom: 14px;
}
.mf-ticket-main,
.mf-ticket-side {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
}
.mf-ticket span {
  font-family: var(--mf-sans);
  font-size: 12.5px;
  font-weight: 650;
  color: var(--mf-faint);
  letter-spacing: 0;
  text-transform: none;
}
.mf-ticket strong {
  min-width: 0;
  color: var(--mf-ink);
  font-size: 14px;
  font-weight: 680;
  line-height: 1.25;
}
.mf-ticket-side {
  padding: 0 0 0 14px;
  border-left: 1px solid var(--mf-line);
  text-align: right;
}
.mf-ticket-side.long strong { color: var(--mf-pos); }
.mf-ticket-side.short strong { color: var(--mf-cyan-ink); }

/* topic-tracking education: two focused pages before budget or payment */
.mf-tracking-page,
.mf-return-disclosure {
  width: 100%;
  margin: 0;
  padding: 7px 0 10px;
}
.mf-tracking-primer {
  border: 0;
}
.mf-tracking-kicker {
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-family: var(--mf-sans);
  font-size: 12px;
  font-weight: 720;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mf-cyan-ink);
}
.mf-tracking-kicker em {
  flex: none;
  color: var(--mf-faint);
  font-family: var(--mf-mono);
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
}
.mf-tracking-primer h4 {
  margin: 0;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 22px;
  font-weight: 740;
  line-height: 1.18;
  text-wrap: balance;
}
.mf-tracking-primer > p {
  margin: 8px 0 0;
  max-width: none;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 14px;
  line-height: 1.55;
  text-wrap: pretty;
}
.mf-tracking-primer > p b { color: var(--mf-ink); font-weight: 660; }
.mf-tracking-path {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 15px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.72);
  overflow: hidden;
}
.mf-tracking-path > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  column-gap: 8px;
  row-gap: 2px;
  align-items: center;
  padding: 11px 12px;
}
.mf-tracking-path > div + div { border-left: 1px solid var(--mf-line); }
.mf-tracking-path > div > span {
  grid-row: 1 / span 2;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(83, 191, 205, 0.48);
  border-radius: var(--mf-control-radius);
  color: var(--mf-cyan-ink);
  font-family: var(--mf-mono);
  font-size: 11px;
  font-weight: 680;
}
.mf-tracking-path b {
  min-width: 0;
  color: var(--mf-ink);
  font-family: var(--mf-sans);
  font-size: 12.5px;
  font-weight: 680;
  line-height: 1.2;
}
.mf-tracking-path small {
  min-width: 0;
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: 11.5px;
  line-height: 1.3;
}

.mf-return-risk-summary {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 15px 12px 13px;
  border: 1px solid rgba(168, 100, 31, 0.20);
  border-left: 3px solid rgba(168, 100, 31, 0.72);
  border-radius: var(--mf-radius);
  background: rgba(168, 100, 31, 0.055);
}
.mf-return-disclosure h4 {
  width: 100%;
  margin: 0;
  max-width: none;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-title-md);
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.16;
  letter-spacing: 0;
  text-wrap: pretty;
}
.mf-return-risk {
  color: #8b531b;
  font-weight: var(--mf-pf-weight-heading);
}
.mf-return-risk-summary > p {
  margin: 7px 0 0;
  max-width: none;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-body);
  line-height: 1.52;
  text-wrap: pretty;
}
.mf-return-risk-summary > p b { color: var(--mf-ink); font-weight: var(--mf-pf-weight-middle); }
.mf-return-compare {
  width: 100%;
  margin-top: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}
.mf-return-source {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 14px 15px;
  border: 1px solid var(--mf-line);
  border-top: 2px solid rgba(83, 191, 205, 0.72);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.72);
}
.mf-return-source.portfolio {
  border-top-color: rgba(168, 100, 31, 0.72);
  background: rgba(168, 100, 31, 0.055);
}
.mf-return-source > span {
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-pf-weight-middle);
}
.mf-return-source strong {
  overflow: hidden;
  color: var(--mf-graphite);
  font-family: var(--mf-mono);
  font-size: var(--mf-font-size-title-md);
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.1;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-return-source.portfolio strong {
  color: #8b531b;
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-title-sm);
  letter-spacing: 0;
}
.mf-return-source small {
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-label);
  line-height: 1.35;
  text-wrap: pretty;
}
.mf-return-not-equal {
  align-self: center;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(168, 100, 31, 0.42);
  border-radius: 50%;
  background: var(--mf-warn-soft);
  color: #8b531b;
  font-family: var(--mf-mono);
  font-size: 18px;
  font-weight: var(--mf-pf-weight-heading);
}
.mf-return-why {
  margin-top: 13px;
  padding: 10px 12px;
  border-left: 2px solid rgba(168, 100, 31, 0.68);
  background: rgba(168, 100, 31, 0.055);
}
.mf-return-why b {
  display: block;
  margin-bottom: 3px;
  color: #8b531b;
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-body-sm);
  font-weight: var(--mf-pf-weight-middle);
}
.mf-return-why p {
  margin: 0;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 12px;
  line-height: 1.45;
  text-wrap: pretty;
}
.mf-intro-skip {
  width: 100%;
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border-top: 1px solid var(--mf-line);
  color: var(--mf-ink);
  cursor: pointer;
}
.mf-intro-skip:hover { background: rgba(235, 252, 255, 0.34); }
.mf-intro-skip:focus-within { outline: 2px solid var(--mf-cyan); outline-offset: 2px; }
.mf-intro-skip input {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
  accent-color: var(--mf-cyan-ink);
}
.mf-intro-skip span {
  min-width: 0;
  display: grid;
  gap: 2px;
  font-family: var(--mf-sans);
  line-height: 1.4;
  text-wrap: pretty;
}
.mf-intro-skip b { color: var(--mf-ink); font-size: 12.5px; font-weight: 660; }
.mf-intro-skip small { color: var(--mf-faint); font-size: 11.5px; }

.mf-order-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.68);
}
/* Transfer-to-Main-Wallet confirm: a figure to read at a glance plus two short, iconed facts, replacing what
   used to be two dense paragraphs saying the same two things. Padding steps up from .mf-order-panel's
   default 14px — this panel carries one hero figure, not a stack of dense kv rows, and needs the room. */
.mf-collect-panel { gap: 18px; padding: 20px; }
.mf-collect-figure { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mf-collect-figure .mf-hero-value { font-size: var(--mf-font-size-title-lg); }
.mf-collect-figure-note { font-family: var(--mf-sans); font-size: var(--mf-font-size-meta); color: var(--mf-muted); }
.mf-collect-facts { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.mf-collect-facts li { display: flex; align-items: flex-start; gap: 10px; font-family: var(--mf-sans); font-size: var(--mf-font-size-body-sm); color: var(--mf-ink); line-height: 1.4; }
.mf-collect-facts svg { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--mf-cyan-ink); }
.mf-collect-facts b { font-weight: var(--mf-font-weight-semibold); }
.mf-collect-caveat { margin: 0; font-family: var(--mf-sans); font-size: var(--mf-font-size-label); color: var(--mf-faint); }

.mf-order-panel.is-error .mf-amount {
  border-color: rgba(200, 82, 97, 0.68);
  background: rgba(200, 82, 97, 0.045);
}

.mf-budget-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.94fr) minmax(0, 1.06fr);
  gap: 13px;
  align-items: start;
}
.mf-budget-grid > *,
.mf-budget-grid .mf-order-panel > * { min-width: 0; }
.mf-budget-left { min-width: 0; display: grid; gap: 11px; align-content: start; }
.mf-budget-grid .mf-copy { width: 100%; max-width: 100%; }
.mf-budget-estimate { margin-top: 13px; }
.mf-budget-grid .mf-budget-estimate { margin-top: 0; }
.mf-budget-estimate .mf-pay-hero { margin: 0 0 10px; }
.mf-budget-estimate .mf-breakdown { margin-top: 0; }
.mf-budget-estimate-empty,
.mf-budget-estimate-error {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 11px 13px;
  border: 1px dashed var(--mf-line-strong);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.54);
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: 12.5px;
  line-height: 1.45;
}
.mf-budget-estimate-error {
  display: grid;
  border-style: solid;
  border-color: rgba(200, 82, 97, 0.34);
  background: var(--mf-neg-soft);
  color: var(--mf-muted);
}
.mf-budget-estimate-error b { color: var(--mf-neg); font-size: 13px; }
.mf-budget-estimate-loading {
  min-height: 76px;
  border: 1px dashed var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.54);
}
.mf-budget-estimate-loading .mf-loading { padding: 17px 13px; }
.mf-budget-variable {
  margin-top: 9px;
  display: grid;
  gap: 2px;
  padding: 9px 11px;
  border-left: 2px solid rgba(83, 191, 205, 0.62);
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 12px;
  line-height: 1.45;
}
.mf-budget-variable b { color: var(--mf-ink); font-weight: 660; }

@media (max-width: 680px) {
  .mf-budget-grid { grid-template-columns: 1fr; }
  .mf-tracking-path { grid-template-columns: 1fr; }
  .mf-tracking-path > div + div { border-left: 0; border-top: 1px solid var(--mf-line); }
  .mf-tracking-primer h4 { font-size: 20px; }
  .mf-return-risk-summary { padding: 10px 10px 11px 8px; }
  .mf-return-disclosure h4 { font-size: 18px; }
  .mf-intro-skip { padding: 9px 7px; }
}
@media (max-width: 520px) {
  .mf-return-compare { grid-template-columns: 1fr; gap: 8px; }
  .mf-return-not-equal { justify-self: center; }
}

.mf-loading {
  display: grid;
  gap: 9px;
  padding: 24px 4px;
}
.mf-loading-line {
  height: 12px;
  width: 54%;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(17, 19, 22, 0.06), rgba(116, 222, 235, 0.2), rgba(17, 19, 22, 0.06));
  background-size: 200% 100%;
  animation: mf-shimmer 1.2s linear infinite;
}
.mf-loading-line.wide { width: 82%; }
.mf-loading p { margin: 4px 0 0; color: var(--mf-muted); font-size: 13px; }
@keyframes mf-shimmer { to { background-position: -200% 0; } }

/* amount input */
.mf-amount { display: flex; align-items: center; gap: 10px; border: 1px solid var(--mf-line-strong); border-radius: var(--mf-control-radius); padding: 10px 12px; background: rgba(255, 254, 250, 0.78); }
.mf-amount-cur { font-family: var(--mf-mono); color: var(--mf-faint); }
.mf-amount-token {
  min-height: 26px;
  padding-right: 10px;
  border-right: 1px solid var(--mf-line);
  color: #2775ca;
  font-size: 12.5px;
  font-weight: 720;
}
.mf-amount input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-family: var(--mf-mono); font-size: 22px; font-variant-numeric: tabular-nums; color: var(--mf-ink); }
/* Mirrors the token chip on the other flank of the amount row: same divider, same weight, so the row reads
   as one control rather than an input with a button bolted on. */
.mf-amount-max {
  flex: 0 0 auto;
  min-height: 26px;
  padding: 0 2px 0 10px;
  border: 0;
  border-left: 1px solid var(--mf-line);
  background: none;
  cursor: pointer;
  font-family: var(--mf-sans);
  font-size: 12.5px;
  font-weight: 720;
  letter-spacing: 0.02em;
  color: var(--mf-accent, #2775ca);
}
.mf-amount-max:hover { text-decoration: underline; }
.mf-amount-max:focus-visible { outline: 2px solid var(--mf-cyan); outline-offset: 2px; border-radius: 2px; }

/* ── Withdraw ──────────────────────────────────────────────────────────────────────────────────────
   Two views: you-send + recipient, then confirm. The layout follows the send-flow conventions a
   crypto-literate user already reads fluently (amount as the hero, network stated not assumed, address
   fingerprint, percentage shortcuts, From→To confirm) rendered in Instrument Paper — no glow, no gradient,
   no glass (PRODUCT.md anti-references, DESIGN.md §16). Motion follows §8: 180ms on the standard curve. */
.mf-wd { display: grid; gap: 14px; }

/* The amount panel is the one place this flow raises its voice, because the figure is the decision. */
.mf-wd-send {
  display: grid;
  gap: 9px;
  padding: 13px 14px;
  border: 1px solid var(--mf-line-strong);
  border-radius: var(--mf-control-radius);
  background: var(--mf-surface-subtle, rgba(246, 247, 244, 0.9));
}
.mf-wd-send-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 12px;
  font-weight: 650;
}
.mf-wd-chain {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--mf-graphite);
  font-size: 11.5px;
  font-weight: 650;
}
.mf-wd-chain .mf-usdc-icon { width: 14px; height: 14px; }
.mf-wd-send-row { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
/* Tabular so the figure does not reflow as it is typed. */
.mf-wd-amount {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--mf-ink);
  font-family: var(--mf-mono);
  font-size: 30px;
  font-variant-numeric: tabular-nums;
  font-weight: 620;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.mf-wd-amount::placeholder { color: var(--mf-faint); }
.mf-wd-amount:focus-visible { outline: 2px solid var(--mf-cyan); outline-offset: 3px; border-radius: 3px; }
.mf-wd-send-unit {
  flex: 0 0 auto;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 14px;
  font-weight: 700;
}
.mf-wd-send-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 8px;
  border-top: 1px solid var(--mf-line);
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 11.5px;
}
.mf-wd-send-foot strong { color: var(--mf-ink); font-family: var(--mf-mono); font-variant-numeric: tabular-nums; }
.mf-wd-send-foot .mf-usdc-icon { width: 11px; height: 11px; }
.mf-wd-quick { display: inline-flex; gap: 5px; }
/* 26px is below the 44px primary-action floor on purpose: these are optional shortcuts beside a field the
   user can always type into, which DESIGN.md §9 puts in the dense-secondary band. */
.mf-wd-pct {
  width: auto;
  min-width: 0;
  height: 26px;
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--mf-line-strong);
  border-radius: 999px;
  background: var(--mf-panel, #fffefa);
  box-shadow: none;
  color: var(--mf-graphite);
  cursor: pointer;
  font-family: var(--mf-sans);
  font-size: 11px;
  font-weight: 650;
  transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease), color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.mf-wd-pct:hover:not(:disabled) { transform: none; box-shadow: none; border-color: var(--mf-cyan); color: var(--mf-ink); }
.mf-wd-pct:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.mf-wd-pct:focus-visible { outline: 2px solid var(--mf-cyan); outline-offset: 2px; }

/* ── Recipient ─────────────────────────────────────────────────────────────────────────────────── */
.mf-wd-to { display: grid; gap: 7px; }
.mf-wd-addr-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--mf-line-strong);
  border-radius: var(--mf-control-radius);
  background: rgba(255, 254, 250, 0.78);
  transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.mf-wd-addr-row.is-resolved { border-color: var(--mf-cyan); }
.mf-wd-addr-row.is-invalid { border-color: var(--mf-neg); background: var(--mf-neg-soft); }
.mf-wd-addr-row:focus-within { outline: 2px solid var(--mf-cyan); outline-offset: 1px; }
/* A rejected field keeps focus (we send the caret back to it), so the ring has to agree with the error
   rather than sit a cyan "all good" outline on top of a red background. */
.mf-wd-addr-row.is-invalid:focus-within { outline-color: var(--mf-neg); }
.mf-wd-addr-input {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  height: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  outline: none;
  color: var(--mf-ink);
  font-family: var(--mf-mono);
  font-size: 13px;
  letter-spacing: 0.01em;
}
.mf-wd-addr-input::placeholder { color: var(--mf-faint); font-family: var(--mf-sans); letter-spacing: 0; }

.mf-transfer-address-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.mf-transfer-address-head .mf-chain-tag { padding: 3px 9px 3px 7px; font-size: 11.5px; }

/* ── Chain tag ─────────────────────────────────────────────────────────────────────────────────────
   Shared by every money surface that names a network (withdraw, the buy flow's transfer step, top-up).
   The mark keeps Polygon's own purple; everything around it stays on product tokens. */
.mf-chain-tag {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--mf-line);
  border-radius: 999px;
  background: var(--mf-panel, #fffefa);
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 12px;
  font-weight: 660;
  white-space: nowrap;
}
.mf-chain-icon { display: block; width: 14px; height: 14px; flex: 0 0 auto; }
.mf-wd-network-lead { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 5px; color: var(--mf-graphite); }
.mf-wd-network-lead strong { font-size: 11px; font-weight: 700; }
.mf-wd-network-lead .mf-chain-icon { width: 13px; height: 13px; }

.mf-wd-network { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--mf-muted); font-family: var(--mf-sans); font-size: 11px; line-height: 1.45; }

.mf-wd-err { color: var(--mf-neg); font-family: var(--mf-sans); font-size: 11.5px; font-weight: 620; line-height: 1.45; }

/* ── Quiet summary rows (entry view) ───────────────────────────────────────────────────────────── */
.mf-wd-summary { display: grid; gap: 5px; margin: 0; padding-top: 2px; }
.mf-wd-summary > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mf-wd-summary dt { color: var(--mf-muted); font-family: var(--mf-sans); font-size: 11.5px; }
.mf-wd-summary dd { margin: 0; color: var(--mf-graphite); font-family: var(--mf-sans); font-size: 12px; font-weight: 650; }
.mf-wd-summary dd.is-alt { color: var(--mf-warn); }

/* ── Confirm ───────────────────────────────────────────────────────────────────────────────────── */
.mf-wd-hero {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  padding: 4px 0 2px;
}
.mf-wd-hero-amount {
  color: var(--mf-ink);
  font-family: var(--mf-mono);
  font-size: 34px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.05;
}
.mf-wd-hero-unit { color: var(--mf-graphite); font-family: var(--mf-sans); font-size: 15px; font-weight: 700; }
.mf-wd-hero-chain { color: var(--mf-muted); font-family: var(--mf-sans); font-size: 12px; }

.mf-wd-rows { display: grid; gap: 0; margin: 0; border-top: 1px solid var(--mf-line); }
.mf-wd-rows > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--mf-line);
}
.mf-wd-rows dt { flex: 0 0 auto; color: var(--mf-muted); font-family: var(--mf-sans); font-size: 11.5px; }
.mf-wd-rows dd { margin: 0; min-width: 0; text-align: right; color: var(--mf-graphite); font-family: var(--mf-sans); font-size: 12.5px; font-weight: 650; }
.mf-wd-rows dd.is-alt { color: var(--mf-warn); }
.mf-wd-rows-to { align-items: flex-start; }
.mf-wd-rows-to dd { min-width: 0; text-align: left; }
/* One unbroken address. Grouping it read as formatting rather than as the value, and a person comparing
   against a wallet is matching a single string, not five pairs. */
.mf-wd-addr-full {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  color: var(--mf-ink);
  font-family: var(--mf-mono);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
}

.mf-wd-warn {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(150, 99, 28, 0.28);
  border-radius: var(--mf-control-radius);
  background: var(--mf-warn-soft);
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 11.5px;
  line-height: 1.45;
}
.mf-wd-warn strong { color: var(--mf-warn); }
/* The irreversibility line is the last thing read before money moves — negative ink, not warning ink. */
.mf-wd-warn.is-final { border-color: rgba(200, 82, 97, 0.28); background: var(--mf-neg-soft); }
.mf-wd-warn.is-final strong { color: var(--mf-neg); }

/* Submitting: the primary action states it is working rather than just going dead. */
.mf-btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.mf-btn.is-busy::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  content: "Working…";
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 12.5px;
  font-weight: 650;
}

@media (max-width: 520px) {
  .mf-wd-amount { font-size: 26px; }
  .mf-wd-hero-amount { font-size: 28px; }
  .mf-wd-send-foot { align-items: flex-start; }
  .mf-wd-rows > div { flex-direction: column; align-items: flex-start; gap: 3px; }
  .mf-wd-rows dd { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .mf-wd-pct, .mf-wd-addr-row { transition: none; }
}

.mf-wd-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.mf-wd-facts > div { min-width: 0; display: grid; gap: 3px; }
.mf-wd-facts dt {
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: 10.5px;
  font-weight: 620;
}
.mf-wd-facts dd {
  margin: 0;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 12px;
  font-weight: 650;
}
/* The sub-$2 rail is a different asset, not a warning — flagged, not alarmed. */
.mf-wd-facts dd.is-alt { color: var(--mf-cyan-ink); }

@media (max-width: 520px) {
  .mf-wd-field-head { flex-direction: column; align-items: flex-start; gap: 3px; }
}

/* key/value rows — sans label, mono value */
.mf-kv { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; padding: 4px 0; color: var(--mf-muted); }
.mf-kv span:first-child { font-family: var(--mf-sans); }
.mf-kv strong { font-family: var(--mf-mono); font-variant-numeric: tabular-nums; color: var(--mf-ink); font-weight: 600; }
.mf-usdc-kv {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}
.mf-usdc-kv .mf-usdc-icon {
  width: 14px;
  height: 14px;
}
.mf-usdc-kv span {
  font-family: var(--mf-mono);
  font-variant-numeric: tabular-nums;
}
.mf-usdc-money {
  color: currentColor;
  line-height: 1;
}
.mf-usdc-money .mf-usdc-icon {
  width: 14px;
  height: 14px;
}
.mf-usdc-money > span:not(.mf-usdc-sign) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mf-usdc-sign {
  display: inline-block;
  min-width: 0.62em;
  text-align: right;
}
.mf-kv-strong { border-top: 1px solid var(--mf-line); margin-top: 6px; padding-top: 9px; }
.mf-kv-strong span:first-child { color: var(--mf-ink); font-weight: 600; }

/* quiet in-app controls (DESIGN.md: 30-34px, small radius, cyan-soft go, no big dark primaries) */
.mf-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  width: auto;
  font-family: var(--mf-sans); font-size: 13px; font-weight: var(--mf-font-weight-semibold); height: 34px; padding: 0 14px; border-radius: var(--mf-control-radius);
  border: 1px solid var(--mf-line); background: rgba(255, 254, 250, 0.72); color: var(--mf-ink);
  cursor: pointer; text-decoration: none; transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease), background var(--mf-duration-standard, 180ms) var(--mf-ease), box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease), transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.mf-btn svg { width: 15px; height: 15px; flex: none; }
#mf-modal-host .mf-btn,
.mf-portfolio .mf-btn {
  font-weight: var(--mf-pf-weight-middle);
  letter-spacing: 0;
}
.mf-btn:hover { border-color: rgba(83, 191, 205, 0.62); background: #f4fdff; box-shadow: none; transform: translateY(-1px); }
.mf-btn:active { transform: translateY(1px); }
.mf-btn:focus-visible { outline: 2px solid var(--mf-cyan); outline-offset: 2px; }
.mf-btn-primary {
  background: rgba(235, 252, 255, 0.78);
  border-color: rgba(83, 191, 205, 0.48);
  color: var(--mf-graphite);
  font-weight: var(--mf-font-weight-semibold);
  box-shadow: none;
}
.mf-btn-primary:hover { background: #f4fdff; border-color: rgba(83, 191, 205, 0.62); }
.mf-modal-foot #mf-pay-go:not(:disabled),
.mf-modal-foot #mf-goto-pf,
.mf-modal-foot #mf-goto-pf-late,
.mf-modal-foot #mf-goto-pf-active,
.mf-btn-cta {
  background: #102f35;
  border-color: #102f35;
  color: #fffefa;
  box-shadow: 0 10px 22px rgba(16, 47, 53, 0.16);
}
.mf-modal-foot #mf-pay-go:not(:disabled):hover,
.mf-modal-foot #mf-goto-pf:hover,
.mf-modal-foot #mf-goto-pf-late:hover,
.mf-modal-foot #mf-goto-pf-active:hover,
.mf-btn-cta:hover {
  background: #0c424b;
  border-color: #0c424b;
}
.mf-btn-sm { height: 32px; padding: 0 12px; font-size: var(--mf-font-size-body-sm); }
.mf-btn-danger { color: var(--mf-neg); }
.mf-btn-danger:hover { border-color: var(--mf-neg); background: rgba(200, 82, 97, 0.06); }
.mf-modal-foot .mf-btn { min-width: 92px; }

/* legs table — mono numerics, sans leg name */
.mf-legs { width: 100%; border-collapse: collapse; margin-top: 13px; }
.mf-legs th, .mf-legs td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--mf-line); }
.mf-legs th { font-family: var(--mf-sans); font-size: 12px; letter-spacing: 0; text-transform: none; color: var(--mf-faint); font-weight: 650; }
.mf-legs td { font-family: var(--mf-mono); font-variant-numeric: tabular-nums; font-size: 13px; color: var(--mf-ink); }
.mf-legs td:first-child { font-family: var(--mf-sans); color: var(--mf-muted); }
.mf-legs .num, .mf-legs th.num { text-align: right; }

.mf-ledger {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.74);
}
.mf-ledger.compact { margin-top: 13px; }

/* ── security · custody trust strip (honest, structural claims only) ───────────────────────────── */
.mf-trust {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid rgba(154, 145, 122, 0.38);
  border-radius: var(--mf-radius);
  background: rgba(250, 248, 241, 0.92);
  box-shadow: 0 14px 30px rgba(64, 55, 37, 0.07);
  overflow: hidden;
  margin-top: 16px;
}
.mf-trust-cell {
  min-width: 0;
  min-height: 96px;
  padding: 17px 22px 16px;
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  align-content: center;
  row-gap: 10px;
  text-align: center;
}
.mf-trust-cell + .mf-trust-cell { border-left: 1px solid rgba(154, 145, 122, 0.24); }
.mf-trust-cell svg {
  width: 18px;
  height: 18px;
  padding: 6px;
  box-sizing: content-box;
  border: 1px solid rgba(93, 124, 82, 0.26);
  border-radius: 8px;
  background: rgba(238, 245, 233, 0.92);
  color: #5d7c52;
}
.mf-trust-cell span {
  display: block;
  min-width: 0;
  max-width: 220px;
  font-family: var(--mf-sans);
  font-size: 14px;
  font-weight: 400;
  color: var(--mf-graphite);
  line-height: 1.28;
  letter-spacing: 0;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
/* security · money-path (deposit/withdraw weld + honest escrow window) */
.mf-path {
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.72);
  padding: 13px;
  margin-top: 14px;
}
.mf-path-cap {
  font-family: var(--mf-sans);
  font-size: 13.5px;
  font-weight: 680;
  letter-spacing: 0;
  text-transform: none;
  color: var(--mf-graphite);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
}
.mf-path-cap .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mf-cyan);
  box-shadow: 0 0 0 4px rgba(116, 222, 235, 0.12);
}
.mf-flow {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr) 18px minmax(0, 1fr);
  align-items: stretch;
  gap: 7px;
}
.mf-node {
  min-width: 0;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid rgba(17, 19, 22, 0.085);
  border-radius: var(--mf-control-radius);
  background: rgba(255, 254, 250, 0.58);
  text-align: left;
}
.mf-node .chip {
  width: 34px;
  height: 34px;
  border-radius: var(--mf-control-radius);
  display: grid;
  place-items: center;
  border: 1px solid var(--mf-line-strong);
  background: var(--mf-canvas);
}
.mf-node .chip.you { border-color: rgba(22, 135, 101, 0.46); background: var(--mf-pos-soft); }
.mf-node .chip.escrow { border-style: dashed; border-color: rgba(168, 100, 31, 0.54); background: var(--mf-warn-soft); }
.mf-node .chip svg { width: 19px; height: 19px; color: var(--mf-ink); }
.mf-node .chip.you svg { color: var(--mf-pos); }
.mf-node .chip.escrow svg { color: var(--mf-warn); }
.mf-node small {
  min-width: 0;
  font-family: var(--mf-sans);
  font-size: 12.5px;
  color: var(--mf-muted);
  line-height: 1.28;
}
.mf-node small b {
  display: block;
  margin-bottom: 1px;
  color: var(--mf-ink);
  font-size: 13px;
  font-weight: 680;
}
.mf-arrow {
  display: grid;
  place-items: center;
  min-width: 18px;
}
.mf-arrow svg { width: 16px; height: 10px; color: var(--mf-faint); }
.mf-path-note {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--mf-line-strong);
  font-family: var(--mf-sans);
  font-size: 13px;
  color: var(--mf-muted);
  line-height: 1.5;
  text-wrap: pretty;
}
.mf-path-note b { color: var(--mf-ink); font-weight: 620; }

/* security · first-buy assurance (stacked list, not a card row) */
.mf-assure-head h4 { font-family: var(--mf-sans); font-weight: 680; font-size: 17px; margin: 0 0 6px; color: var(--mf-ink); }
.mf-assure-head p { font-family: var(--mf-sans); font-size: 13px; color: var(--mf-muted); margin: 0 0 14px; }
.mf-assure { display: flex; flex-direction: column; border: 1px solid var(--mf-line); border-radius: var(--mf-radius); overflow: hidden; }
.mf-assure-item { display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; background: var(--mf-canvas); }
.mf-assure-item + .mf-assure-item { border-top: 1px solid var(--mf-line); }
.mf-assure-item svg { width: 20px; height: 20px; color: var(--mf-cyan-ink); flex: none; margin-top: 1px; }
.mf-assure-item h5 { font-family: var(--mf-sans); font-weight: 680; font-size: 13px; margin: 0 0 3px; color: var(--mf-ink); }
.mf-assure-item p { font-family: var(--mf-sans); font-size: 13px; color: var(--mf-muted); margin: 0; line-height: 1.45; }

/* security · deposit-modal escrow footnote */
.mf-escrow-note {
  margin-top: 12px;
  padding: 10px 12px 10px 13px;
  background: rgba(255, 254, 250, 0.62);
  border: 1px solid var(--mf-line);
  border-left: 2px solid rgba(83, 191, 205, 0.62);
  border-radius: var(--mf-control-radius);
  font-family: var(--mf-sans);
  font-size: 13px;
  color: var(--mf-muted);
  line-height: 1.5;
  text-wrap: pretty;
}
.mf-escrow-note b { color: var(--mf-ink); font-weight: 620; }
.mf-addr {
  min-height: 38px;
  display: flex;
  align-items: center;
  font-family: var(--mf-mono);
  font-size: 13px;
  line-height: 1.35;
  word-break: break-all;
  padding: 8px 10px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-control-radius);
  background: rgba(255, 254, 250, 0.82);
  color: var(--mf-muted);
}

/* ── payment step (bottom line = what you pay; pre-pay vs on/off-ramp top-up) ────────────────────── */
.mf-pay-hero {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 14px 0 12px; padding: 14px 15px; border: 1px solid rgba(83, 191, 205, 0.48);
  background: rgba(235, 252, 255, 0.78); border-radius: var(--mf-radius);
}
.mf-pay-hero-label { font-family: var(--mf-sans); font-weight: 680; font-size: 14px; color: var(--mf-ink); }
.mf-pay-hero-val {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #102f35;
}
.mf-pay-hero-val .mf-usdc-icon {
  width: 21px;
  height: 21px;
}
.mf-pay-hero-val .mf-usdc-hero > span {
  display: none;
}
.mf-pay-hero-val strong {
  font-family: var(--mf-mono);
  font-variant-numeric: tabular-nums;
  font-size: 28px;
  font-weight: 720;
  color: #102f35;
}
.mf-pay-summary {
  margin: 14px 0 12px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.78);
  overflow: hidden;
}
.mf-pay-summary.covered {
  border-color: rgba(22, 135, 101, 0.34);
}
.mf-pay-summary-main {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 15px;
  background: rgba(255, 254, 250, 0.54);
}
.mf-pay-summary.covered .mf-pay-summary-main {
  background: rgba(255, 254, 250, 0.54);
}
.mf-pay-summary-main > span {
  font-family: var(--mf-sans);
  font-size: 14px;
  font-weight: 680;
  color: var(--mf-ink);
}
.mf-pay-summary-main strong,
.mf-pay-summary-item strong {
  font-family: var(--mf-mono);
  font-variant-numeric: tabular-nums;
  color: var(--mf-ink);
}
.mf-pay-summary-amount {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #102f35;
}
.mf-pay-summary-amount .mf-usdc-icon {
  width: 22px;
  height: 22px;
}
.mf-pay-summary-amount span {
  font-size: 28px;
  line-height: 1;
  font-weight: 720;
}
.mf-pay-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--mf-line);
}
.mf-pay-summary-item {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 13px;
}
.mf-pay-summary-item + .mf-pay-summary-item {
  border-left: 1px solid var(--mf-line);
}
.mf-pay-summary-item > span {
  min-width: 0;
  font-family: var(--mf-sans);
  font-size: 13px;
  font-weight: 620;
  color: var(--mf-muted);
  line-height: 1;
}
.mf-pay-summary-item strong {
  display: inline-flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex: none;
  font-size: 14px;
  font-weight: 680;
  line-height: 1;
}
.mf-pay-summary-shortfall.attention {
  background: rgba(181, 94, 23, 0.07);
  box-shadow: inset 0 0 0 1px rgba(181, 94, 23, 0.18);
}
.mf-pay-summary-item strong.pos { color: var(--mf-pos); }
.mf-pay-summary-item strong.warn { color: var(--mf-warn); }
.mf-pay-summary-kv {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: currentColor;
}
.mf-pay-summary-kv .mf-usdc-icon {
  width: 15px;
  height: 15px;
}
.mf-pay-summary-kv span { color: currentColor; }
.mf-pay-notice {
  margin-top: 12px;
  padding: 10px 12px;
  display: grid;
  gap: 3px;
  border: 1px solid rgba(181, 94, 23, 0.24);
  border-radius: var(--mf-control-radius);
  background: rgba(181, 94, 23, 0.065);
  color: var(--mf-muted);
}
.mf-pay-notice strong {
  font-family: var(--mf-sans);
  font-size: 13px;
  font-weight: var(--mf-pf-weight-middle);
  color: var(--mf-ink);
}
.mf-pay-notice span {
  font-family: var(--mf-sans);
  font-size: 13px;
  line-height: 1.45;
  color: var(--mf-muted);
}
.mf-pay-notice.is-positive {
  border-color: rgba(22, 135, 101, 0.3);
  background: rgba(232, 246, 238, 0.9);
}
.mf-pay-notice.is-positive strong { color: var(--mf-pos); }
.mf-pay-notice.is-negative {
  border-color: rgba(200, 82, 97, 0.3);
  background: rgba(252, 238, 240, 0.9);
}
.mf-pay-notice.is-negative strong { color: var(--mf-neg); }
.mf-breakdown { margin-top: 13px; padding: 11px 13px; border: 1px solid var(--mf-line); border-radius: var(--mf-radius); background: rgba(255, 254, 250, 0.68); }
.mf-breakdown-cap { font-family: var(--mf-sans); font-size: 13px; font-weight: 650; letter-spacing: 0; text-transform: none; color: var(--mf-muted); margin-bottom: 6px; }
.mf-breakdown .mf-kv { font-size: 13px; padding: 3px 0; }
.mf-pay-line {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 11px 13px; border: 1px solid var(--mf-line-strong); border-radius: var(--mf-radius); margin-bottom: 12px;
}
.mf-pay-line > span { font-family: var(--mf-sans); font-size: 13.5px; color: var(--mf-muted); }
.mf-pay-line strong { font-family: var(--mf-mono); font-variant-numeric: tabular-nums; font-size: 15px; font-weight: 600; color: var(--mf-ink); }
.mf-pay-line strong.pos { color: var(--mf-pos); }
.mf-pay-line-value {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.mf-pay-value .mf-usdc-icon,
.mf-pay-need-value .mf-usdc-icon,
.mf-pay-button-amount .mf-usdc-icon {
  width: 15px;
  height: 15px;
}
.mf-pay-value span,
.mf-pay-need-value span,
.mf-pay-button-amount span {
  color: currentColor;
}
.mf-pay-status {
  font-family: var(--mf-sans);
  font-size: 13px;
  font-weight: 620;
  color: var(--mf-muted);
}
.mf-pay-fund {
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.72);
  padding: 14px;
  margin-bottom: 12px;
}
.mf-pay-fund.deposit { margin-bottom: 0; }
.mf-pay-need {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 11px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--mf-line);
}
.mf-pay-need > span {
  font-family: var(--mf-sans);
  font-size: 13.5px;
  font-weight: 650;
  color: var(--mf-muted);
}
.mf-pay-need strong {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  font-family: var(--mf-mono);
  font-variant-numeric: tabular-nums;
  font-size: 18px;
  line-height: 1;
  font-weight: 700;
  color: var(--mf-warn);
}
.mf-pay-button-amount {
  color: currentColor;
}
.mf-pay-fund.deposit .mf-pay-need strong {
  font-size: 13.5px;
  color: var(--mf-graphite);
}
.mf-pay-fund .mf-copy {
  max-width: 66ch;
  margin-bottom: 11px;
}
.mf-pay-rails {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.mf-pay-rail {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-content: start;
  align-items: center;
  column-gap: 10px;
  row-gap: 4px;
  padding: 13px 14px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-control-radius);
  background: rgba(255, 254, 250, 0.78);
  color: var(--mf-ink);
  font-family: var(--mf-sans);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.42;
  text-align: left;
  min-height: 84px;
}
.mf-pay-rail-icon {
  grid-column: 1;
  grid-row: 1;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  align-self: center;
}
.mf-pay-rail-copy {
  display: contents;
}
.mf-pay-rail svg {
  width: 18px;
  height: 18px;
  color: var(--mf-cyan-ink);
  flex: none;
  margin: 0;
}
.mf-pay-rail b {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  display: block;
  margin: 0;
  font-family: var(--mf-sans);
  font-weight: 680;
  font-size: 13.5px;
  line-height: 1.25;
  color: var(--mf-ink);
  text-wrap: pretty;
}
.mf-pay-rail-sub {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  display: block;
  font-family: var(--mf-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--mf-muted);
  line-height: 1.42;
  text-wrap: pretty;
}
.mf-pay-rail-passive {
  background: rgba(255, 254, 250, 0.78);
  border-color: var(--mf-line);
}
.mf-pay-transfer.open {
  border-color: rgba(39, 117, 202, 0.42);
  background: rgba(39, 117, 202, 0.045);
}
.mf-pay-transfer {
  align-items: center;
}
.mf-pay-transfer b {
  margin: 0;
}
.mf-transfer-panel {
  margin: -2px 0 12px;
  padding: 10px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-control-radius);
  background: rgba(255, 254, 250, 0.84);
}
.mf-transfer-panel[hidden] { display: none; }
.mf-transfer-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.mf-transfer-panel-head > span {
  font-family: var(--mf-sans);
  font-size: 12.5px;
  font-weight: 620;
  color: var(--mf-muted);
}
.mf-transfer-row {
  display: grid;
  grid-template-columns: minmax(148px, 0.35fr) minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}
.mf-transfer-select {
  display: grid;
  gap: 6px;
}
.mf-transfer-select > span {
  font-family: var(--mf-sans);
  font-size: 12.5px;
  font-weight: 620;
  color: var(--mf-muted);
}
.mf-transfer-select select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-control-radius);
  background: rgba(255, 254, 250, 0.82);
  color: var(--mf-ink);
  font-family: var(--mf-sans);
  font-size: 14px;
  line-height: 1.2;
}
.mf-transfer-select select:focus {
  outline: none;
  border-color: rgba(39, 117, 202, 0.46);
  box-shadow: 0 0 0 3px rgba(39, 117, 202, 0.11);
}
.mf-transfer-select select:disabled {
  color: var(--mf-muted);
  opacity: 0.72;
}
.mf-transfer-fallback {
  margin-top: 8px;
}
.mf-transfer-fallback[hidden] { display: none; }
.mf-transfer-fallback .mf-hint {
  margin: 0 0 8px;
}
.mf-transfer-address-wrap {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.mf-transfer-address-wrap > span {
  font-family: var(--mf-sans);
  font-size: 12.5px;
  font-weight: 620;
  color: var(--mf-muted);
}
.mf-transfer-address-box {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-control-radius);
  background: rgba(255, 254, 250, 0.82);
  overflow: hidden;
}
/* Shown in full, wrapping, exactly like the withdraw destination. It used to ellipsis-truncate, which on
   an address someone is about to send real money TO is the one place truncation cannot be afforded — the
   copy button is the happy path, but the visible string is what gets checked against the sender's wallet. */
.mf-transfer-address {
  min-width: 0;
  padding: 9px 10px;
  color: var(--mf-ink);
  font-family: var(--mf-mono);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.mf-transfer-address-wrap.is-empty .mf-transfer-address {
  font-family: var(--mf-sans);
  color: var(--mf-muted);
}
.mf-transfer-address-wrap.is-loading .mf-transfer-address-box {
  background: rgba(39, 117, 202, 0.035);
}
.mf-transfer-address-wrap.is-loading .mf-transfer-address {
  font-family: var(--mf-sans);
  color: var(--mf-muted);
}
.mf-transfer-address-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.mf-transfer-spinner {
  width: 14px;
  height: 14px;
  flex: none;
  box-sizing: border-box;
  border: 2px solid rgba(39, 117, 202, 0.2);
  border-top-color: #2775ca;
  border-radius: 50%;
  animation: mf-transfer-spin 760ms linear infinite;
}
@keyframes mf-transfer-spin {
  to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
  .mf-transfer-spinner { animation: none; }
}
.mf-transfer-copy {
  appearance: none;
  align-self: stretch;
  min-width: 58px;
  padding: 0 12px;
  border: 0;
  border-left: 1px solid var(--mf-line);
  background: rgba(255, 254, 250, 0.9);
  color: var(--mf-ink);
  font-family: var(--mf-sans);
  font-size: 12.5px;
  font-weight: 620;
  cursor: pointer;
}
.mf-transfer-copy:hover:not(:disabled) {
  background: rgba(39, 117, 202, 0.055);
  color: #2775ca;
}
.mf-transfer-copy:disabled {
  cursor: default;
  color: var(--mf-faint);
}
@media (max-width: 640px) {
  .mf-transfer-row {
    grid-template-columns: 1fr;
  }
}
/* the card rail is a real launcher (opens the Privy funding modal) — quiet clickable affordance */
button.mf-pay-rail {
  appearance: none;
  cursor: pointer;
  font-family: var(--mf-sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--mf-ink);
  transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease), background var(--mf-duration-standard, 180ms) var(--mf-ease), box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease), transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}
#mf-modal-host button.mf-pay-rail:hover {
  border-color: rgba(83, 191, 205, 0.62);
  background: #f4fdff;
  box-shadow: 0 10px 22px rgba(14, 139, 168, 0.08);
  transform: translateY(-1px);
}
button.mf-pay-rail:active { transform: translateY(1px); }
button.mf-pay-rail:focus-visible { outline: 2px solid var(--mf-cyan); outline-offset: 2px; }
.mf-pay-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--mf-line);
}
.mf-ready {
  display: grid;
  gap: 3px;
  padding: 12px 13px;
  border: 1px solid rgba(22, 135, 101, 0.28);
  border-radius: var(--mf-radius);
  background: var(--mf-pos-soft);
  margin-bottom: 12px;
}
.mf-ready strong { color: var(--mf-pos); font-size: 13.5px; font-weight: 720; }
.mf-ready span { color: var(--mf-muted); font-size: 13px; line-height: 1.45; }
.mf-local-auth-card {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.68);
}
.mf-local-auth {
  width: min(100%, 360px);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.68);
}
.mf-local-auth span {
  grid-column: 1 / -1;
  font-family: var(--mf-sans);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  color: var(--mf-faint);
}
.mf-local-auth input {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--mf-line-strong);
  border-radius: var(--mf-control-radius);
  padding: 0 10px;
  background: var(--mf-canvas);
  color: var(--mf-ink);
  font-family: var(--mf-mono);
}
.mf-result {
  display: flex;
  gap: 16px;
  padding: 18px;
  border-radius: var(--mf-radius);
  border: 1px solid var(--mf-line-strong);
  background: rgba(255, 254, 250, 0.68);
}
.mf-result svg { width: 26px; height: 26px; flex: none; color: var(--mf-cyan-ink); }
.mf-result.ok { border-color: rgba(22, 135, 101, 0.24); background: var(--mf-pos-soft); }
.mf-result.ok svg { color: var(--mf-pos); }
.mf-result-confirmed {
  border-color: rgba(22, 135, 101, 0.38);
  background: rgba(232, 246, 238, 0.9);
  box-shadow: inset 0 0 0 1px rgba(22, 135, 101, 0.08);
}
.mf-result-pending {
  border-color: rgba(168, 100, 31, 0.36);
  background: rgba(252, 245, 235, 0.92);
  box-shadow: inset 0 0 0 1px rgba(168, 100, 31, 0.08);
}
.mf-result-blocked {
  border-color: rgba(113, 107, 96, 0.32);
  background: rgba(246, 244, 239, 0.9);
  box-shadow: inset 0 0 0 1px rgba(113, 107, 96, 0.08);
}
.mf-result-failed {
  border-color: rgba(200, 82, 97, 0.34);
  background: rgba(252, 238, 240, 0.9);
  box-shadow: inset 0 0 0 1px rgba(200, 82, 97, 0.08);
}
.mf-result-mark {
  width: 40px;
  height: 40px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #168765;
  color: #fff;
  box-shadow: 0 8px 18px rgba(22, 135, 101, 0.18);
}
.mf-result-mark svg {
  width: 22px;
  height: 22px;
  color: currentColor;
}
.mf-result-confirmed .mf-step-label {
  color: #168765;
}
.mf-result-pending .mf-result-mark {
  background: var(--mf-warn);
  box-shadow: 0 8px 18px rgba(168, 100, 31, 0.18);
}
.mf-result-blocked .mf-result-mark {
  background: #716b60;
  box-shadow: 0 8px 18px rgba(113, 107, 96, 0.16);
}
.mf-result-failed .mf-result-mark {
  background: var(--mf-neg);
  box-shadow: 0 8px 18px rgba(200, 82, 97, 0.18);
}
.mf-result-pending .mf-step-label { color: var(--mf-warn); }
.mf-result-blocked .mf-step-label { color: #716b60; }
.mf-result-failed .mf-step-label { color: var(--mf-neg); }
.mf-result-state {
  margin: 0 0 6px;
  font-family: var(--mf-sans);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 720;
  letter-spacing: 0;
}
.mf-result-pending .mf-result-state { color: var(--mf-warn); }
.mf-result-failed .mf-result-state { color: var(--mf-neg); }
.mf-result h4 { margin: 0 0 5px; color: var(--mf-ink); font-size: 20px; line-height: 1.18; font-weight: 740; }
.mf-result p { margin: 0; color: var(--mf-muted); font-size: 14px; line-height: 1.55; }
.mf-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.mf-btn-primary:disabled:hover { background: rgba(235, 252, 255, 0.78); border-color: rgba(83, 191, 205, 0.48); }

/* ── portfolio surface ────────────────────────────────────────────────────────────────────────── */
.mf-portfolio {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 10px 0 64px;
  font-family: var(--mf-sans);
  color: var(--mf-ink);
}
.mf-portfolio-detail {
  --mf-pf-panel: rgba(255, 254, 250, 0.92);
  --mf-pf-panel-muted: rgba(246, 248, 247, 0.88);
  /* Was rgba(20,34,39,…) — the most off-axis line colour in the product (B−R=19, G−R=14, visibly teal
     against the warm ground). Same axis as everything else now; alpha is unchanged, so weight does not move. */
  --mf-pf-line: var(--mf-border-subtle, rgba(17, 19, 22, 0.105));
  --mf-pf-line-strong: var(--mf-border-default, rgba(17, 19, 22, 0.18));
  --mf-pf-accent-soft: rgba(116, 222, 235, 0.13);
  --mf-pf-shadow: 0 12px 34px rgba(31, 45, 47, 0.045);
  display: grid;
  gap: 20px;
}
.mf-detail-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 32px;
}
.mf-detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 13px;
  font-weight: var(--mf-pf-weight-middle);
  text-decoration: none;
}
.mf-detail-back svg { width: 17px; height: 17px; transition:transform var(--mf-duration-fast, 120ms) var(--mf-ease); }
.mf-detail-back:hover { color: var(--mf-graphite); }
.mf-detail-back:hover svg { transform: translateX(-2px); }
.mf-detail-back:focus-visible { outline: 2px solid var(--mf-cyan); outline-offset: 4px; border-radius: 3px; }
/* The hero answers one question — what is this worth and am I up or down — so it carries one figure at one
   size. The four equal-weight stat tiles that used to live here moved into the money ledger, where they read
   as amounts that add up rather than four tiles competing at the same size. */
.mf-detail-hero {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding: 0 0 2px;
}

.mf-hero-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.mf-hero-figure { min-width: 0; display: grid; gap: 3px; }

.mf-hero-figure-label {
  margin: 0;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-pf-weight-middle);
}

.mf-hero-figure-line {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 6px 14px;
  min-width: 0;
}

.mf-hero-value {
  font-family: var(--mf-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--mf-font-size-display);
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--mf-graphite);
}

.mf-hero-value.is-closed { font-family: var(--mf-sans); font-size: var(--mf-font-size-title-lg); color: var(--mf-muted); }

.mf-hero-change {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  font-family: var(--mf-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--mf-font-size-body-lg);
  font-weight: var(--mf-font-weight-semibold);
}

.mf-hero-change em { font-style: normal; opacity: 0.72; }

/* Tighter than the shared .mf-usdc-kv gap (5px): sign, $ glyph, and number all sit flush against each other,
   so "+$32.81" reads as one figure instead of three spaced-out characters. Scoped to this one figure — every
   other dollar amount on the page keeps the shared spacing. */
.mf-hero-change .mf-usdc-kv { gap: 0; }
.mf-hero-change.pos { color: var(--mf-pos); }
.mf-hero-change.neg { color: var(--mf-neg); }

.mf-hero-figure-foot {
  margin: 2px 0 0;
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-meta);
}

.mf-hero-state {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.mf-detail-identity {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(180px, 0.75fr);
  align-items: stretch;
  gap: 8px;
}
.mf-identity-block {
  min-width: 0;
  min-height: 72px;
  box-sizing: border-box;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-md);
  background: var(--mf-pf-panel);
  box-shadow: var(--mf-pf-shadow);
}
.mf-theme-identity {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 10px 14px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    background var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.mf-theme-identity:hover {
  border-color: rgba(83, 191, 205, 0.48);
  background: rgba(244, 252, 252, 0.94);
}
.mf-theme-identity:focus-visible {
  outline: 2px solid var(--mf-cyan);
  outline-offset: 2px;
}
.mf-theme-identity > .mf-poscard-image {
  width: 50px;
  height: 50px;
  border-radius: 7px;
}
.mf-identity-copy {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 5px;
}
.mf-identity-block small {
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-meta);
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1;
}
.mf-theme-identity h2,
.mf-direction-identity strong {
  min-width: 0;
  margin: 0;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-title-md);
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.1;
  letter-spacing: 0;
}
.mf-theme-identity h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-direction-identity {
  display: grid;
  align-content: center;
  gap: 7px;
  padding: 10px 18px 10px 20px;
}
.mf-direction-identity strong {
  overflow-wrap: anywhere;
}
.mf-direction-identity-long,
.mf-direction-identity-short {
  border-color: var(--mf-line-strong);
  background: rgba(154, 145, 122, 0.09);
  box-shadow: inset 3px 0 0 rgba(97, 94, 86, 0.58), var(--mf-pf-shadow);
}
.mf-direction-identity-long strong,
.mf-direction-identity-short strong { color: var(--mf-graphite); }
.mf-detail-identity-meta {
  grid-column: 1 / -1;
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}
.mf-detail-status {
  min-height: 44px;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 10px;
  border: 1px solid var(--mf-pf-line-strong);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-pf-panel-muted);
  color: var(--mf-muted);
  font-family: var(--mf-sans);
}
.mf-detail-status-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border: 2px solid rgba(255, 254, 250, 0.92);
  border-radius: var(--mf-radius-round);
  background: currentColor;
  box-shadow: 0 0 0 2px currentColor;
}
.mf-detail-status-copy {
  display: grid;
  gap: 3px;
}
.mf-detail-status-copy small {
  color: currentColor;
  font-size: 9.5px;
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1;
  opacity: 0.78;
}
.mf-detail-status-copy strong {
  color: currentColor;
  font-size: 14px;
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1;
  white-space: nowrap;
}
.mf-ai-management-control {
  display: inline-flex;
  flex: none;
  align-items: center;
  margin-left: auto;
  padding: 5px 8px;
  border: 1px solid currentColor;
  border-radius: var(--mf-radius-round);
  background: rgba(255, 255, 255, 0.42);
  color: currentColor;
  cursor: pointer;
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-meta);
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.15;
  transition: background var(--mf-duration-standard, 180ms) var(--mf-ease), opacity var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.mf-ai-management-control:hover:not(:disabled) { background: rgba(255, 255, 255, 0.72); }
.mf-ai-management-control:focus-visible {
  outline: 2px solid var(--mf-cyan);
  outline-offset: 2px;
}
.mf-ai-management-control.is-disabled {
  cursor: default;
  opacity: 0.82;
  border-color: rgba(200, 82, 97, 0.42);
  background: rgba(200, 82, 97, 0.10);
}
.mf-detail-status-holding {
  border-color: rgba(22, 135, 101, 0.36);
  background: var(--mf-pos-soft);
  color: var(--mf-pos);
}
.mf-detail-status-building {
  border-color: rgba(168, 100, 31, 0.30);
  background: rgba(252, 245, 235, 0.94);
  color: var(--mf-warn);
}
.mf-detail-status-rebalancing {
  border-color: rgba(168, 100, 31, 0.34);
  background: var(--mf-warn-soft);
  color: var(--mf-warn);
}
.mf-detail-status-attention {
  border-color: rgba(200, 82, 97, 0.36);
  background: var(--mf-neg-soft);
  color: var(--mf-neg);
}
.mf-detail-status-closed,
.mf-detail-status-neutral {
  border-color: var(--mf-line-strong);
  background: rgba(154, 145, 122, 0.09);
  color: var(--mf-muted);
}
/* Settlement (TAS-2391): resolved-but-self-finishing — visually distinct from plain closed (the label carries
   the semantics; the tint only reinforces it, per the no-color-only rule). */
.mf-detail-status-settlement {
  border-color: rgba(31, 122, 112, 0.32);
  background: rgba(227, 242, 239, 0.85);
  color: var(--mf-accent-ink, #0e6a61);
}
.mf-detail-capital {
  min-width: 0;
}
.mf-detail-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  overflow: hidden;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-md);
  background: var(--mf-pf-panel);
  box-shadow: var(--mf-pf-shadow);
}
.mf-detail-stat {
  position: relative;
  min-width: 0;
  min-height: 122px;
  display: grid;
  justify-items: end;
  align-content: center;
  gap: 11px;
  padding: 14px 16px 13px;
  color: var(--mf-ink);
  font-family: var(--mf-mono);
  font-size: var(--mf-font-size-title-md);
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.mf-detail-stat + .mf-detail-stat { border-left: 1px solid var(--mf-pf-line); }
.mf-detail-stat small {
  overflow: hidden;
  max-width: 100%;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-detail-stat > .mf-usdc-money,
.mf-detail-stat > span > .mf-usdc-money { font-size: var(--mf-font-size-title-md); }
.mf-detail-stat .mf-usdc-icon { width: 15px; height: 15px; }
.mf-pf-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: stretch;
  gap: 8px;
  margin-bottom: 14px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  overflow: visible;
}
.mf-metric {
  min-width: 0;
  min-height: 66px;
  display: grid;
  align-content: center;
  padding: 14px 16px;
  border: 1px solid rgba(154, 145, 122, 0.22);
  border-radius: 7px;
  background: rgba(255, 254, 250, 0.72);
  box-shadow: 0 12px 26px rgba(42, 53, 55, 0.035);
}
.mf-metric-label { font-family: var(--mf-sans); font-size: 12.5px; font-weight: 650; letter-spacing: 0; text-transform: none; color: var(--mf-faint); margin-bottom: 7px; }
.mf-metric-val { font-family: var(--mf-mono); font-size: 16px; line-height: 1; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--mf-ink); }
.mf-metric-cash-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
/* Withdraw sits inside the Cash card because prepaid cash is the only bucket it moves — Collect fills this
   bucket from Direction wallets, Withdraw is the way out of it. min-width/min-height/height/box-shadow all
   opt out of the global `button` CTA base (132px min-width, 54px tall, dark fill, drop shadow) at the top of
   this sheet; a min-* clamps regardless of specificity, so declaring width alone is not enough. */
.mf-cash-withdraw {
  flex: 0 0 auto;
  margin-left: auto;
  /* width:auto is load-bearing at <=620px, where the sheet's global `button { width: 100% }` would otherwise
     stretch this pill across the whole Cash card. */
  width: auto;
  min-width: 0;
  height: 26px;
  min-height: 26px;
  padding: 0 11px;
  border: 1px solid rgba(154, 145, 122, 0.34);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.9);
  box-shadow: none;
  color: var(--mf-graphite);
  cursor: pointer;
  font-family: var(--mf-sans);
  font-size: 11.5px;
  font-weight: 660;
  letter-spacing: 0;
  transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease), background var(--mf-duration-standard, 180ms) var(--mf-ease), color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
/* `button:hover`/`button:disabled` outrank the base rule above, so the global lift, shadow and dim have to
   be cancelled from our own state rules. */
.mf-cash-withdraw:hover:not(:disabled),
.mf-cash-withdraw:active:not(:disabled) {
  transform: none;
  box-shadow: none;
}
.mf-cash-withdraw:hover:not(:disabled) {
  border-color: var(--mf-cyan);
  background: #fffefa;
  color: var(--mf-ink);
}
.mf-cash-withdraw:focus-visible {
  outline: 2px solid var(--mf-cyan);
  outline-offset: 2px;
}
.mf-cash-withdraw:disabled {
  transform: none;
  box-shadow: none;
  opacity: 0.42;
  cursor: default;
}
.mf-pf-valuation-note {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: -6px 0 14px;
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: 11.5px;
  line-height: 1.4;
}
.mf-pf-valuation-note strong { color: var(--mf-muted); font-weight: 680; }
.mf-funding-surfaces {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
}
.mf-funding-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--mf-line-strong);
  border-left: 3px solid var(--mf-pos);
  border-radius: var(--mf-radius);
  background: var(--mf-canvas);
  color: var(--mf-ink);
}
.mf-funding-notice.is-attention {
  align-items: flex-start;
  border-left-color: var(--mf-warn);
  background: var(--mf-warn-soft);
}
.mf-funding-notice-copy { min-width: 0; }
.mf-funding-notice h3 {
  margin: 3px 0 5px;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 16px;
  line-height: 1.25;
}
.mf-funding-notice p {
  margin: 0;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 13px;
  line-height: 1.45;
}
.mf-funding-notice .mf-hint { margin-top: 7px; color: var(--mf-warn); }
.mf-funding-notice-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 11px;
}
.mf-funding-notice-facts span { display: grid; gap: 2px; }
.mf-funding-notice-facts small {
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: 11px;
}
.mf-funding-notice-facts strong {
  color: var(--mf-ink);
  font-family: var(--mf-mono);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.mf-funding-notice-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 8px;
}
.mf-poslist { display: flex; flex-direction: column; gap: 12px; }
.mf-poscard {
  position: relative;
  border: 1px solid rgba(154, 145, 122, 0.28);
  border-radius: var(--mf-radius-md);
  background: rgba(255, 254, 250, 0.86);
  box-shadow: 0 18px 42px rgba(36, 43, 45, 0.055);
  overflow: hidden;
  transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease), background var(--mf-duration-standard, 180ms) var(--mf-ease), box-shadow var(--mf-duration-standard, 180ms) var(--mf-ease), transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.mf-poscard::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--mf-cyan); opacity: 0.52; pointer-events: none; transition: opacity var(--mf-duration-standard, 180ms) var(--mf-ease); }
.mf-poscard:hover { border-color: rgba(83, 191, 205, 0.52); background: rgba(255, 254, 250, 0.96); box-shadow: 0 22px 48px rgba(36, 43, 45, 0.075); transform: translateY(-1px); }
.mf-poscard:hover::before { opacity: 0.92; }
.mf-poscard-hero {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  transition: none;
}
.mf-poscard-hero::before { display: none; }
.mf-poscard-hero:hover {
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  transform: none;
}
.mf-portfolio .mf-poscard .mf-poscard-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(450px, max-content);
  align-items: center;
  gap: 22px;
  width: 100%;
  inline-size: 100%;
  min-height: 86px;
  box-sizing: border-box;
  padding: 16px 18px 16px 20px;
  border: 0;
  background: none;
  color: var(--mf-ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-family: var(--mf-sans);
  font-weight: var(--mf-pf-weight-body);
}
.mf-portfolio .mf-poscard.mf-poscard-hero .mf-poscard-row {
  min-height: 64px;
  padding: 0;
}
.mf-poscard-row:hover { background: rgba(235, 252, 255, 0.18); }
.mf-poscard-row:active { transform: translateY(1px); }
.mf-poscard-row:focus-visible {
  outline: 2px solid var(--mf-cyan);
  outline-offset: -2px;
}
.mf-poscard-row-static,
.mf-poscard-row-static:hover {
  cursor: default;
  background: none;
}
.mf-poscard-row-static:active { transform: none; }
.mf-poscard-main { min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: 14px; }
.mf-poscard-image {
  flex: none;
  width: 52px;
  height: 52px;
  overflow: hidden;
  border: 1px solid rgba(17, 19, 22, 0.105);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(116, 222, 235, 0.13), rgba(255, 254, 250, 0.72)),
    rgba(255, 254, 250, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}
.mf-poscard-image.has-image { background: #f7f5ef; }
.mf-poscard-image img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* The initials/gradient fallback used to drop the border a real photo keeps (.mf-poscard-image's own
   inset top-highlight still applied underneath, unnoticed) — the one avatar most positions actually show,
   since a real image is the exception, was the one left without a defined edge against the page. */
.mf-poscard-image-empty { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, hsl(var(--ph-hue, 210) 52% 44%), hsl(calc(var(--ph-hue, 210) + 42) 58% 26%)); }
.mf-poscard-image .ph-initials { font-size: 16px; letter-spacing: 0; }
.mf-poscard-copy { min-width: 0; display: grid; align-content: center; justify-items: start; gap: 5px; }
.mf-poscard-titleline { min-width: 0; display: flex; align-items: center; justify-content: flex-start; gap: 12px; }
.mf-poscard-name { font-family: var(--mf-sans); font-weight: var(--mf-pf-weight-heading); font-size: 16px; line-height: 1.12; color: var(--mf-graphite); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-poscard-submeta { min-width: 0; font-family: var(--mf-sans); font-size: var(--mf-font-size-body-sm); line-height: 1.12; color: var(--mf-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-poscard-wallet {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: 12px;
  line-height: 1.1;
}
.mf-poscard-wallet[hidden] { display: none; }
.mf-poscard-wallet > svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--mf-faint);
}
.mf-poscard-wallet > span {
  flex: none;
  font-weight: var(--mf-pf-weight-middle);
  color: var(--mf-faint);
}
.mf-poscard-wallet a {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  color: var(--mf-cyan-ink);
  font-family: var(--mf-mono);
  font-size: 12px;
  font-weight: var(--mf-pf-weight-middle);
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-poscard-wallet a > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mf-poscard-wallet a svg { width: 12px; height: 12px; flex: none; }
.mf-poscard-wallet a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mf-poscard-wallet em {
  flex: none;
  font-style: normal;
  color: var(--mf-faint);
  font-family: var(--mf-mono);
  font-size: var(--mf-font-size-label);
}
.mf-detail-wallet {
  min-width: 0;
  min-height: 44px;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-pf-panel);
}
.mf-detail-wallet[hidden] { display: none; }
.mf-detail-wallet > svg {
  width: 14px;
  height: 14px;
  color: var(--mf-cyan-ink);
}
.mf-detail-wallet > span {
  color: var(--mf-faint);
  font-size: 12px;
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1.2;
  white-space: nowrap;
}
.mf-detail-wallet a {
  justify-self: end;
  max-width: 100%;
  min-height: 28px;
  box-sizing: border-box;
  padding: 4px 7px;
  border: 1px solid rgba(14, 139, 168, 0.24);
  border-radius: 5px;
  background: var(--mf-pf-accent-soft);
  font-size: 12px;
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1;
}
.mf-detail-wallet a svg { width: 11px; height: 11px; }
.mf-detail-wallet a:hover {
  border-color: rgba(14, 139, 168, 0.4);
  background: rgba(116, 222, 235, 0.20);
  text-decoration: none;
}
.mf-badge { flex: none; max-width: min(28ch, 38vw); overflow: hidden; text-overflow: ellipsis; font-family: var(--mf-sans); font-size: 12px; font-weight: var(--mf-pf-weight-middle); letter-spacing: 0; text-transform: none; padding: 2px 7px; border: 1px solid var(--mf-line-strong); border-radius: var(--mf-radius-xs); color: var(--mf-muted); white-space: nowrap; }
.mf-badge-long { color: var(--mf-pos); border-color: rgba(22, 135, 101, 0.4); background: var(--mf-pos-soft); }
.mf-badge-short { color: var(--mf-cyan-ink); border-color: rgba(14, 139, 168, 0.35); }
/* Position state on the card. This is the LIFECYCLE label (Holding / Verifying transfer / Action needed),
   not the old status+attempt line — the attempt bookkeeping it used to carry ("Current attempt · Attempt 2")
   is gone for good, but a card that never says what state the position is in is not a lighter card, it is a
   card missing the one thing the row exists to report. */
.mf-poscard-submeta { min-width: 0; font-family: var(--mf-sans); font-size: 12.5px; line-height: 1.12; color: var(--mf-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 680px) { .mf-poscard-submeta { max-width: 100%; } }
.mf-poscard-nums {
  justify-self: end;
  display: grid;
  grid-template-columns: repeat(4, minmax(88px, max-content));
  justify-content: end;
  align-items: stretch;
  gap: 1px;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(154, 145, 122, 0.20);
  border-radius: 7px;
  background: rgba(154, 145, 122, 0.18);
}
.mf-poscard-num {
  min-width: 0;
  min-height: 46px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  padding: 9px 10px;
  background: rgba(255, 254, 250, 0.78);
  text-align: right;
  font-family: var(--mf-mono);
  font-size: 14px;
  line-height: 1.12;
  font-weight: var(--mf-pf-weight-middle);
  font-variant-numeric: tabular-nums;
  color: var(--mf-ink);
}
.mf-poscard-num small { display: block; margin-bottom: 4px; font-family: var(--mf-sans); font-size: var(--mf-font-size-label); line-height: 1.12; font-weight: var(--mf-pf-weight-middle); letter-spacing: 0; text-transform: none; color: var(--mf-faint); white-space: nowrap; }
.mf-poscard-num > span { display: block; font-family: var(--mf-mono); font-size: 14px; line-height: 1.12; font-weight: var(--mf-pf-weight-middle); font-variant-numeric: tabular-nums; }
.mf-metric-val .mf-usdc-money,
.mf-poscard-num > .mf-usdc-money,
.mf-market-metrics strong .mf-usdc-money,
.mf-lot-metrics strong .mf-usdc-money,
.mf-value-record strong .mf-usdc-money,
.mf-activity-table .mf-usdc-money {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  max-width: 100%;
}
.mf-poscard-num > .mf-usdc-money {
  margin-left: auto;
}
.mf-value-record strong .mf-usdc-money .mf-usdc-icon {
  width: 11px;
  height: 11px;
}
.mf-chart-usdc-icon {
  overflow: visible;
}
.mf-poscard-detail { padding: 14px 16px 16px 20px; border-top: 1px solid var(--mf-line); background: rgba(255, 254, 250, 0.58); }
.mf-poscard-detail-page {
  padding: 0;
  border-top: 0;
  background: transparent;
}
.mf-poscard-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.mf-group-detail { display: grid; gap: 32px; }

/* The position's headline figure. It now sits in the hero's top-right corner, in .mf-hero-state, beside the
   action band — not in a section of its own below the identity, and not stacked above the buttons either. */
.mf-position-headline { min-width: 0; display: grid; gap: 3px; align-content: start; }
.mf-position-headline.is-attention .mf-fundstage-state,
.mf-position-headline.is-attention .mf-fundstage-desc { color: var(--mf-status-negative, #c85261); }

/* Left-aligned: with the actions beside it rather than below, there is no longer a button row underneath to
   keep flush with, and left alignment reads like the rest of the page (title, direction) instead of the
   figure hugging the gap before the buttons. justify-items:start lets each row (label, figure, foot) shrink
   to its own width, rather than all three stretching to the widest row's width. */
.mf-hero-state .mf-position-headline { justify-items: start; text-align: left; }
.mf-hero-state .mf-hero-figure-line { justify-content: flex-start; }

/* A second measure beside the position's own, only once basket cash stops being working capital (see
   directionCashSummary's `elevated`). The divider reads the two as separate figures, not one merged stat —
   and it fills the gap this corner otherwise leaves empty once an active exit clears the action band.
   align-self:stretch (overriding .mf-hero-state's align-items:center for this one child) makes the box span
   the row's full height, so the border reads as a proper column rule; .mf-position-headline's own
   align-content:start then packs the label to the TOP of that height, flush with Position Value's label
   instead of centered against the taller desc-bearing column beside it. */
.mf-hero-state .mf-hero-cash {
  align-self: stretch;
  padding-left: 20px;
  border-left: 1px solid var(--mf-pf-line);
}

/* Readable measure (DESIGN.md-adjacent ~45-75ch) instead of the 34ch column width sized for a headline
   figure with room-to-spare beside it — the same text at 34ch wrapped to twice the lines for no reason once
   this corner has nothing else stealing its width. */
.mf-hero-state .mf-fundstage-desc { max-width: 60ch; }

/* Key-scale: the display step (40px) was sized for a full-width headline. Squeezed into a corner column
   alongside two buttons and a wallet link, it now uses the same title-lg step the page already drops to on
   narrow viewports (DESIGN.md §4.3) — one deliberate step down, not an arbitrary shrink. The change figure
   steps down with it (body-lg → body) to keep the same size relationship to the headline number. */
.mf-hero-state .mf-hero-value { font-size: var(--mf-font-size-title-lg); }
.mf-hero-state .mf-hero-change { font-size: var(--mf-font-size-body); }

.mf-fundstage-label { font-family: var(--mf-sans); font-size: var(--mf-font-size-body-sm); font-weight: var(--mf-pf-weight-middle); color: var(--mf-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf-fundstage-state {
  margin-left: auto; flex: none;
  font-family: var(--mf-sans); font-size: var(--mf-font-size-meta); font-weight: var(--mf-pf-weight-middle);
  color: var(--mf-muted);
  padding: 2px 7px; border-radius: var(--mf-radius-round); background: var(--mf-surface-sunk, rgba(17, 19, 22, 0.05));
  white-space: nowrap;
}
.mf-fundstage-amt {
  margin: 0;
  font-family: var(--mf-mono);
  font-variant-numeric: tabular-nums;
  font-size: var(--mf-font-size-title-sm);
  font-weight: var(--mf-font-weight-semibold);
  color: var(--mf-graphite);
  line-height: 1.15;
}
.mf-fundstage-desc { font-family: var(--mf-sans); font-size: var(--mf-font-size-meta); line-height: 1.45; color: var(--mf-muted); margin: 0; max-width: 34ch; }
.mf-fund-btn { font-size: var(--mf-font-size-body-sm); padding: 7px 13px; }

/* Basket cash: a standalone card in "What you hold", not a market row — it has no shares, target, or
   weight, so it gets a simpler two-column layout (label+note left, figure right) instead of the 5-metric
   grid. Card chrome matches .mf-market-list's own so it reads as a peer, not a nested item inside the list. */
.mf-cash-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin: 0 0 12px;
  padding: 14px 16px;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-md);
  background: var(--mf-pf-panel);
  box-shadow: var(--mf-pf-shadow);
}
.mf-cash-card .mf-fundstage-desc { max-width: 52ch; margin-top: 4px; }
.mf-cash-card-amount { display: grid; justify-items: end; gap: 4px; text-align: right; }
.mf-cash-card.is-attention .mf-fundstage-state,
.mf-cash-card.is-attention .mf-fundstage-amt { color: var(--mf-status-negative, #c85261); }

/* Elevated: the cash stopped being working capital and became a result to act on. DESIGN.md §3.6 assigns the
   3px cyan rail to "selection or measurement continuity" and warns it must not appear on every card — this is
   exactly that exception, one card at one moment, carrying the only money action on the surface. */
.mf-cash-card.is-elevated {
  border-left: var(--mf-signal-rail-width, 3px) solid var(--mf-cyan);
  background: var(--mf-surface-panel, #fffefa);
  box-shadow: var(--mf-pf-shadow);
}
/* One step up the §4.3 ladder — enough to outrank the market rows beneath it without competing with the
   position's own headline figure in the hero. */
.mf-cash-card.is-elevated .mf-fundstage-amt { font-size: var(--mf-font-size-title-md); }
.mf-cash-card.is-elevated .mf-market-title span { color: var(--mf-graphite); }
.mf-cash-card-act { margin-top: 8px; }
.mf-cash-card-handoff {
  margin: 6px 0 0;
  max-width: 56ch;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-meta);
  line-height: 1.45;
}
.mf-cash-card-handoff b { font-weight: var(--mf-font-weight-semibold); color: var(--mf-ink); }

@media (max-width: 620px) {
  .mf-cash-card { grid-template-columns: minmax(0, 1fr); }
  .mf-cash-card-amount { justify-items: start; text-align: left; }
}

.mf-performance-section { min-width: 0; display: grid; gap: 14px; }
.mf-performance-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px 24px;
}
.mf-tab-section-head > div > span {
  display: block;
  margin-bottom: 5px;
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: 11px;
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1;
}
.mf-performance-head h2 {
  flex: 0 0 auto;
  min-width: 0;
  margin: 0;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-title-sm);
  font-weight: var(--mf-font-weight-bold);
  line-height: 1.1;
  letter-spacing: 0;
  white-space: nowrap;
}
.mf-performance-head .mf-chart-controls {
  width: auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: 100%;
  margin: 0;
}
.mf-performance-head .mf-chart-range {
  max-width: 100%;
  flex-wrap: nowrap;
  gap: 4px;
  padding: 4px;
  overflow-x: auto;
  border-color: var(--mf-pf-line);
  border-radius: 8px;
  background: var(--mf-pf-panel-muted);
  scrollbar-width: none;
}
.mf-performance-head .mf-chart-range::-webkit-scrollbar { display: none; }
.mf-performance-head .chart-range-button {
  flex: 0 0 auto;
  min-width: 42px;
  height: 30px;
  min-height: 30px;
  padding: 0 9px;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 12px;
  font-weight: var(--mf-font-weight-semibold);
  letter-spacing: 0;
}
.mf-performance-head .chart-range-button.active {
  border-color: rgba(14, 139, 168, 0.30);
  background: rgba(255, 254, 250, 0.96);
  box-shadow: none;
  color: var(--mf-cyan-ink);
}
.mf-performance-head .mf-custom-range {
  width: auto;
  min-width: 0;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--mf-muted);
}
.mf-performance-head .mf-custom-range.hidden { display: none; }
.mf-performance-head .mf-custom-range .range-custom-input,
.mf-performance-head .mf-custom-range .range-custom-apply {
  height: 30px;
  min-height: 30px;
  box-sizing: border-box;
  border: 1px solid var(--mf-pf-line);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.86);
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}
.mf-performance-head .mf-custom-range .range-custom-input {
  width: 108px;
  padding: 0 8px;
  font-variant-numeric: tabular-nums;
  color-scheme: light;
}
.mf-performance-head .mf-custom-range .range-custom-input::-webkit-datetime-edit {
  padding: 0;
  font: inherit;
}
.mf-performance-head .mf-custom-range .range-custom-input:focus {
  outline: none;
  border-color: rgba(83, 191, 205, 0.68);
  box-shadow: none;
}
.mf-performance-head .mf-custom-range .range-custom-apply {
  width: auto;
  min-width: 0;
  padding: 0 9px;
  font-weight: var(--mf-font-weight-semibold);
}
.mf-performance-head .mf-custom-range .range-custom-sep {
  margin: 0;
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: 11px;
  line-height: 1;
}
.mf-performance-head .mf-custom-range .range-custom-apply:hover {
  border-color: rgba(83, 191, 205, 0.42);
  background: #f4fdff;
  box-shadow: none;
  transform: none;
}
.mf-performance-head .mf-custom-range .range-custom-error {
  margin: 0;
  color: var(--mf-neg);
  font-family: var(--mf-sans);
  font-size: 11px;
  line-height: 1.2;
}
.mf-detail-tabs {
  display: grid;
  gap: 0;
  min-width: 0;
}
.mf-detail-tabbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0;
  overflow-x: auto;
  border: 0;
  border-bottom: 1px solid var(--mf-pf-line);
  border-radius: 0;
  background: transparent;
  scrollbar-width: none;
}
.mf-detail-tabbar::-webkit-scrollbar { display: none; }
.mf-detail-tab {
  flex: 0 0 auto;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 1px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--mf-muted);
  cursor: pointer;
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-body);
  font-weight: var(--mf-pf-weight-middle);
  letter-spacing: 0;
  transition: background var(--mf-duration-standard, 180ms) var(--mf-ease), border-color var(--mf-duration-standard, 180ms) var(--mf-ease), color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.mf-detail-tab:hover {
  border-bottom-color: rgba(17, 19, 22, 0.18);
  background: transparent;
  color: var(--mf-graphite);
}
.mf-detail-tab.active {
  border-bottom-color: var(--mf-cyan-ink);
  background: transparent;
  color: var(--mf-cyan-ink);
}
.mf-detail-tab em {
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(20, 34, 39, 0.07);
  color: var(--mf-muted);
  font-family: var(--mf-mono);
  font-size: var(--mf-font-size-meta);
  font-style: normal;
  line-height: 1;
}
.mf-detail-tab.active em { background: var(--mf-pf-accent-soft); color: var(--mf-cyan-ink); }
.mf-detail-tab:focus-visible {
  outline: none;
  border-radius: 4px 4px 0 0;
  background: var(--mf-pf-accent-soft);
  box-shadow: inset 0 0 0 1px rgba(14, 139, 168, 0.24);
}
.mf-detail-tab-panel {
  min-width: 0;
  padding-top: 20px;
}
.mf-detail-tab-panel[hidden] {
  display: none;
}
.mf-detail-tab-section {
  min-width: 0;
}
.mf-tab-section-head {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.mf-tab-section-head > div { min-width: 0; }
.mf-tab-section-head h3 {
  margin: 0;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-title-sm);
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.1;
}
.mf-tab-section-head > small {
  color: var(--mf-muted);
  font-family: var(--mf-mono);
  font-size: 11px;
  font-weight: var(--mf-pf-weight-middle);
}
.mf-wallet-source {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 11px;
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1;
}
.mf-wallet-source i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(20, 34, 39, 0.40);
}
.mf-wallet-source.live i { background: var(--mf-pos); box-shadow: 0 0 0 3px rgba(22, 135, 101, 0.09); }
.mf-wallet-empty,
.mf-wallet-data-error {
  min-height: 120px;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 22px;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-md);
  background: var(--mf-pf-panel-muted);
  text-align: center;
}
.mf-wallet-empty strong,
.mf-wallet-data-error strong { color: var(--mf-graphite); font-size: 14px; font-weight: var(--mf-pf-weight-heading); }
.mf-wallet-empty span,
.mf-wallet-data-error span { color: var(--mf-faint); font-size: 12px; line-height: 1.4; }
.mf-wallet-data-error { border-color: rgba(200, 82, 97, 0.28); background: rgba(200, 82, 97, 0.035); }
.mf-wallet-order-list,
.mf-wallet-history-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-md);
  background: var(--mf-pf-panel);
}
.mf-wallet-order {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(260px, 1.1fr) minmax(180px, 0.48fr) minmax(430px, 0.92fr);
  align-items: center;
  gap: 18px;
  padding: 12px 13px;
  border: 0;
  border-bottom: 1px solid var(--mf-pf-line);
  border-radius: 0;
  background: transparent;
}
.mf-wallet-order:last-child { border-bottom: 0; }
.mf-wallet-order-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.mf-order-side {
  flex: none;
  min-width: 38px;
  padding: 5px 6px;
  border: 1px solid rgba(39, 117, 202, 0.24);
  border-radius: 4px;
  background: rgba(39, 117, 202, 0.06);
  color: #275f9c;
  font-family: var(--mf-mono);
  font-size: var(--mf-font-size-meta);
  font-weight: var(--mf-font-weight-bold);
  line-height: 1;
  text-align: center;
}
.mf-order-side.sell { border-color: rgba(200, 82, 97, 0.25); background: rgba(200, 82, 97, 0.05); color: var(--mf-neg); }
.mf-wallet-order-main > div,
.mf-wallet-order-main a,
.mf-wallet-order-main strong { min-width: 0; }
.mf-wallet-order-main a,
.mf-wallet-order-main strong {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 13px;
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.2;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-wallet-order-main a:hover { color: var(--mf-cyan-ink); }
.mf-wallet-order-main a svg { width: 12px; height: 12px; flex: none; }
.mf-wallet-order-main small {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--mf-faint);
  font-size: var(--mf-font-size-meta);
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-wallet-order-fill { min-width: 0; display: grid; gap: 6px; }
.mf-wallet-order-fill > div { height: 5px; overflow: hidden; border-radius: 3px; background: rgba(20, 34, 39, 0.10); }
.mf-wallet-order-fill > div span { display: block; height: 100%; background: var(--mf-cyan-ink); }
.mf-wallet-order-fill small { color: var(--mf-faint); font-family: var(--mf-mono); font-size: var(--mf-font-size-meta); white-space: nowrap; }
.mf-wallet-order-metrics {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-pf-line);
}
.mf-wallet-order-metrics > span {
  min-width: 0;
  min-height: 48px;
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 5px;
  padding: 7px 8px;
  background: rgba(255, 254, 250, 0.82);
  text-align: right;
}
.mf-wallet-order-metrics small { color: var(--mf-faint); font-size: var(--mf-font-size-meta); font-weight: var(--mf-pf-weight-middle); line-height: 1; white-space: nowrap; }
.mf-wallet-order-metrics strong { color: var(--mf-ink); font-family: var(--mf-mono); font-size: 12px; font-weight: var(--mf-pf-weight-middle); line-height: 1; white-space: nowrap; }
.mf-wallet-order-metrics .mf-usdc-money { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.mf-wallet-order-metrics .mf-usdc-icon { width: 11px; height: 11px; }
.mf-wallet-order .mf-order-status {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--mf-pos);
  font-family: var(--mf-sans);
  font-size: 11px;
  font-weight: var(--mf-pf-weight-heading);
}
.mf-wallet-history {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(110px, 0.25fr) minmax(260px, 1fr) minmax(110px, 0.28fr) minmax(168px, 0.38fr);
  align-items: center;
  gap: 16px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--mf-pf-line);
}
.mf-wallet-history:last-child { border-bottom: 0; }
.mf-wallet-history-type { min-width: 0; display: flex; align-items: center; gap: 9px; }
.mf-wallet-history-type img,
.mf-wallet-history-type > span {
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-pf-accent-soft);
  object-fit: cover;
}
.mf-wallet-history-type > span { display: grid; place-content: center; color: var(--mf-cyan-ink); font-family: var(--mf-mono); font-size: 12px; font-weight: var(--mf-pf-weight-heading); }
.mf-wallet-history-type em { overflow: hidden; color: var(--mf-muted); font-size: 11px; font-style: normal; font-weight: var(--mf-pf-weight-middle); text-overflow: ellipsis; white-space: nowrap; }
.mf-wallet-history-market { min-width: 0; }
.mf-wallet-history-market a,
.mf-wallet-history-market > strong {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  color: var(--mf-graphite);
  font-size: var(--mf-font-size-body-sm);
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.2;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-wallet-history-market a:hover { color: var(--mf-cyan-ink); }
.mf-wallet-history-market a svg { width: 12px; height: 12px; flex: none; }
.mf-wallet-history-market small { display: block; margin-top: 4px; overflow: hidden; color: var(--mf-faint); font-size: var(--mf-font-size-meta); text-overflow: ellipsis; white-space: nowrap; }
.mf-wallet-history-value,
.mf-wallet-history-time { min-width: 0; display: grid; justify-items: end; gap: 5px; text-align: right; }
.mf-wallet-history-value small,
.mf-wallet-history-time small { color: var(--mf-faint); font-size: var(--mf-font-size-meta); font-weight: var(--mf-pf-weight-middle); }
.mf-wallet-history-value strong,
.mf-wallet-history-time strong { color: var(--mf-ink); font-family: var(--mf-mono); font-size: var(--mf-font-size-label); font-weight: var(--mf-pf-weight-middle); white-space: nowrap; }
.mf-wallet-history-value .mf-usdc-money { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; }
.mf-wallet-history-value .mf-usdc-icon { width: 11px; height: 11px; }
.mf-history-tx { display: inline-flex; align-items: center; justify-content: flex-end; gap: 4px; color: var(--mf-cyan-ink); font-family: var(--mf-mono); font-size: 10px; text-decoration: none; }
.mf-history-tx svg { width: 10px; height: 10px; }
.mf-direction-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(270px, 0.38fr);
  gap: 14px;
  align-items: stretch;
}
.mf-direction-chart-panel,
.mf-market-panel,
.mf-lot-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-md);
  background: var(--mf-pf-panel);
}
.mf-direction-chart-panel {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.mf-direction-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.mf-direction-section-head.compact { align-items: flex-start; margin-bottom: 12px; }
.mf-direction-section-head div { min-width: 0; }
.mf-direction-section-head span {
  display: block;
  margin-bottom: 4px;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1;
}
.mf-direction-section-head h3 {
  margin: 0;
  overflow: hidden;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 16px;
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.14;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-direction-section-head small {
  flex: none;
  color: var(--mf-faint);
  font-family: var(--mf-mono);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1.2;
  text-align: right;
}
.mf-direction-desc {
  max-width: 92ch;
  margin: -2px 0 0;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 13px;
  line-height: 1.5;
}
.mf-chart-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  max-width: 100%;
  margin: 0 0 10px;
}
.mf-direction-chart-panel .mf-chart-range {
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  overflow-x: auto;
  border-color: rgba(17, 19, 22, 0.085);
  border-radius: var(--mf-radius-md);
  background: rgba(255, 254, 250, 0.64);
  box-shadow: none;
  scrollbar-width: none;
}
.mf-direction-chart-panel .mf-chart-range::-webkit-scrollbar { display: none; }
.mf-direction-chart-panel .chart-range-button {
  flex: 0 0 auto;
  height: 30px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: var(--mf-radius-sm);
  color: var(--mf-faint);
  font-family: var(--mf-mono);
  font-size: 12px;
  font-weight: var(--mf-pf-weight-middle);
}
.mf-direction-chart-panel .chart-range-button:hover {
  border-color: rgba(17, 19, 22, 0.075);
  background: rgba(255, 255, 255, 0.58);
  color: var(--mf-graphite);
}
.mf-direction-chart-panel .chart-range-button.active {
  border-color: rgba(83, 191, 205, 0.48);
  background: rgba(235, 252, 255, 0.78);
  box-shadow: none;
  color: var(--mf-graphite);
}
.mf-direction-chart-panel .range-custom {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--mf-muted);
}
.mf-direction-chart-panel .range-custom-input,
.mf-direction-chart-panel .range-custom-apply {
  height: 30px;
  min-height: 30px;
  border: 1px solid rgba(17, 19, 22, 0.095);
  border-radius: var(--mf-radius-sm);
  background: rgba(255, 254, 250, 0.86);
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 12px;
  letter-spacing: 0;
}
.mf-direction-chart-panel .range-custom-input {
  width: 108px;
  padding: 0 8px;
}
.mf-direction-chart-panel .range-custom-apply {
  width: auto;
  min-width: 0;
  padding: 0 9px;
  font-weight: var(--mf-pf-weight-middle);
}
.mf-direction-chart-panel .range-custom-sep {
  color: var(--mf-faint);
  font-size: 11px;
}
.mf-direction-chart-panel .range-custom-error {
  color: var(--mf-neg);
  font-family: var(--mf-sans);
  font-size: 11px;
}
.mf-direction-chart-frame {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-md);
  background:
    linear-gradient(rgba(17, 19, 22, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 19, 22, 0.024) 1px, transparent 1px),
    rgba(255, 255, 253, 0.96);
  background-size: 38px 38px;
  box-shadow: var(--mf-pf-shadow);
}
.mf-direction-chart {
  display: block;
  width: 100%;
  height: 260px;
}
.mf-direction-chart .mf-dir-grid {
  stroke: rgba(133, 142, 154, 0.18);
  stroke-dasharray: 2 5;
}
.mf-direction-chart .mf-dir-line {
  stroke: var(--mf-cyan-ink);
  stroke-width: 2.1;
}
.mf-direction-chart .mf-dir-area { opacity: 1; }
.mf-direction-chart-empty {
  min-height: 208px;
  display: grid;
  place-content: center;
  gap: 6px;
  padding: 18px;
  text-align: center;
  color: var(--mf-muted);
}
.mf-direction-chart-empty strong {
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 14px;
}
.mf-direction-chart-empty span {
  max-width: 42ch;
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: 12px;
  line-height: 1.4;
}
.mf-value-records {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 1px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid rgba(154, 145, 122, 0.20);
  border-radius: 6px;
  background: rgba(154, 145, 122, 0.18);
}
.mf-value-record {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  background: rgba(255, 254, 250, 0.78);
}
.mf-value-record small,
.mf-value-record em {
  overflow: hidden;
  font-family: var(--mf-sans);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-value-record small { color: var(--mf-faint); }
.mf-value-record strong {
  overflow: hidden;
  color: var(--mf-ink);
  font-family: var(--mf-mono);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-value-record em { font-style: normal; }
.mf-market-list {
  display: grid;
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-md);
  background: var(--mf-pf-panel);
  box-shadow: var(--mf-pf-shadow);
}
.mf-market-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(600px, 0.92fr);
  align-items: center;
  gap: 20px;
  min-width: 0;
  min-height: 84px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--mf-pf-line);
  border-radius: 0;
  background: transparent;
  transition: background var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.mf-market-row:last-child { border-bottom: 0; }
.mf-market-row:hover { background: rgba(246, 249, 248, 0.74); }
.mf-market-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}
.mf-market-title {
  min-width: 0;
  overflow: hidden;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 14px;
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-market-title a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted rgba(17, 19, 22, 0.28);
}
.mf-market-title a:hover { border-bottom-color: rgba(17, 19, 22, 0.56); }
.mf-market-meta {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1.1;
}
.mf-market-meta > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-market-side {
  flex: none;
  padding: 2px 6px;
  border: 1px solid rgba(154, 145, 122, 0.28);
  border-radius: var(--mf-radius-xs);
  background: rgba(255, 254, 250, 0.72);
  font-family: var(--mf-mono);
  font-size: var(--mf-font-size-meta);
  line-height: 1;
  color: var(--mf-muted);
}
.mf-market-side.yes {
  color: var(--mf-pos);
  border-color: rgba(22, 135, 101, 0.28);
  background: var(--mf-pos-soft);
}
.mf-market-side.no {
  color: var(--mf-neg);
  border-color: rgba(217, 76, 104, 0.28);
  background: var(--mf-neg-soft);
}
.mf-market-state {
  flex: none;
  padding: 2px 6px;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-xs);
  background: var(--mf-pf-panel-muted);
  color: var(--mf-muted);
  font-size: var(--mf-font-size-meta);
}
.mf-market-metrics {
  width: 100%;
  min-width: 600px;
  justify-self: stretch;
  display: grid;
  grid-template-columns: minmax(82px, 0.85fr) minmax(92px, 0.95fr) minmax(138px, 1.25fr) minmax(112px, 1.1fr) minmax(88px, 0.9fr);
  grid-template-areas: "held target progress value weight";
  gap: 0;
  border: 0;
  background: transparent;
}
.mf-market-metrics > span {
  min-width: 0;
  min-height: 52px;
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 5px;
  padding: 3px 14px;
  border-left: 1px solid var(--mf-pf-line);
  background: transparent;
  text-align: right;
}
.mf-market-metric-held { grid-area: held; }
.mf-market-metric-target { grid-area: target; }
.mf-market-metric-progress {
  position: relative;
  grid-area: progress;
  cursor: help;
}
.mf-market-metric-value { grid-area: value; }
.mf-market-metric-weight { grid-area: weight; }
.mf-market-metrics > .mf-market-metric-weight { padding-right: 0; }
.mf-market-metrics small {
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 11px;
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1.1;
  white-space: nowrap;
}
.mf-market-metrics strong {
  color: var(--mf-ink);
  font-family: var(--mf-mono);
  font-size: 14px;
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1.1;
  white-space: nowrap;
}
.mf-market-metric-progress > small {
  transition: opacity var(--mf-duration-fast, 120ms) var(--mf-ease);
}
.mf-market-progress-value {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 14px;
  padding: 2px 5px;
  border: 1px solid rgba(14, 139, 168, 0.22);
  border-radius: var(--mf-radius-xs);
  background: rgba(244, 252, 252, 0.98);
  color: var(--mf-cyan-ink);
  font-family: var(--mf-mono);
  font-size: var(--mf-font-size-meta);
  font-weight: var(--mf-font-weight-medium);
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity var(--mf-duration-fast, 120ms) var(--mf-ease), transform var(--mf-duration-fast, 120ms) var(--mf-ease);
  white-space: nowrap;
}
.mf-market-metric-progress:hover > small,
.mf-market-metric-progress:focus-visible > small {
  opacity: 0;
}
.mf-market-metric-progress:hover .mf-market-progress-value,
.mf-market-metric-progress:focus-visible .mf-market-progress-value {
  opacity: 1;
  transform: translateY(0);
}
.mf-market-metric-progress:focus-visible {
  outline: 2px solid rgba(14, 139, 168, 0.46);
  outline-offset: 2px;
  border-radius: var(--mf-radius-xs);
}
.mf-market-progress-track {
  justify-self: stretch;
  display: block;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: var(--mf-radius-round);
  background: rgba(20, 34, 39, 0.10);
}
.mf-market-progress-track > i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--mf-cyan-ink);
}
@media (min-width: 1121px) {
  .mf-market-metric-progress .mf-market-progress-track {
    margin-block: 5px;
  }
}
.mf-direction-empty {
  margin: 0;
  padding: 16px 12px;
  border: 1px dashed rgba(154, 145, 122, 0.28);
  border-radius: var(--mf-radius-sm);
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-body-sm);
  line-height: 1.45;
  background: rgba(255, 254, 250, 0.56);
}
.mf-basket-update {
  display: grid;
  gap: var(--mf-space-3);
  margin-bottom: var(--mf-space-4);
  padding: var(--mf-space-4);
  border: 1px solid var(--mf-status-warning);
  border-left-width: 3px;
  border-radius: var(--mf-radius-md);
  color: var(--mf-text-primary);
  background: var(--mf-surface-subtle);
}
.mf-basket-update strong { color: var(--mf-text-strong); font-size: var(--mf-font-size-body); }
.mf-basket-update p { margin: var(--mf-space-1) 0 0; color: var(--mf-text-secondary); font-size: var(--mf-font-size-body-sm); line-height: 1.45; }
.mf-basket-update dl { display: flex; flex-wrap: wrap; gap: var(--mf-space-3) var(--mf-space-6); margin: 0; }
.mf-basket-update dl > div { display: grid; gap: var(--mf-space-0-5); }
.mf-basket-update dt { color: var(--mf-text-secondary); font-size: var(--mf-font-size-label); }
.mf-basket-update dd { margin: 0; color: var(--mf-text-strong); font-family: var(--mf-font-mono); font-size: var(--mf-font-size-body-sm); font-weight: var(--mf-pf-weight-middle); }
.mf-basket-update > small { color: var(--mf-text-secondary); font-size: var(--mf-font-size-label); line-height: 1.4; }
.mf-basket-update-blocked { border-color: var(--mf-status-negative); }
.mf-activity-table-wrap {
  min-width: 0;
  overflow-x: auto;
}
.mf-activity-table {
  min-width: 780px;
  margin-top: 0;
}
.mf-activity-table td {
  vertical-align: middle;
}
.mf-activity-table td:first-child {
  min-width: 190px;
}
.mf-activity-table td small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--mf-faint);
  font-family: var(--mf-sans);
  font-size: 11px;
  font-weight: 650;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-activity-name {
  display: block;
  max-width: 28ch;
  overflow: hidden;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mf-order-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid rgba(154, 145, 122, 0.26);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.72);
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}
.mf-order-status.resting,
.mf-order-status.partial {
  border-color: rgba(83, 191, 205, 0.34);
  background: rgba(235, 252, 255, 0.70);
  color: var(--mf-cyan-ink);
}
.mf-order-status.pending {
  border-color: rgba(168, 100, 31, 0.28);
  background: rgba(255, 245, 230, 0.72);
  color: var(--mf-warn);
}
.mf-history-table {
  min-width: 860px;
}
.mf-history-table td:nth-child(3) {
  max-width: 420px;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 12.5px;
  line-height: 1.3;
}
.mf-lot-list { display: grid; gap: 10px; }
.mf-position-lot {
  padding: 12px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.78);
}
.mf-lot-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.mf-lot-head > div { min-width: 0; display: grid; gap: 3px; }
.mf-lot-kicker {
  font-family: var(--mf-sans);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1;
  color: var(--mf-faint);
}
.mf-lot-head strong {
  min-width: 0;
  font-family: var(--mf-sans);
  font-size: 14px;
  line-height: 1.12;
  color: var(--mf-graphite);
}
.mf-lot-head small {
  flex: none;
  font-family: var(--mf-mono);
  font-size: 12px;
  line-height: 1.2;
  color: var(--mf-faint);
}
.mf-lot-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-control-radius);
  background: var(--mf-line);
}
.mf-lot-metrics > span {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  background: rgba(255, 254, 250, 0.74);
}
.mf-lot-metrics small {
  font-family: var(--mf-sans);
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  color: var(--mf-faint);
  white-space: nowrap;
}
.mf-lot-metrics strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--mf-mono);
  font-size: 13.5px;
  line-height: 1.1;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--mf-ink);
}
.mf-lot-progress { margin-top: 10px; }
.mf-lot-legs {
  margin-top: 10px;
  overflow-x: auto;
  border-top: 1px solid var(--mf-line);
}
.mf-lot-legs .mf-legs { min-width: 620px; margin-top: 8px; }
.mf-lot-legs .mf-legs th:first-child,
.mf-lot-legs .mf-legs td:first-child { padding-left: 0; }
.mf-lot-legs .mf-legs th:last-child,
.mf-lot-legs .mf-legs td:last-child { padding-right: 0; }
.mf-pos-detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(210px, 0.8fr); gap: 12px; }
.mf-progress-box,
.mf-action-box {
  padding: 13px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-radius);
  background: rgba(255, 254, 250, 0.72);
}
.mf-progress { height: 5px; border-radius: var(--mf-radius-round); background: var(--mf-paper); margin-top: 12px; overflow: hidden; }
.mf-progress-fill { height: 100%; border-radius: var(--mf-radius-round); background: var(--mf-cyan);  }
.mf-progress-meta { display: flex; justify-content: space-between; font-family: var(--mf-sans); font-size: 12px; color: var(--mf-faint); margin-top: 5px; }
.mf-empty { border: 1px dashed var(--mf-line-strong); border-radius: var(--mf-radius); padding: 34px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; font-family: var(--mf-sans); background: rgba(255, 254, 250, 0.62); }
.mf-empty h3 { margin: 0; color: var(--mf-ink); font-size: 17px; font-weight: 720; }

@media (max-width: 1120px) {
  .mf-detail-hero-main { grid-template-columns: 1fr; align-items: start; gap: 22px; }
  .mf-detail-capital { width: 100%; }
  .mf-direction-overview { grid-template-columns: 1fr; }
  .mf-wallet-order { grid-template-columns: minmax(0, 1fr) minmax(190px, 0.45fr); }
  .mf-wallet-order-metrics { grid-column: 1 / -1; }
  .mf-market-row {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }
  .mf-market-metrics {
    min-width: 0;
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-areas:
      "held target value weight"
      "progress progress progress progress";
    justify-self: stretch;
    padding-top: 12px;
    border-top: 1px solid var(--mf-pf-line);
  }
  .mf-market-metrics > span {
    min-height: 44px;
    align-items: start;
    justify-items: start;
    padding: 0 12px;
    text-align: left;
  }
  .mf-market-metrics > .mf-market-metric-held { padding-left: 0; border-left: 0; }
  .mf-market-metrics > .mf-market-metric-progress {
    min-height: 0;
    margin-top: 9px;
    padding: 10px 0 0;
    border-top: 1px solid var(--mf-pf-line);
    border-left: 0;
  }
  .mf-market-progress-value {
    right: auto;
    left: 0;
  }
  .mf-market-metrics strong .mf-usdc-money { justify-content: flex-start; }
  .mf-wallet-history { grid-template-columns: minmax(105px, 0.25fr) minmax(220px, 1fr) minmax(100px, 0.28fr) minmax(155px, 0.38fr); gap: 12px; }
}
@media (max-width: 680px) {
  #mf-modal-host .mf-modal { width: min(100vw - 22px, 560px); }
  .mf-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mf-steps li { align-items: flex-start; gap: 5px; padding: 6px; }
  .mf-steps b { overflow: visible; font-size: 11px; line-height: 1.15; text-overflow: clip; white-space: normal; }
  .mf-ticket { grid-template-columns: 1fr; }
  .mf-ticket-side { padding-left: 0; border-left: 0; border-top: 1px solid var(--mf-line); padding-top: 10px; text-align: left; }
  .mf-pf-summary { grid-template-columns: 1fr; }
  .mf-funding-notice { align-items: stretch; flex-direction: column; }
  .mf-funding-notice-actions { width: 100%; }
  .mf-funding-notice-actions .mf-btn { flex: 1 1 0; }
  .mf-detail-hero { padding-bottom: 18px; }
  .mf-detail-identity { grid-template-columns: 1fr; gap: 8px; }
  .mf-identity-block { min-height: 64px; }
  .mf-theme-identity { gap: 11px; padding: 9px 11px; }
  .mf-theme-identity > .mf-poscard-image { width: 44px; height: 44px; }
  .mf-theme-identity h2,
  .mf-direction-identity strong { font-size: 18px; }
  .mf-theme-identity h2 { white-space: normal; overflow-wrap: anywhere; }
  .mf-direction-identity { padding: 9px 13px; }
  .mf-detail-identity-meta { grid-column: 1; grid-template-columns: 1fr; gap: 7px; padding-top: 1px; }
  .mf-detail-status { width: 100%; }
  .mf-poscard-wallet { flex-wrap: wrap; row-gap: 5px; }
  .mf-detail-wallet {
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 4px;
  }
  .mf-detail-wallet > svg { grid-column: 1; grid-row: 1 / span 2; }
  .mf-detail-wallet > span { grid-column: 2; grid-row: 1; }
  .mf-detail-wallet a { grid-column: 2; grid-row: 2; justify-self: start; }
  .mf-detail-wallet em { grid-column: 2; }
  .mf-detail-stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mf-detail-stat { min-height: 76px; padding: 12px; font-size: var(--mf-font-size-title-sm); }
  .mf-detail-stat:nth-child(odd) { border-left: 0; }
  .mf-detail-stat:nth-child(n + 3) { border-top: 1px solid var(--mf-pf-line); }
  .mf-detail-stat > .mf-usdc-money,
  .mf-detail-stat > span > .mf-usdc-money { font-size: var(--mf-font-size-title-sm); }
  .mf-performance-head { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 11px; }
  .mf-performance-head > * { min-width: 0; max-width: 100%; box-sizing: border-box; }
  .mf-performance-head .mf-chart-controls { width: 100%; min-width: 0; justify-content: flex-start; box-sizing: border-box; }
  .mf-performance-head .mf-chart-range { width: 100%; min-width: 0; flex-wrap: nowrap; overflow-x: auto; box-sizing: border-box; }
  .mf-performance-head .mf-custom-range {
    flex: 0 0 auto;
    width: auto;
    justify-content: flex-start;
    flex-wrap: nowrap;
    margin-top: 0;
  }
  .mf-portfolio .mf-poscard .mf-poscard-row { grid-template-columns: 1fr; align-items: stretch; gap: 12px; }
  .mf-poscard-main { gap: 10px; }
  .mf-poscard-image { width: 42px; height: 42px; }
  .mf-poscard-copy { gap: 6px; }
  .mf-poscard-titleline { max-width: 100%; gap: 8px; flex-wrap: wrap; }
  .mf-poscard-nums { width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); justify-content: stretch; gap: 12px; }
  .mf-poscard-detail { padding: 12px; }
  .mf-poscard-detail-page { padding: 0; }
  .mf-detail-tabbar { width: 100%; gap: 18px; }
  .mf-detail-tab { min-width: max-content; }
  .mf-tab-section-head { align-items: flex-start; }
  .mf-direction-chart-panel,
.mf-market-panel,
.mf-lot-panel { padding: 12px; }
  .mf-direction-section-head {
    display: grid;
    align-items: start;
    gap: 6px;
  }
  .mf-direction-section-head h3 { white-space: normal; }
  .mf-direction-section-head small { text-align: left; }
  .mf-chart-controls { display: block; }
  .mf-direction-chart-panel .mf-chart-range {
    width: 100%;
    flex-wrap: wrap;
    overflow-x: visible;
  }
  .mf-direction-chart-panel .range-custom {
    flex: 1 0 100%;
    width: 100%;
    margin-top: 4px;
    flex-wrap: wrap;
  }
  .mf-direction-chart { height: 238px; }
  .mf-direction-chart-empty { min-height: 196px; }
  .mf-value-records { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
  .mf-market-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "held target"
      "value weight"
      "progress progress";
  }
  .mf-market-metrics > .mf-market-metric-value,
  .mf-market-metrics > .mf-market-metric-weight {
    margin-top: 9px;
    padding-top: 10px;
    border-top: 1px solid var(--mf-pf-line);
  }
  .mf-market-metrics > .mf-market-metric-value {
    padding-left: 0;
    border-left: 0;
  }
  .mf-wallet-order { grid-template-columns: 1fr; gap: 12px; padding: 11px; }
  .mf-wallet-order-metrics { grid-column: auto; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mf-wallet-order-metrics > span { justify-items: start; text-align: left; }
  .mf-wallet-order-metrics .mf-usdc-money { justify-content: flex-start; }
  .mf-wallet-history {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 11px;
    padding: 12px 2px;
  }
  .mf-wallet-history-market { grid-column: 1 / -1; }
  .mf-wallet-history-value { grid-column: 2; grid-row: 1; }
  .mf-wallet-history-time { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; justify-items: initial; text-align: left; }
  .mf-wallet-history-time small { text-align: right; }
  .mf-lot-head { display: grid; gap: 6px; }
  .mf-lot-head small { justify-self: start; }
  .mf-lot-metrics { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .mf-pos-detail-grid { grid-template-columns: 1fr; }
  .mf-local-auth { grid-template-columns: 1fr; }
  .mf-pay-rails { grid-template-columns: 1fr; }
  .mf-pay-summary-main { align-items: flex-start; }
  .mf-pay-summary-grid { grid-template-columns: 1fr; }
  .mf-pay-summary-item + .mf-pay-summary-item { border-left: 0; border-top: 1px solid var(--mf-line); }
  .mf-trust { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mf-trust-cell {
    min-height: 86px;
    padding: 10px 8px;
    grid-template-columns: 1fr;
    justify-items: center;
    align-content: center;
    row-gap: 6px;
    text-align: center;
  }
  .mf-trust-cell + .mf-trust-cell { border-left: 1px solid rgba(154, 145, 122, 0.24); border-top: 0; }
  .mf-trust-cell svg { width: 17px; height: 17px; padding: 5px; }
  .mf-trust-cell span { max-width: 132px; font-size: 12px; line-height: 1.22; }
  .mf-flow { grid-template-columns: 1fr; gap: 7px; }
  .mf-arrow { min-height: 14px; transform: none; }
  .mf-arrow svg { display: none; }
  .mf-arrow::before { content: ""; display: block; width: 1px; height: 14px; background: var(--mf-line-strong); }
}
@media (prefers-reduced-motion: reduce) {
  /* .mf-progress-fill dropped: its `transition: width 400ms` was the only transition in the file above
     220ms and the only one animating a layout property, and the class is referenced nowhere outside this
     stylesheet — the declaration is gone, so there is nothing left here to neutralise. .mf-loading-line
     has no transition either, only the shimmer. */
  .mf-loading-line { animation: none; }
}

.portfolio-main {
  color: var(--list-ink, #1b2026);
  font-family: var(--list-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  padding-top: 10px;
}

.portfolio-hero {
  max-width: 58ch;
  padding: 14px 0 18px;
  border-top: 1px solid var(--list-line, rgba(17, 19, 22, 0.105));
  border-bottom: 1px solid var(--list-line, rgba(17, 19, 22, 0.105));
}

.portfolio-eyebrow {
  margin: 0 0 5px;
  color: var(--list-faint, #9aa3ad);
  font-size: 12px;
  font-weight: 560;
  line-height: 1.4;
}

.portfolio-hero h2 {
  margin: 0;
  color: var(--list-graphite, #111316);
  font-size: 20px;
  font-weight: 680;
  line-height: 1.08;
}

.portfolio-hero p {
  margin: 7px 0 0;
  color: var(--list-muted, #65707a);
  font-size: 13.5px;
  line-height: 1.45;
}

/* ═══════════════════════ Request Board (REQUEST_BOARD_PLAN.md) ═══════════════════════
   Lives on the Trends list skin (body.dashboard-view supplies the paper bg + header). Tokens mirror
   the --list-* block scoped to #dashboard/.measurement-list-hero — keep the values in sync. Inter for
   prose and semantic controls share sans; mono is reserved for counts/rank/input ids; building borrows the
   recomposition amber. */
body.requests-view {
  --list-sans: var(--mf-font-sans, var(--detail-sans, Inter, "Helvetica Neue", Arial, sans-serif));
  --list-mono: var(--mf-font-mono, var(--detail-mono, "SF Mono", Menlo, Consolas, monospace));
  font-family: var(--list-sans);
  font-size: 14px;
}

body.requests-view .index-main,
body.requests-view .measurement-list-hero,
body.requests-view .measurement-list-hero-inner,
body.requests-view .dashboard-product-tabs,
body.requests-view .dashboard-product-tab,
body.requests-view .measurement-list-actions,
body.requests-view .auth-shell,
body.requests-view .sr-only {
  font-family: var(--list-sans);
}

body.requests-view :where(button, input, textarea, select) {
  font-family: var(--list-sans);
}

body.requests-view .rb-main {
  --list-graphite: var(--mf-text-strong, #111316);
  --list-ink: var(--mf-text-primary, #1b2026);
  --list-muted: var(--mf-text-secondary, #65707a);
  --list-faint: var(--mf-text-disabled, #9aa3ad);
  --list-panel: var(--mf-surface-panel, #fffefa);
  --list-line: var(--mf-border-subtle, rgba(17, 19, 22, 0.105));
  --list-line-strong: var(--mf-border-default, rgba(17, 19, 22, 0.18));
  --list-cyan: var(--mf-signal-accent, #74deeb);
  --list-cyan-soft: var(--mf-color-accent-soft, rgba(116, 222, 235, 0.18));
  --list-pos: var(--mf-status-positive, #168765);
  --list-neg: var(--mf-status-negative, #c85261);
  --rb-amber: var(--mf-status-warning, #96631c);
  --list-sans: var(--mf-font-sans, var(--detail-sans, Inter, "Helvetica Neue", Arial, sans-serif));
  --list-mono: var(--mf-font-mono, var(--detail-mono, "SF Mono", Menlo, Consolas, monospace));
  color: var(--list-ink);
  font-family: var(--list-sans);
  position: relative;
  z-index: 1;
}

/* Neutralize the deck skin's heavyweight global `button` rule (132px min-width, 54px height, dark bg,
   drop shadow, hover lift) inside the board + modal. :where() keeps specificity at (0,0,1): later in
   the cascade than the global rule so it wins there, but it never outweighs the class rules below.
   `width: auto` ALSO neutralizes a second global rule — a mobile-only `button { width: 100% }` (≤620px,
   meant for the old single-seed analysis form) that otherwise forces every board/modal button to fill
   its flex row; since none of the rb- button rules declare their own `width`, that 100% would win by
   default and flexbox then divides the row evenly, clipping longer labels ("Trending" → 58px, "Submit
   request" wrapping to 2 lines). Ties on specificity resolve by source order — this block sits after
   line ~610, so it wins. */
:where(.rb-main, .rb-modal-backdrop) button {
  min-width: 0;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font-weight: 400;
  font-size: inherit;
  box-shadow: none;
  transform: none;
  transition: none;
  letter-spacing: normal;
}
:where(.rb-main, .rb-modal-backdrop) button:hover {
  transform: none;
  box-shadow: none;
  filter: none;
}

.rb-main {
  display: grid;
  gap: 12px;
  padding-top: 10px;
}
.rb-muted { color: var(--list-faint); font-size: 13.5px; }

/* hero */
.rb-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px 18px;
  padding: 6px 0 2px;
}
.rb-hero-copy { max-width: 58ch; min-width: 0; }
.rb-title {
  margin: 0;
  color: var(--list-graphite);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.08;
}
.rb-sub {
  margin: 7px 0 0;
  color: var(--list-muted);
  font-size: 15px;
  line-height: 1.5;
  text-wrap: pretty;
}
.rb-cta {
  margin-left: auto;
  align-self: end;
  height: 34px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(83, 191, 205, 0.48);
  border-radius: 6px;
  background: rgba(235, 252, 255, 0.78);
  color: var(--list-graphite);
  font-family: var(--list-sans);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0;
  cursor: pointer;
  transition:
    background var(--mf-duration-standard, 180ms) var(--mf-ease),
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease),
    transform var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.rb-cta:hover {
  border-color: rgba(83, 191, 205, 0.62);
  background: #f4fdff;
  box-shadow: none;
  transform: translateY(-1px);
}

.rb-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 0 0 3px;
  font-family: var(--list-sans);
  font-size: 13.5px;
  color: var(--list-faint);
  font-variant-numeric: tabular-nums;
}
.rb-stats span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-height: 20px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--list-muted);
  line-height: 1;
}
.rb-stats b {
  color: var(--list-graphite);
  font-family: var(--list-mono);
  font-size: 13.5px;
  font-weight: 720;
}

/* layout */
.rb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 276px);
  gap: 24px;
  align-items: start;
}
.rb-board { min-width: 0; }
@media (max-width: 900px) { .rb-layout { grid-template-columns: 1fr; gap: 20px; } }

/* toolbar */
.rb-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--list-line);
  border-bottom: 1px solid var(--list-line);
}
.rb-seg {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--list-line);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.72);
}
.rb-seg button {
  height: 30px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  padding: 0 11px;
  font-family: var(--list-sans);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0;
  color: var(--list-muted);
  cursor: pointer;
}
.rb-seg button.active {
  border-color: rgba(83, 191, 205, 0.48);
  background: rgba(235, 252, 255, 0.78);
  color: var(--list-graphite);
}
.rb-seg button:focus-visible { outline: 2px solid var(--list-cyan); outline-offset: -2px; }

/* rows */
.rb-rows { display: flex; flex-direction: column; }
.rb-rows > .rb-muted {
  margin: 0;
  padding: 22px 12px;
  border-bottom: 1px solid var(--list-line);
  color: var(--list-faint);
  font-size: 13.5px;
}
.rb-row {
  position: relative;
  display: grid;
  grid-template-columns: 30px 56px minmax(0, 1fr);
  gap: 12px;
  padding: 15px 0;
  border-top: 1px solid var(--list-line);
  align-items: start;
  transition:
    background var(--mf-duration-standard, 180ms) var(--mf-ease),
    border-color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.rb-row:first-child { border-top: 0; }
.rb-row:hover { background: rgba(255, 254, 250, 0.46); }
.rb-dimmed { opacity: 0.55; }
.rb-rank {
  font-family: var(--list-mono);
  font-size: 12px;
  color: var(--list-faint);
  padding-top: 10px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.rb-vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border: 1px solid var(--list-line);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.72);
  padding: 8px 4px 6px;
  width: 56px;
  color: var(--list-graphite);
  font-family: var(--list-mono);
  cursor: pointer;
  transition:border-color var(--mf-duration-standard, 180ms) var(--mf-ease), background var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.rb-vote .rb-tri { font-size: 10px; line-height: 1; color: var(--list-faint); }
.rb-vote .rb-n { font-size: 14.5px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; }
.rb-vote:hover:not(:disabled) { border-color: rgba(83, 191, 205, 0.62); background: #f4fdff; }
.rb-vote:focus-visible { outline: 2px solid var(--list-cyan); outline-offset: 2px; }
.rb-vote.voted { background: var(--list-cyan-soft); border-color: var(--list-cyan); }
.rb-vote.voted .rb-tri, .rb-vote.voted .rb-n { color: #0e7c8f; }
.rb-vote:disabled { cursor: default; background: rgba(17, 19, 22, 0.03); }
.rb-vote:disabled .rb-n { color: var(--list-faint); font-weight: 400; }

.rb-row-body { min-width: 0; }
.rb-row-title { margin: 1px 0 4px; font-size: 17px; font-weight: 700; color: var(--list-graphite); line-height: 1.24; }
.rb-row-desc { margin: 0 0 8px; font-size: 14.5px; line-height: 1.55; color: var(--list-muted); max-width: 68ch; }
.rb-row-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.rb-meta-text { font-family: var(--list-sans); font-size: 13px; color: var(--list-faint); }
.rb-wk { color: var(--list-pos); }

.rb-chip {
  display: inline-block;
  font-family: var(--list-sans);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: none;
  border: 1px solid var(--list-line);
  border-radius: 4px;
  padding: 1px 7px;
  color: var(--list-muted);
  background: var(--list-panel);
}
.rb-chip-cat { background: rgba(17, 19, 22, 0.035); border-color: transparent; }
.rb-st-review { color: #0e7c8f; border-color: rgba(116, 222, 235, 0.7); background: var(--list-cyan-soft); }
.rb-st-building { color: var(--rb-amber); border-color: rgba(150, 99, 28, 0.4); background: rgba(150, 99, 28, 0.08); }
.rb-st-live { color: var(--list-pos); border-color: rgba(22, 135, 101, 0.4); background: rgba(22, 135, 101, 0.08); }
.rb-st-declined { color: var(--list-neg); border-color: rgba(200, 82, 97, 0.35); background: rgba(200, 82, 97, 0.07); }
.rb-st-merged { color: var(--list-faint); }

.rb-live-link { margin: 7px 0 0; font-size: 13.5px; font-family: var(--list-sans); font-weight: 600; }
.rb-live-link a { color: var(--list-pos); text-decoration: none; border-bottom: 1px solid rgba(22, 135, 101, 0.35); }
.rb-decline-note { margin: 6px 0 0; font-size: 12.5px; color: var(--list-neg); }

/* admin strip */
.rb-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 9px;
  padding: 7px 10px;
  background: rgba(17, 19, 22, 0.03);
  border: 1px dashed var(--list-line-strong);
  border-radius: 6px;
  font-family: var(--list-sans);
  font-size: 12px;
  color: var(--list-faint);
}
.rb-admin-id { user-select: all; }
.rb-admin select, .rb-admin input, .rb-admin-apply {
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid var(--list-line);
  border-radius: 5px;
  background: var(--list-panel);
  color: var(--list-ink);
}
.rb-admin select, .rb-admin-apply { font-family: var(--list-sans); font-weight: 650; letter-spacing: 0; }
.rb-admin input { font-family: var(--list-mono); }
.rb-admin input { min-width: 200px; }
.rb-admin-apply { cursor: pointer; }
.rb-admin-apply:hover { border-color: var(--list-cyan); }

/* right rail */
.rb-rail { display: flex; flex-direction: column; gap: 17px; position: sticky; top: 16px; }
@media (max-width: 900px) { .rb-rail { position: static; } }
.rb-rail-card {
  border: 0;
  border-top: 1px solid var(--list-line);
  border-radius: 0;
  background: transparent;
  padding: 12px 0 0;
}
.rb-rail-card h3 {
  margin: 0 0 9px;
  font-family: var(--list-sans);
  font-size: 13.5px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--list-graphite);
  font-weight: 680;
  line-height: 1.15;
}
.rb-steps { margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--list-muted); }
.rb-steps li { display: flex; gap: 10px; padding: 8px 0; }
.rb-steps li + li { border-top: 1px solid var(--list-line); }
.rb-step-n {
  flex: 0 0 auto;
  width: 18px;
  color: var(--list-faint);
  font-family: var(--list-mono);
  font-size: 12px;
  line-height: 1.35;
  text-align: right;
}
.rb-steps b { display: block; margin-bottom: 2px; font-size: 13px; font-weight: 680; color: var(--list-graphite); }
.rb-shipped { margin: 0; padding: 0; list-style: none; font-size: 13px; }
.rb-shipped li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; }
.rb-shipped li + li { border-top: 1px solid var(--list-line); }
.rb-shipped a { color: var(--list-graphite); text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rb-shipped a:hover { color: #0e7c8f; }
.rb-shipped span { font-family: var(--list-sans); font-size: 12px; color: var(--list-faint); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rb-rail-note {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--list-line);
  color: var(--list-faint);
  font-size: 12.5px;
  line-height: 1.5;
}

/* modal */
.rb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 27, 32, 0.34);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 120;
  padding: 46px 16px;
  overflow-y: auto;
}
.rb-modal-backdrop[hidden] { display: none; }
.rb-modal {
  background: var(--list-panel, #fffefa);
  border: 1px solid rgba(17, 19, 22, 0.14);
  border-radius: 8px;
  box-shadow: 0 20px 42px rgba(31, 35, 40, 0.13);
  width: min(620px, 100%);
  padding: 22px 24px 20px;
  font-family: var(--list-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  font-size: 14.5px;
  color: #1b2026;
}
.rb-modal h2 { margin: 0 0 6px; font-size: 21px; font-weight: 700; line-height: 1.14; color: #111316; }
.rb-modal-sub { margin: 0 0 18px; font-size: 14.5px; line-height: 1.5; color: #65707a; }
.rb-field { margin-bottom: 15px; min-width: 0; }
.rb-field label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-family: var(--list-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  font-size: 13.5px;
  font-weight: 680;
  letter-spacing: 0;
  text-transform: none;
  color: #9aa3ad;
  margin-bottom: 5px;
}
.rb-cnt { text-transform: none; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.rb-cnt.over { color: #c85261; }
.rb-field input[type="text"], .rb-field textarea, .rb-field select {
  width: 100%;
  border: 1px solid rgba(17, 19, 22, 0.14);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.76);
  padding: 9px 10px;
  font-family: var(--list-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  font-size: 14.5px;
  line-height: 1.35;
  color: #1b2026;
  box-sizing: border-box;
}
.rb-field textarea { resize: vertical; min-height: 74px; }
.rb-field input:focus, .rb-field textarea:focus, .rb-field select:focus {
  outline: none;
  border-color: #74deeb;
  background: #fffefa;
}
#rb-markets { display: flex; flex-direction: column; gap: 6px; }
.rb-hint { margin: 6px 0 0; font-size: 13px; color: #9aa3ad; }
.rb-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 560px) { .rb-field-grid { grid-template-columns: 1fr; } }
.rb-add-market {
  margin-top: 6px;
  font-family: var(--list-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0;
  background: none;
  border: none;
  color: #0e7c8f;
  padding: 2px 0;
  cursor: pointer;
}

.rb-similar {
  border: 1px solid rgba(116, 222, 235, 0.7);
  background: rgba(116, 222, 235, 0.14);
  border-radius: 6px;
  padding: 10px 12px;
  margin: -6px 0 15px;
  font-size: 13px;
}
.rb-similar > b { display: block; margin-bottom: 6px; font-size: 13px; color: #111316; }
.rb-similar-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 3px 0; color: #1b2026; }
.rb-similar-item i { font-style: normal; color: #65707a; font-size: 12.5px; }
.rb-similar-act {
  font-family: var(--list-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0;
  border: 1px solid #0e7c8f;
  color: #0e7c8f;
  background: #fffefa;
  border-radius: 5px;
  padding: 2px 9px;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}

.rb-form-error { margin: 0 0 6px; font-size: 13px; color: #c85261; }
.rb-modal-foot { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.rb-modal-note { font-family: var(--list-sans, Inter, "Helvetica Neue", Arial, sans-serif); font-size: 13px; color: #9aa3ad; }
.rb-btn-ghost {
  background: none;
  border: 1px solid rgba(17, 19, 22, 0.14);
  border-radius: 6px;
  min-height: 34px;
  padding: 0 14px;
  color: #65707a;
  font-family: var(--list-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0;
  cursor: pointer;
}
.rb-btn-primary {
  margin-left: auto;
  background: #74deeb;
  color: #111316;
  border: 1px solid #74deeb;
  border-radius: 6px;
  min-height: 34px;
  padding: 0 15px;
  font-family: var(--list-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: 0;
  cursor: pointer;
}
.rb-btn-primary:hover { background: #8ceeff; border-color: #8ceeff; }
.rb-btn-primary:disabled { opacity: 0.6; cursor: default; }

/* toast */
.rb-toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translate(-50%, 12px);
  background: #fffefa;
  color: #1b2026;
  border: 1px solid rgba(83, 191, 205, 0.48);
  font-family: var(--list-sans, Inter, "Helvetica Neue", Arial, sans-serif);
  font-size: 13px;
  font-weight: 560;
  letter-spacing: 0;
  padding: 9px 18px;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(31, 35, 40, 0.14);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--mf-duration-standard, 180ms) var(--mf-ease), transform var(--mf-duration-standard, 180ms) var(--mf-ease);
  z-index: 140;
  max-width: 90vw;
}
.rb-toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  .rb-toast { transition: none; }
  .rb-cta, .rb-vote { transition: none; }
}

/* mobile */
@media (max-width: 640px) {
  .rb-row { grid-template-columns: 52px minmax(0, 1fr); }
  .rb-rank { display: none; }
  .rb-vote { width: 52px; }
  .rb-main { gap: 11px; padding-top: 8px; }
  .rb-hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
    padding-top: 6px;
  }
  .rb-hero-copy { max-width: none; }
  .rb-cta { justify-self: start; width: auto; margin-left: 0; }
  .rb-stats { padding-bottom: 2px; }
  .rb-toolbar {
    justify-content: flex-start;
    padding: 9px 0;
  }
  .rb-seg {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .rb-seg::-webkit-scrollbar {
    display: none;
  }
  /* Modal footer: Cancel + Submit were fighting the long rate-limit note for a share of a ~290px row
     (3 flex items), squeezing "Submit request" down to ~73px and wrapping it onto two lines. Give the
     note its own full-width row ABOVE the buttons instead of competing beside them. */
  .rb-modal-foot { flex-wrap: wrap; }
  .rb-modal-note { order: -1; flex: 1 1 100%; margin: 0 0 2px; }
}

/* ── Audit trail (public trust surface) ─────────────────────────────────────────────────────────────────
   Detail-view design language (DESIGN.md): warm panel + hairline structure, Inter for meaning, mono for
   metadata, cyan strictly as the active accent, pos/neg/amber always paired with words. Tokens come from
   body.detail-view #detail (--detail-*); the amber is the public recomposition marker. */

/* neutralize the global CTA button treatment (black fill, 132px min-width, mobile width:100%, hover lift) */
.nav-audit-provlink,
.nav-audit-toggle,
.nav-audit-stamp-btn,
.nav-audit-badge,
.nav-audit-jump {
  width: auto;
  min-width: 0;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  font-weight: 500;
  letter-spacing: 0;
}
.nav-audit-provlink:hover,
.nav-audit-toggle:hover,
.nav-audit-stamp-btn:hover,
.nav-audit-badge:hover,
.nav-audit-jump:hover,
.nav-audit-provlink:active,
.nav-audit-toggle:active,
.nav-audit-stamp-btn:active,
.nav-audit-badge:active,
.nav-audit-jump:active {
  transform: none;
  box-shadow: none;
  filter: none;
}

/* Provenance byline — the entry: a full-width editorial credit line closing the identity block. The full-bleed
   top hairline (under the thumbnail too) is what separates it from the metadata pills above. */
.detail-provenance {
  grid-area: prov;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 14px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--detail-line);
  min-width: 0;
}
.detail-provenance-counts {
  font-family: var(--detail-sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--detail-muted);
  min-width: 0;
}
.detail-provenance-lead { color: var(--detail-muted); font-weight: 560; }
.detail-provenance .prov-n {
  font-family: var(--detail-mono);
  font-weight: 650;
  color: var(--detail-graphite);
  font-variant-numeric: tabular-nums;
}
.nav-audit-provlink {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--detail-sans);
  font-size: 12px;
  font-weight: 620;
  color: #0e8ba8;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(14, 139, 168, 0.35);
  text-underline-offset: 2px;
}
.nav-audit-provlink:hover { text-decoration-color: #0e8ba8; background: none; }
.nav-audit-provarrow { display: inline-block; transition:transform var(--mf-duration-fast, 120ms) var(--mf-ease); }
.nav-audit-provlink:hover .nav-audit-provarrow { transform: translateX(2px); }

/* Section shell — the last titled section on the page: an always-visible header row (title + verification
   stamp) that discloses the evidence body in place. Frameless, like Basket Detail. */
.nav-audit-shell { display: grid; gap: 12px; margin-top: 26px; }
.nav-audit-shellhead { align-items: baseline; border-bottom: 1px solid var(--detail-line); padding-bottom: 9px; }
.nav-audit-toggle {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.nav-audit-caret {
  font-size: 10px;
  color: var(--detail-faint);
  transition:transform var(--mf-duration-fast, 120ms) var(--mf-ease);
}
.nav-audit-shell.open .nav-audit-caret { transform: rotate(180deg); }
.nav-audit-body { display: grid; gap: 12px; }
.nav-audit-mark {
  display: inline-block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 999px;
}
.nav-audit-stamp {
  font-family: var(--detail-mono);
  font-size: 11px;
  color: var(--detail-muted);
  white-space: nowrap;
}
/* Interactive stamp — opens the re-verification ledger. Reads as metadata, not a button; cyan only on hover. */
.nav-audit-stamp-btn {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-family: var(--detail-mono);
  font-size: 11px;
  color: var(--detail-muted);
  white-space: nowrap;
  cursor: pointer;
}
.nav-audit-stamp-btn:hover { color: #0e8ba8; }
.nav-audit-stamp-count {
  font-weight: 650;
  color: var(--detail-graphite);
  font-variant-numeric: tabular-nums;
}
.nav-audit-stamp-btn .nav-audit-caret { font-size: 9px; color: var(--detail-faint); transition:transform var(--mf-duration-fast, 120ms) var(--mf-ease); }
.nav-audit-stamp-btn.open .nav-audit-caret { transform: rotate(180deg); }

/* "N rebalances since re-verification" cue — a quiet honesty note so a lagging verify date isn't misread. */
.nav-audit-since {
  margin: -4px 0 0;
  font-family: var(--detail-sans);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--detail-faint);
  max-width: 72ch;
}

/* Re-verification ledger — newest first, current bolded; a compact drawer opened from the stamp. */
.nav-audit-ledger {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--detail-line);
  background: rgba(246, 247, 244, 0.55);
}
.nav-audit-ledger-row { padding: 8px 0 9px; border-bottom: 1px solid var(--detail-line); }
.nav-audit-ledger-row:last-child { border-bottom: 0; }
.nav-audit-ledger-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 3px;
}
.nav-audit-ledger-when {
  font-family: var(--detail-mono);
  font-size: 11px;
  font-weight: 650;
  color: var(--detail-muted);
}
.nav-audit-ledger-row.current .nav-audit-ledger-when { color: var(--detail-graphite); }
.nav-audit-ledger-tag { font-family: var(--detail-mono); font-size: 10.5px; color: var(--detail-faint); }

/* Verify chip on an Updates-log entry — the shared verification event that makes the two surfaces one spine. */
.nav-update-verify {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid rgba(22, 135, 101, 0.3);
  background: rgba(22, 135, 101, 0.07);
  color: var(--detail-pos, #168765);
  font-family: var(--detail-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Provenance line — the at-a-glance layer inside the body: one colophon sentence with bold counts. */
.nav-audit-provenance {
  margin: 0;
  font-family: var(--detail-sans);
  font-size: 13px;
  line-height: 1.55;
  color: var(--detail-copy-muted);
  max-width: 72ch;
  font-variant-numeric: tabular-nums;
}
.nav-audit-provenance b { font-weight: 680; color: var(--detail-graphite); }

/* Evidence tabs reuse the basket segmented control; the count rides along as mono metadata. */
.nav-audit-tabs.comp-tabs { justify-self: start; max-width: 100%; overflow-x: auto; }
.nav-audit-tabs .comp-tab { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.nav-audit-tab-count {
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 650;
  color: var(--detail-faint);
  font-variant-numeric: tabular-nums;
}
.nav-audit-tabs .comp-tab.active .nav-audit-tab-count { color: var(--detail-muted); }

/* Evidence rows — hairline list rows in the holdings language: dot, sans title, mono tag, muted copy. */
.nav-audit-tabpanel { display: flex; flex-direction: column; }
.nav-audit-subhead {
  margin: 0;
  padding: 6px 2px;
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--detail-muted);
}
.nav-audit-row {
  display: flex;
  gap: 10px;
  padding: 8px 2px 9px;
  border-bottom: 1px solid var(--detail-line);
}
.nav-audit-tabpanel > .nav-audit-row:last-child,
.nav-audit-tabpanel > .nav-audit-disc:last-child { border-bottom: 0; }
.nav-audit-mark { margin-top: 5px; }
.nav-audit-mark.ok { background: var(--detail-pos); }
.nav-audit-mark.warn { background: var(--recomp-marker, #96631c); }
.nav-audit-mark.fail { background: var(--detail-neg); }
.nav-audit-mark.mid { background: var(--detail-faint); opacity: 0.55; }
.nav-audit-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.nav-audit-row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}
.nav-audit-row-title {
  font-family: var(--detail-sans);
  font-size: 13px;
  font-weight: 650;
  color: var(--detail-graphite);
}
.nav-audit-row-reason {
  font-family: var(--detail-sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--detail-ink);
  min-width: 0;
}
.nav-audit-code {
  font-family: var(--detail-mono);
  font-size: 10.5px;
  color: var(--detail-faint);
  white-space: nowrap;
}
.nav-audit-row-copy {
  margin: 0;
  font-family: var(--detail-sans);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--detail-copy-muted);
  max-width: 70ch;
  overflow-wrap: anywhere;
}
.nav-update-footnote {
  margin: 6px 0 0;
  font-family: var(--detail-sans);
  font-size: 11.5px;
  color: var(--detail-muted);
}

/* Disclosure rows (rulings, waivers) — the recomposition-record pattern: › marker, expand for the rationale.
   The hover tint bleeds past the text column so the whole line reads as one affordance. */
.nav-audit-disc { border-bottom: 1px solid var(--detail-line); }
.nav-audit-disc > summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 8px 12px;
  margin: 0 -8px;
  cursor: pointer;
  list-style: none;
}
.nav-audit-disc > summary::-webkit-details-marker { display: none; }
.nav-audit-disc > summary::before {
  content: "›";
  flex: 0 0 auto;
  margin-top: 1px;
  font-family: var(--detail-mono);
  font-size: 13px;
  line-height: 1.45;
  color: var(--detail-faint);
  transition:transform var(--mf-duration-fast, 120ms) var(--mf-ease);
}
.nav-audit-disc[open] > summary::before { transform: rotate(90deg); }
.nav-audit-disc > summary:hover { background: #f4fdff; }
.nav-audit-disc-q {
  flex: 1;
  min-width: 0;
  font-family: var(--detail-sans);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  color: var(--detail-graphite);
  overflow-wrap: anywhere;
  text-wrap: pretty;
}
.nav-audit-disc-body { padding: 2px 2px 14px 25px; }
.nav-audit-disc-body b, .nav-audit-row-copy b { font-weight: 660; color: var(--detail-graphite); }
.nav-audit-tabpanel { min-width: 0; }
.nav-audit-disc > summary .nav-audit-pill { max-width: 40%; margin-top: 1px; overflow: hidden; text-overflow: ellipsis; }

/* Screening list — rejected candidates flow into columns on wide screens: reason first, slug as metadata,
   no per-row dots or hairlines (44 identical dots would be noise, not rigor), entries never split. */
.nav-audit-screen-flow { column-width: 330px; column-gap: 34px; padding: 2px 0 4px; }
.nav-audit-screen-row {
  break-inside: avoid;
  display: grid;
  gap: 2px;
  padding: 5px 2px 7px;
}
.nav-audit-screen-row .nav-audit-code { white-space: normal; overflow-wrap: anywhere; }

/* Status pills — mono metadata chips, square like the detail surface's side pills; color never travels
   without a word (and neutral verdicts stay neutral). */
.nav-audit-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  height: 20px;
  padding: 0 9px;
  border-radius: 2px;
  border: 1px solid var(--detail-line);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.nav-audit-pill.pos { color: var(--detail-pos); border-color: rgba(22, 135, 101, 0.32); background: rgba(22, 135, 101, 0.07); }
.nav-audit-pill.neg { color: var(--detail-neg); border-color: rgba(200, 82, 97, 0.32); background: rgba(200, 82, 97, 0.07); }
.nav-audit-pill.warn { color: var(--recomp-marker, #96631c); border-color: rgba(150, 99, 28, 0.34); background: rgba(150, 99, 28, 0.07); }
.nav-audit-pill.mid { color: var(--detail-muted); background: rgba(246, 247, 244, 0.7); }

/* Inline jump links — readable cyan (DESIGN.md Cyan Ink), quiet underline. */
.nav-audit-jump {
  display: inline;
  font-family: var(--detail-sans);
  font-size: 12px;
  font-weight: 620;
  color: #0e8ba8;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(14, 139, 168, 0.35);
  text-underline-offset: 2px;
  cursor: pointer;
}
.nav-audit-jump:hover { text-decoration-color: #0e8ba8; background: none; }
.nav-audit-morerow { padding: 10px 2px 6px; }

/* Per-holding audit: badge chip next to the facet label; expanded detail is a quiet paper inset. */
.nav-holding-facet { display: flex; align-items: center; gap: 8px; }
.nav-holding-facet .nav-holding-facet-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* The default "Audited" badge stays NEUTRAL — 24 green chips down a holdings list is exactly the color wash
   DESIGN.md bans, and it would drown the rare amber "Waived" that actually deserves the reader's eye. */
.nav-audit-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  height: 20px;
  padding: 0 8px;
  border: 1px solid var(--detail-line);
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.6);
  color: var(--detail-muted);
  font-family: var(--detail-mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background var(--mf-duration-standard, 180ms) var(--mf-ease), border-color var(--mf-duration-standard, 180ms) var(--mf-ease), color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
.nav-audit-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.55;
}
.nav-audit-badge:hover { border-color: var(--detail-line-strong); color: var(--detail-ink); }
.nav-audit-badge[aria-expanded="true"] { background: #effcff; border-color: var(--detail-cyan); color: var(--detail-ink); }
.nav-audit-badge.waived { color: var(--recomp-marker, #96631c); border-color: rgba(150, 99, 28, 0.36); background: rgba(150, 99, 28, 0.06); }
.nav-audit-badge.waived::before { opacity: 1; }
.nav-audit-badge.waived:hover { background: rgba(150, 99, 28, 0.13); }
.nav-audit-badge.waived[aria-expanded="true"] { background: rgba(150, 99, 28, 0.15); border-color: rgba(150, 99, 28, 0.5); }

.nav-holding-audit {
  grid-column: 1 / -1;
  display: grid;
  gap: 8px;
  margin-top: 7px;
  padding: 10px 12px 11px;
  border-top: 1px solid var(--detail-line);
  background: rgba(246, 247, 244, 0.6);
}
.nav-holding-audit-row { display: flex; align-items: flex-start; gap: 10px; }
.nav-holding-audit-row .nav-audit-pill { min-width: 74px; margin-top: 1px; }
.nav-holding-audit-copy {
  margin: 0;
  font-family: var(--detail-sans);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--detail-ink);
  max-width: 70ch;
  overflow-wrap: anywhere;
}
.nav-holding-audit-copy b { font-weight: 680; color: var(--detail-graphite); }

/* Jump landing flash — the cyan selection tint, then back to paper. */
@keyframes nav-audit-flash {
  0% { border-color: var(--detail-cyan); background: #effcff; }
  100% { border-color: var(--detail-line); background: rgba(255, 254, 250, 0.72); }
}
.nav-holding-card.audit-flash { animation: nav-audit-flash 1.4s cubic-bezier(0.22, 1, 0.36, 1); }

/* Keyboard focus — DESIGN.md requires visible focus on every control; the global reset stripped it. */
.nav-audit-toggle:focus-visible,
.nav-audit-badge:focus-visible,
.nav-audit-disc > summary:focus-visible {
  outline: 2px solid var(--detail-cyan);
  outline-offset: 2px;
}
.nav-audit-provlink:focus-visible,
.nav-audit-jump:focus-visible {
  outline: 2px solid var(--detail-cyan);
  outline-offset: 1px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .nav-holding-card.audit-flash { animation: none; }
  .nav-audit-caret,
  .nav-audit-provarrow,
  .nav-audit-disc > summary::before { transition: none; }
  .nav-audit-provlink:hover .nav-audit-provarrow { transform: none; }
}

@media (max-width: 720px) {
  .nav-audit-row-head { flex-wrap: wrap; gap: 2px 12px; }
  .nav-holding-audit-row { flex-direction: column; gap: 4px; }
  .detail-provenance { justify-content: flex-start; }
}

/* ═══════════════════════ Trend request experience refresh ═══════════════════════ */
body.rb-modal-open {
  overflow: hidden;
}

body.requests-view .rb-main {
  --rb-teal: var(--mf-signal-accent-ink, #08758a);
  --rb-cyan-line: var(--mf-signal-accent, #74deeb);
  --rb-paper: var(--mf-surface-panel, #fffefa);
  --rb-graphite: var(--mf-text-strong, #111316);
  --rb-smoke: var(--mf-text-secondary, #65707a);
  --rb-faint: var(--mf-text-disabled, #9aa3ad);
}

.rb-main {
  gap: 20px;
  padding-top: 0;
}

.rb-hero {
  grid-template-columns: minmax(0, 680px) minmax(230px, auto);
  align-items: center;
  gap: 24px;
  padding: 22px 0 20px;
  border-bottom: 1px solid var(--list-line);
}

.rb-hero-copy {
  max-width: 64ch;
}

.rb-title {
  font-size: 30px;
  font-weight: 720;
  line-height: 1.08;
  letter-spacing: 0;
}

.rb-sub {
  max-width: 60ch;
  margin-top: 9px;
  font-size: 15px;
  line-height: 1.55;
}

.rb-hero-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.rb-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--rb-graphite);
  border-radius: 6px;
  background: var(--rb-graphite);
  color: var(--rb-paper);
  font-size: 13.5px;
  font-weight: 680;
}

.rb-cta-icon {
  font-family: var(--list-sans);
  font-size: 19px;
  font-weight: 400;
  line-height: 1;
}

.rb-cta:hover {
  border-color: var(--rb-teal);
  background: var(--rb-teal);
  color: #ffffff;
  transform: translateY(-1px);
}

.rb-cta:focus-visible,
.rb-inline-action:focus-visible,
.rb-modal-close:focus-visible,
.rb-add-market:focus-visible,
.rb-btn-ghost:focus-visible,
.rb-btn-primary:focus-visible,
.rb-similar-act:focus-visible {
  outline: 2px solid var(--list-cyan, #74deeb);
  outline-offset: 2px;
}

.rb-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--list-line);
}

.rb-stats > div {
  min-width: 0;
  min-height: 64px;
  padding: 11px 16px 12px;
  border-right: 1px solid var(--list-line);
}

.rb-stats > div:first-child {
  padding-left: 0;
}

.rb-stats > div:last-child {
  border-right: 0;
}

.rb-stats dt {
  overflow: hidden;
  color: var(--list-faint);
  font-size: 11.5px;
  font-weight: 620;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rb-stats dd {
  margin: 5px 0 0;
  color: var(--list-graphite);
  font-family: var(--list-mono);
  font-size: 18px;
  font-weight: 680;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rb-layout {
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
  gap: 32px;
}

.rb-toolbar {
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: 14px 20px;
  padding: 0 0 14px;
  border-top: 0;
  border-bottom: 1px solid var(--list-line-strong);
}

.rb-toolbar-group,
.rb-select-control {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.rb-toolbar-filters {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  gap: 12px;
}

.rb-toolbar-label {
  color: var(--list-faint);
  font-size: 11.5px;
  font-weight: 650;
  line-height: 1;
}

.rb-select-control {
  flex: 0 0 158px;
}

.rb-select-control select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--list-line-strong);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.84);
  padding: 0 28px 0 10px;
  color: var(--list-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.rb-select-control select:focus-visible {
  border-color: var(--rb-cyan-line);
  outline: 2px solid var(--list-cyan-soft);
  outline-offset: 1px;
}

.rb-seg {
  gap: 2px;
  padding: 2px;
  border-color: var(--list-line-strong);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.68);
}

.rb-seg button {
  flex: 0 0 auto;
  height: 30px;
  min-height: 30px;
  border-radius: 4px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 650;
}

.rb-seg button.active {
  border-color: rgba(83, 191, 205, 0.62);
  background: var(--list-cyan-soft);
  color: var(--rb-graphite);
}

.rb-rows {
  transition: opacity var(--mf-duration-fast, 120ms) var(--mf-ease);
}

.rb-rows.is-loading {
  opacity: 0.58;
  pointer-events: none;
}

.rb-row {
  grid-template-columns: 30px 54px minmax(0, 1fr);
  gap: 14px;
  padding: 19px 0 20px;
  border-top: 0;
  border-bottom: 1px solid var(--list-line);
}

.rb-row:hover {
  background: rgba(116, 222, 235, 0.035);
}

.rb-rank {
  padding-top: 9px;
  font-size: 11.5px;
}

.rb-vote {
  width: 54px;
  height: 54px;
  min-height: 54px;
  justify-content: center;
  gap: 2px;
  padding: 5px 4px;
  border-color: var(--list-line-strong);
  background: rgba(255, 254, 250, 0.88);
}

.rb-vote .rb-tri {
  color: var(--list-faint);
  font-size: 14px;
}

.rb-vote .rb-n {
  font-size: 15px;
  font-weight: 680;
}

.rb-vote:hover:not(:disabled) {
  border-color: var(--rb-cyan-line);
  background: rgba(235, 252, 255, 0.88);
}

.rb-vote.voted {
  border-color: var(--rb-cyan-line);
  background: var(--list-cyan-soft);
}

.rb-vote:disabled {
  opacity: 0.62;
}

.rb-row-head {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 10px;
  margin-bottom: 5px;
}

.rb-row-title {
  min-width: 0;
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.25;
  text-wrap: pretty;
}

.rb-row-desc {
  max-width: 74ch;
  margin: 0 0 10px;
  font-size: 14px;
  line-height: 1.55;
  text-wrap: pretty;
}

.rb-row-meta {
  gap: 7px 10px;
}

.rb-meta-copy {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 7px;
  color: var(--list-faint);
  font-size: 12.5px;
  line-height: 1.4;
}

.rb-meta-copy > span + span::before {
  margin-right: 7px;
  color: var(--list-line-strong);
  content: "·";
}

.rb-meta-copy .rb-wk {
  color: var(--list-pos);
}

.rb-chip {
  flex: 0 0 auto;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11.5px;
  line-height: 1.3;
}

.rb-chip-cat {
  background: rgba(17, 19, 22, 0.045);
}

.rb-live-link {
  margin-top: 9px;
}

.rb-live-link a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-bottom: 0;
  color: var(--list-pos);
  font-size: 13px;
  font-weight: 680;
  text-decoration: none;
}

.rb-live-link a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rb-decline-note {
  margin-top: 9px;
  line-height: 1.45;
}

.rb-empty {
  display: flex;
  min-height: 180px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  padding: 28px 12px;
  border-bottom: 1px solid var(--list-line);
  color: var(--list-muted);
  font-size: 13.5px;
  line-height: 1.45;
}

.rb-empty b {
  color: var(--list-graphite);
  font-size: 15px;
}

.rb-inline-action {
  margin-top: 4px;
  border-bottom: 1px solid rgba(14, 124, 143, 0.34);
  color: var(--rb-teal);
  font-size: 13px;
  font-weight: 680;
  cursor: pointer;
}

.rb-rail {
  gap: 24px;
  top: 20px;
}

.rb-rail-card {
  border-top: 2px solid var(--rb-graphite);
  padding-top: 14px;
}

.rb-rail-kicker {
  margin: 0 0 7px;
  color: var(--rb-teal);
  font-family: var(--list-mono);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.2;
}

.rb-rail-card h3 {
  margin-bottom: 14px;
  font-size: 15px;
  line-height: 1.25;
}

.rb-lifecycle {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rb-lifecycle li {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  padding: 0 0 16px;
  color: var(--list-muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.rb-lifecycle li:last-child {
  padding-bottom: 0;
}

.rb-lifecycle li:not(:last-child)::before {
  position: absolute;
  top: 23px;
  bottom: 1px;
  left: 11px;
  width: 1px;
  background: var(--list-line-strong);
  content: "";
}

.rb-life-marker {
  position: relative;
  z-index: 1;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid var(--list-line-strong);
  border-radius: 50%;
  background: var(--rb-paper);
  color: var(--list-faint);
  font-family: var(--list-mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.rb-lifecycle li:nth-child(2) .rb-life-marker {
  border-color: var(--rb-cyan-line);
  color: var(--rb-teal);
}

.rb-lifecycle li:nth-child(3) .rb-life-marker {
  border-color: rgba(150, 99, 28, 0.48);
  color: var(--rb-amber);
}

.rb-lifecycle li:nth-child(4) .rb-life-marker {
  border-color: rgba(22, 135, 101, 0.5);
  color: var(--list-pos);
}

.rb-lifecycle b {
  display: block;
  margin-bottom: 2px;
  color: var(--list-graphite);
  font-size: 12.5px;
  font-weight: 680;
}

.rb-shipped li {
  align-items: baseline;
  padding: 9px 0;
}

.rb-shipped a {
  font-weight: 600;
}

.rb-rail-note {
  padding-top: 14px;
  font-size: 12px;
  line-height: 1.55;
}

.rb-modal-backdrop {
  align-items: center;
  padding: 24px;
  background: rgba(17, 19, 22, 0.46);
}

.rb-modal {
  display: flex;
  width: min(680px, 100%);
  max-height: calc(100dvh - 48px);
  flex-direction: column;
  overflow: hidden;
  border-color: rgba(17, 19, 22, 0.18);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 60px rgba(17, 19, 22, 0.22);
}

.rb-modal-head {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid rgba(17, 19, 22, 0.1);
}

.rb-modal-eyebrow {
  margin: 0 0 6px;
  color: var(--rb-teal, #0e7c8f);
  font-family: var(--list-mono, "SF Mono", Menlo, Consolas, monospace);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.2;
}

.rb-modal h2 {
  margin: 0;
  font-size: 23px;
  font-weight: 720;
  line-height: 1.15;
  letter-spacing: 0;
}

.rb-modal-sub {
  max-width: 56ch;
  margin: 7px 0 0;
  font-size: 13.5px;
  line-height: 1.5;
}

.rb-modal-close {
  display: grid;
  width: 34px;
  height: 34px;
  min-height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border: 1px solid rgba(17, 19, 22, 0.14);
  border-radius: 6px;
  background: transparent;
  color: #65707a;
  font-family: Arial, sans-serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.rb-modal-close:hover {
  border-color: rgba(17, 19, 22, 0.28);
  background: rgba(17, 19, 22, 0.04);
  color: #111316;
}

.rb-modal-body {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px 26px 4px;
}

.rb-field {
  margin-bottom: 18px;
}

.rb-field-short {
  width: min(260px, 100%);
}

.rb-field label {
  align-items: baseline;
  margin-bottom: 7px;
  color: #303840;
  font-size: 12.5px;
  font-weight: 680;
}

.rb-field-meta {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  color: #929da8;
  font-size: 11.5px;
  font-weight: 520;
  white-space: nowrap;
}

.rb-field input[type="text"],
.rb-field textarea,
.rb-field select {
  min-height: 42px;
  border-color: rgba(17, 19, 22, 0.17);
  background: #ffffff;
  padding: 10px 11px;
  font-size: 14px;
  line-height: 1.4;
}

.rb-field textarea {
  min-height: 82px;
}

.rb-field input::placeholder,
.rb-field textarea::placeholder {
  color: #9aa3ad;
  opacity: 1;
}

.rb-field input:focus,
.rb-field textarea:focus,
.rb-field select:focus {
  border-color: #53bfcd;
  outline: 2px solid rgba(116, 222, 235, 0.48);
  outline-offset: 1px;
  box-shadow: none;
}

#rb-markets {
  gap: 8px;
}

.rb-add-market {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  color: #0e7c8f;
  font-size: 12.5px;
}

.rb-add-market span {
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
}

.rb-hint {
  margin-top: 7px;
  font-size: 12px;
  line-height: 1.45;
}

.rb-similar {
  margin: -4px 0 18px;
  border-color: rgba(83, 191, 205, 0.58);
  border-radius: 6px;
  background: rgba(116, 222, 235, 0.11);
  padding: 11px 12px;
}

.rb-similar > b {
  margin-bottom: 8px;
  font-size: 12.5px;
}

.rb-similar-item {
  gap: 12px;
  padding: 5px 0;
}

.rb-similar-act {
  min-height: 28px;
  border-color: rgba(14, 124, 143, 0.58);
  padding: 3px 9px;
}

.rb-form-error {
  margin: 0 0 18px;
  border-left: 3px solid #c85261;
  background: rgba(200, 82, 97, 0.07);
  padding: 9px 11px;
  color: #a83e4c;
  font-size: 12.5px;
  line-height: 1.45;
}

.rb-modal-foot {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 0;
  border-top: 1px solid rgba(17, 19, 22, 0.1);
  background: rgba(250, 250, 247, 0.84);
  padding: 14px 26px;
}

.rb-modal-note {
  max-width: 43ch;
  margin: 0;
  color: #7e8994;
  font-size: 11.5px;
  line-height: 1.45;
}

.rb-modal-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.rb-btn-ghost,
.rb-btn-primary {
  min-height: 38px;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 680;
}

.rb-btn-ghost {
  border-color: rgba(17, 19, 22, 0.17);
  background: #ffffff;
}

.rb-btn-ghost:hover {
  border-color: rgba(17, 19, 22, 0.32);
  color: #111316;
}

.rb-btn-primary {
  margin-left: 0;
  border-color: #111316;
  background: #111316;
  color: #ffffff;
}

.rb-btn-primary:hover {
  border-color: #0e7c8f;
  background: #0e7c8f;
}

.rb-toast {
  border-color: rgba(17, 19, 22, 0.16);
  background: #111316;
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(17, 19, 22, 0.2);
}

@media (max-width: 1060px) {
  .rb-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .rb-toolbar-filters {
    justify-content: space-between;
  }
}

@media (max-width: 900px) {
  .rb-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .rb-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
  }

  .rb-rail-note {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .rb-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .rb-hero-action {
    align-items: flex-start;
  }

  .rb-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rb-stats > div:nth-child(2) {
    border-right: 0;
  }

  .rb-stats > div:nth-child(n + 3) {
    border-top: 1px solid var(--list-line);
  }

  .rb-stats > div:nth-child(3) {
    padding-left: 0;
  }
}

@media (max-width: 640px) {
  .rb-main {
    gap: 18px;
    padding-top: 0;
  }

  .rb-hero {
    gap: 16px;
    padding: 18px 0;
  }

  .rb-title {
    font-size: 28px;
  }

  .rb-sub {
    font-size: 14px;
  }

  .rb-hero-action {
    width: 100%;
  }

  .rb-cta {
    width: 100%;
    margin-left: 0;
  }

  .rb-stats {
    padding-bottom: 0;
  }

  .rb-stats > div {
    min-height: 60px;
    padding: 10px 12px 11px;
  }

  .rb-toolbar {
    align-items: stretch;
    gap: 14px;
    padding: 0 0 14px;
  }

  .rb-toolbar-filters {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .rb-select-control {
    width: 100%;
    flex-basis: auto;
  }

  .rb-seg {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
  }

  .rb-seg button {
    flex: 1 0 auto;
  }

  .rb-row {
    grid-template-columns: 50px minmax(0, 1fr);
    gap: 12px;
    padding: 17px 0 18px;
  }

  .rb-vote {
    width: 50px;
    height: 50px;
    min-height: 50px;
  }

  .rb-row-title {
    font-size: 17px;
  }

  .rb-row-desc {
    font-size: 13.5px;
  }

  .rb-meta-copy {
    flex-basis: 100%;
  }

  .rb-rail {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .rb-rail-note {
    grid-column: auto;
  }

  .rb-modal-backdrop {
    align-items: stretch;
    padding: 0;
  }

  .rb-modal {
    width: 100%;
    max-height: 100dvh;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .rb-modal-head {
    padding: 18px 16px 15px;
  }

  .rb-modal h2 {
    font-size: 21px;
  }

  .rb-modal-body {
    padding: 18px 16px 2px;
  }

  .rb-modal-foot {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  }

  .rb-modal-note {
    order: 0;
    max-width: none;
    flex: 1 1 100%;
    margin: 0;
  }

  .rb-modal-actions {
    width: 100%;
  }

  .rb-modal-actions > button {
    flex: 1 1 0;
  }

  .rb-similar-item {
    align-items: flex-start;
  }
}

/* Keep the top-level dashboard surfaces aligned beneath the shared navigation. */
body.dashboard-view :is(#dashboard, #portfolio-dashboard, #requests-dashboard) {
  margin-top: 18px;
}

body.dashboard-view #dashboard {
  padding-top: 18px;
}

body.dashboard-view #portfolio-dashboard {
  padding-top: 12px;
}

@media (max-width: 640px) {
  body.dashboard-view :is(#dashboard, #portfolio-dashboard, #requests-dashboard) {
    margin-top: 12px;
  }

  body.dashboard-view #dashboard {
    padding-top: 12px;
  }

  body.dashboard-view #portfolio-dashboard {
    padding-top: 8px;
  }

}

@media (prefers-reduced-motion: reduce) {
  .rb-rows,
  .rb-btn-primary,
  .rb-modal-close {
    transition: none;
  }
}

/* Shared app navigation: the Trend Details back control is the single visual standard. */
.app-back,
#mf-modal-host .app-back,
.mf-portfolio .app-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: auto;
  min-width: 0;
  height: 30px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--detail-line, var(--border-soft));
  border-radius: var(--mf-radius-round);
  background: rgba(255, 254, 250, 0.68);
  color: var(--detail-label, var(--text-dim));
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
  font-size: 12px;
  font-weight: var(--mf-pf-weight-middle);
  letter-spacing: 0;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: none;
  transform: none;
  transition: border-color var(--mf-duration-standard, 180ms) var(--mf-ease), background-color var(--mf-duration-standard, 180ms) var(--mf-ease), color var(--mf-duration-standard, 180ms) var(--mf-ease);
}

.app-back::before {
  content: "←";
  display: inline-block;
  font-family: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
}

.app-back:hover,
#mf-modal-host .app-back:hover,
.mf-portfolio .app-back:hover {
  border-color: var(--detail-line-strong, var(--border));
  background: var(--detail-panel, var(--panel));
  color: var(--detail-graphite, var(--text));
  box-shadow: none;
  transform: none;
}

.app-back:active,
#mf-modal-host .app-back:active,
.mf-portfolio .app-back:active {
  box-shadow: none;
  transform: none;
}

.app-back:focus-visible {
  outline: 2px solid var(--detail-cyan, var(--accent));
  outline-offset: 2px;
}

.review-back.app-back {
  display: none;
  margin: 0 0 12px;
}

@media (max-width: 880px) {
  .review-back.app-back {
    display: inline-flex;
  }
}

/* ── Living-measurement spine (LIVING_MEASUREMENTS_PLAN §7): update-kind chips, amendment cards,
   roll-off scorecards, lifecycled (superseded) trust records. Conditional — a def with no amendments,
   roll-offs or history renders byte-identical to before. ── */
.nav-update-kind {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-family: var(--detail-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.nav-update-kind-amendment { color: #0e8ba8; border: 1px solid rgba(14, 139, 168, 0.35); background: rgba(116, 222, 235, 0.12); }
.nav-update-kind-rolloff { color: var(--detail-muted); border: 1px solid var(--detail-line); background: rgba(246, 247, 244, 0.7); }
.nav-update-kind-rebase { color: var(--detail-neg); border: 1px solid rgba(200, 82, 97, 0.35); background: rgba(200, 82, 97, 0.08); }
.nav-update-amend-summary {
  font-family: var(--detail-sans);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--detail-graphite);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-update-scorecard {
  font-family: var(--detail-mono);
  font-size: 11px;
  color: var(--detail-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.nav-update-amendment {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid rgba(14, 139, 168, 0.25);
  background: rgba(116, 222, 235, 0.07);
}
.nav-update-amendment-title { margin: 0 0 3px; font-family: var(--detail-sans); font-size: 13px; font-weight: 650; color: var(--detail-graphite); }
.nav-update-amendment-copy { margin: 0 0 4px; font-family: var(--detail-sans); font-size: 12.5px; line-height: 1.55; color: var(--detail-copy-muted); max-width: 70ch; }
.nav-audit-struck .nav-audit-disc-q,
.nav-audit-struck .nav-audit-row-title { text-decoration: line-through; text-decoration-color: rgba(101, 112, 125, 0.5); color: var(--detail-muted); }
.nav-audit-history-group > summary .nav-audit-disc-q { color: var(--detail-muted); font-weight: 560; }

/* ── Portfolio detail layout system ───────────────────────────────────────────────────────────── */
.mf-portfolio-detail {
  gap: 18px;
}

.mf-portfolio-detail .mf-detail-topbar {
  justify-content: space-between;
  gap: 12px 20px;
  min-width: 0;
}

/* Rail: persistent ownership and AI-management context beside the analytical workspace. */
.mf-return-summary-context-steward,
.mf-return-summary-title-steward {
  display: none;
}

/* One column. The rail existed to hold the hero plus four secondary cards; the hero is now full width and
   everything that was beside it is either in the money ledger or collapsed at the foot of the page, so a
   320px column would just be empty space next to the workspace. */
.mf-portfolio-detail {
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 18px;
}

.mf-portfolio-detail .mf-detail-topbar {
  grid-column: 1 / -1;
}

/* Full width, above both columns. Pinned to the 320px rail the value figure had nowhere to breathe and the
   page opened with its most important number set in a sidebar. */
.mf-portfolio-detail .mf-detail-hero {
  grid-column: 1 / -1;
  align-self: start;
  padding: 0 0 18px;
  border: 0;
  border-bottom: 1px solid var(--mf-pf-line);
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.mf-portfolio-detail .mf-detail-rail-eyebrow {
  margin: 0 0 13px;
  color: var(--mf-cyan-ink);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-meta);
  font-weight: var(--mf-pf-weight-heading);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mf-portfolio-detail .mf-detail-hero-main {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.mf-portfolio-detail .mf-detail-identity {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
}

.mf-portfolio-detail .mf-identity-block {
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* The identity link is now the avatar alone, row-spanning .mf-hero-subject so it stretches to whatever
   height the text column next to it takes — not a fixed square pinned to the title line. Flex (not a
   percentage height on a block child) fills that height reliably: align-items:stretch is flex's default. */
.mf-portfolio-detail .mf-theme-identity {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0;
  border-bottom: 0;
  border-radius: var(--mf-radius-sm);
  overflow: hidden;
}

.mf-portfolio-detail .mf-theme-identity > .mf-poscard-image {
  width: var(--mf-hero-avatar);
  height: auto;
}

.mf-portfolio-detail .mf-hero-title-link {
  display: block;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.mf-portfolio-detail .mf-hero-title-link:hover h2 {
  text-decoration: underline;
  text-decoration-color: var(--mf-line-strong);
  text-underline-offset: 3px;
}

.mf-portfolio-detail .mf-hero-title-link:focus-visible {
  outline: 2px solid var(--mf-cyan);
  outline-offset: 2px;
}

.mf-portfolio-detail .mf-hero-title-link h2 {
  overflow: visible;
  margin: 0;
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-title-md);
  font-weight: var(--mf-pf-weight-heading);
  line-height: 1.14;
  letter-spacing: 0;
  text-overflow: clip;
  text-wrap: balance;
  white-space: normal;
}

.mf-portfolio-detail .mf-direction-identity {
  padding: 14px 0;
  border-bottom: 1px solid var(--mf-pf-line);
  box-shadow: none;
}

.mf-portfolio-detail .mf-direction-identity-long {
  color: var(--mf-graphite);
}

.mf-portfolio-detail .mf-direction-identity-short {
  color: var(--mf-graphite);
}

.mf-portfolio-detail .mf-detail-identity-meta {
  grid-column: 1;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding-top: 14px;
}

/* Both hug their content in the hero row. They were full-width bands when the hero was a 320px rail card;
   stretched across the page they read as page-level banners rather than status about one position. */
.mf-portfolio-detail .mf-detail-status,
.mf-portfolio-detail .mf-detail-wallet {
  width: auto;
  max-width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.mf-portfolio-detail .mf-detail-status {
  min-height: 0;
  padding: 0;
}

.mf-portfolio-detail .mf-detail-status-dot {
  width: 7px;
  height: 7px;
}

.mf-portfolio-detail .mf-detail-status-copy small {
  font-size: 9.5px;
}

.mf-portfolio-detail .mf-detail-status-copy strong {
  font-size: var(--mf-font-size-body);
}

.mf-portfolio-detail .mf-detail-status-attention {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid rgba(200, 82, 97, 0.30);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-neg-soft);
}

.mf-portfolio-detail .mf-detail-status-closed,
.mf-portfolio-detail .mf-detail-status-neutral {
  border-color: var(--mf-line-strong);
  border-left-color: rgba(97, 94, 86, 0.58);
  background: rgba(154, 145, 122, 0.09);
  color: var(--mf-muted);
}

/* Settlement (TAS-2391): distinct from plain closed. */
.mf-portfolio-detail .mf-detail-status-settlement {
  border-color: rgba(31, 122, 112, 0.30);
  border-left-color: rgba(31, 122, 112, 0.58);
  background: rgba(227, 242, 239, 0.72);
  color: var(--mf-accent-ink, #0e6a61);
}

.mf-portfolio-detail .mf-detail-wallet {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  padding: 14px 0 0;
  border-top: 1px solid var(--mf-pf-line);
}

.mf-portfolio-detail .mf-detail-wallet > svg {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin-top: 2px;
}

.mf-portfolio-detail .mf-detail-wallet > span {
  grid-column: 2;
  color: var(--mf-graphite);
  font-size: var(--mf-font-size-body-sm);
  font-weight: var(--mf-pf-weight-heading);
  white-space: normal;
}

.mf-portfolio-detail .mf-detail-wallet a {
  grid-column: 2;
  justify-self: start;
  max-width: 100%;
  min-height: 34px;
  margin-top: 2px;
  padding-inline: 8px;
}

.mf-portfolio-detail .mf-detail-capital {
  margin-top: 16px;
  padding-top: 15px;
  border-top: 1px solid var(--mf-pf-line);
}

.mf-portfolio-detail .mf-detail-capital-label {
  margin: 0 0 8px;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-meta);
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1;
}

.mf-portfolio-detail .mf-detail-stat-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.mf-portfolio-detail .mf-detail-stat {
  min-height: 68px;
  justify-items: start;
  gap: 6px;
  padding: 10px;
  font-size: 18px;
  text-align: left;
}

.mf-portfolio-detail .mf-detail-stat + .mf-detail-stat {
  border-left: 0;
}

.mf-portfolio-detail .mf-detail-stat:nth-child(even) {
  border-left: 1px solid var(--mf-pf-line);
}

.mf-portfolio-detail .mf-detail-stat:nth-child(n + 3) {
  border-top: 1px solid var(--mf-pf-line);
}

.mf-portfolio-detail .mf-detail-stat > .mf-usdc-money,
.mf-portfolio-detail .mf-detail-stat > span > .mf-usdc-money {
  font-size: 18px;
}

.mf-portfolio-detail .mf-poscard-detail-page {
  grid-column: 1 / -1;
}

.mf-portfolio-detail .mf-group-detail {
  gap: 24px;
}

.mf-portfolio-detail .mf-performance-section {
  padding: 18px 18px 20px;
  border: 1px solid var(--mf-pf-line);
  border-radius: var(--mf-radius-md);
  background: rgba(255, 254, 250, 0.92);
  box-shadow: none;
}

.mf-portfolio-detail .mf-direction-overview {
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.mf-portfolio-detail .mf-direction-chart-panel {
  grid-column: 1;
  grid-row: 2;
}

.mf-portfolio-detail .mf-direction-section-head.compact {
  align-items: center;
  margin: 0;
  padding: 12px 14px;
  border-right: 1px solid var(--mf-pf-line);
}

.mf-portfolio-detail .mf-return-summary-context-default,
.mf-portfolio-detail .mf-return-summary-title-default {
  display: none;
}

.mf-portfolio-detail .mf-return-summary-context-steward,
.mf-portfolio-detail .mf-return-summary-title-steward {
  display: block;
}

.mf-portfolio-detail .mf-return-kpi-current strong,
.mf-portfolio-detail .mf-return-kpi-window strong {
  font-size: var(--mf-font-size-title-sm);
}

.mf-portfolio-detail :is(.mf-return-kpi-cash, .mf-return-kpi-pnl) {
  display: none;
}

.mf-portfolio-detail .mf-direction-chart {
  height: 300px;
}

/* Typography scale: keep like-for-like labels, headings, and values on shared tokens. */
.mf-portfolio-detail {
  --mf-pf-type-eyebrow: var(--mf-font-size-meta);
  --mf-pf-type-label: var(--mf-font-size-label);
  --mf-pf-type-support: var(--mf-font-size-label);
  --mf-pf-type-body: var(--mf-font-size-body-sm);
  --mf-pf-type-section: var(--mf-font-size-title-sm);
  --mf-pf-type-title: var(--mf-font-size-title-md);
  --mf-pf-type-value: var(--mf-font-size-title-sm);
  --mf-pf-type-kpi: var(--mf-font-size-title-sm);
}

.mf-portfolio-detail .mf-detail-rail-eyebrow {
  font-size: var(--mf-pf-type-eyebrow);
  line-height: 1.2;
}

.mf-portfolio-detail :is(
  .mf-identity-block small,
.mf-detail-status-copy small,
.mf-detail-capital-label,
.mf-detail-stat small,
.mf-market-metrics small
) {
  font-size: var(--mf-pf-type-label);
  line-height: 1.2;
}

.mf-portfolio-detail :is(
  .mf-theme-identity h2,
  .mf-direction-identity strong
) {
  font-size: var(--mf-pf-type-title);
  line-height: 1.14;
}

.mf-portfolio-detail :is(
  .mf-detail-status-copy strong,
  .mf-detail-wallet > span
) {
  font-size: var(--mf-pf-type-body);
  line-height: 1.2;
}

.mf-portfolio-detail :is(
  .mf-direction-section-head h3,
  .mf-tab-section-head h3
) {
  font-size: var(--mf-pf-type-section);
  line-height: 1.15;
}

.mf-portfolio-detail .mf-direction-section-head span {
  font-size: var(--mf-pf-type-label);
  line-height: 1.2;
}

.mf-portfolio-detail .mf-tab-section-head > small {
  font-size: var(--mf-pf-type-support);
  line-height: 1.2;
}

.mf-portfolio-detail .mf-detail-stat,
.mf-portfolio-detail .mf-detail-stat > .mf-usdc-money,
.mf-portfolio-detail .mf-detail-stat > span > .mf-usdc-money {
  font-size: var(--mf-pf-type-value);
}

.mf-portfolio-detail .mf-market-meta {
  font-size: var(--mf-pf-type-support);
  line-height: 1.3;
}

@media (min-width: 1121px) {
  .mf-portfolio-detail .mf-detail-hero {
    position: static;
    grid-column: 1 / -1;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 1120px) {

  .mf-portfolio-detail {
    grid-template-columns: minmax(0, 1fr);
  }

  .mf-portfolio-detail .mf-detail-hero,
  .mf-portfolio-detail .mf-poscard-detail-page {
    grid-column: 1;
  }

  .mf-portfolio-detail .mf-detail-hero-main {
    grid-template-columns: minmax(0, 1fr) minmax(380px, 0.88fr);
    gap: 20px;
  }

  .mf-portfolio-detail .mf-detail-capital {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }

  .mf-portfolio-detail .mf-detail-stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    height: 100%;
  }

  .mf-portfolio-detail .mf-detail-stat:nth-child(n + 3) {
    border-top: 0;
  }

  .mf-portfolio-detail .mf-detail-stat:nth-child(even) {
    border-left: 0;
  }

  .mf-portfolio-detail .mf-detail-stat + .mf-detail-stat {
    border-left: 1px solid var(--mf-pf-line);
  }
}

@media (max-width: 900px) {
  .mf-portfolio-detail .mf-detail-hero-main {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .mf-portfolio-detail .mf-detail-capital {
    margin-top: 15px;
    padding-top: 14px;
    border-top: 1px solid var(--mf-pf-line);
  }
}

@media (max-width: 760px) {
  .mf-portfolio-detail .mf-detail-topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .mf-portfolio-detail .mf-detail-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    height: auto;
  }

  .mf-portfolio-detail .mf-detail-stat:nth-child(odd) {
    border-left: 0;
  }

  .mf-portfolio-detail .mf-detail-stat:nth-child(n + 3) {
    border-top: 1px solid var(--mf-pf-line);
  }

  .mf-portfolio-detail .mf-performance-section {
    padding: 14px;
  }

  .mf-portfolio-detail .mf-detail-hero-main {
    grid-template-columns: minmax(0, 1fr);
  }

  .mf-portfolio-detail .mf-detail-hero {
    padding: 14px;
  }

  .mf-portfolio-detail .mf-detail-rail-eyebrow {
    margin-bottom: 11px;
  }

  .mf-portfolio-detail .mf-detail-identity {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mf-portfolio-detail .mf-theme-identity {
    grid-column: 1 / -1;
  }

  .mf-portfolio-detail .mf-direction-identity {
    grid-column: 1;
    padding: 12px 12px 12px 0;
    border-right: 1px solid var(--mf-pf-line);
    border-bottom: 0;
  }

  .mf-portfolio-detail .mf-detail-identity-meta {
    display: contents;
  }

  .mf-portfolio-detail .mf-detail-status {
    align-self: center;
    padding: 7px 12px;
  }

  .mf-portfolio-detail .mf-detail-wallet {
    padding-top: 0;
  }

  .mf-portfolio-detail .mf-detail-wallet a {
    min-height: 40px;
  }

  .mf-portfolio-detail .mf-detail-capital {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--mf-pf-line);
  }

  .mf-portfolio-detail .mf-performance-head h2 {
    white-space: normal;
    text-wrap: balance;
  }

  .mf-portfolio-detail .mf-performance-head .mf-chart-controls,
  .mf-portfolio-detail .mf-performance-head .mf-chart-range {
    width: 100%;
  }

  .mf-portfolio-detail .mf-performance-head .mf-chart-range {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }

  .mf-portfolio-detail .mf-performance-head .chart-range-button {
    width: 100%;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    padding-inline: 5px;
  }

  .mf-portfolio-detail .mf-performance-head .mf-custom-range {
    grid-column: 1 / -1;
    width: 100%;
  }

  .mf-portfolio-detail .mf-direction-chart {
    height: 228px;
  }

  .mf-portfolio-detail .mf-detail-tabbar {
    gap: 14px;
  }

  .mf-portfolio-detail .mf-market-title {
    display: -webkit-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }
}

@media (min-width: 761px) and (max-width: 900px) {
  .mf-portfolio-detail .mf-detail-identity {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .mf-portfolio-detail .mf-theme-identity {
    grid-column: 1 / -1;
  }

  .mf-portfolio-detail .mf-direction-identity {
    grid-column: 1;
    padding: 12px 14px 12px 0;
    border-right: 1px solid var(--mf-pf-line);
    border-bottom: 0;
  }

  .mf-portfolio-detail .mf-detail-identity-meta {
    grid-column: 2;
    grid-template-columns: minmax(170px, 0.42fr) minmax(0, 1fr);
    padding-top: 0;
  }

  .mf-portfolio-detail .mf-detail-status {
    align-self: stretch;
    padding: 12px 14px;
  }

  .mf-portfolio-detail .mf-detail-status-attention {
    margin-bottom: 0;
  }

  .mf-portfolio-detail .mf-detail-wallet {
    align-self: stretch;
    padding: 12px 0 12px 14px;
    border-top: 0;
    border-left: 1px solid var(--mf-pf-line);
  }
}

@media (max-width: 430px) {

  .mf-portfolio-detail .mf-direction-section-head.compact {
    padding: 11px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--mf-pf-line);
  }

  .mf-portfolio-detail .mf-detail-tabbar {
    gap: 6px;
  }

  .mf-portfolio-detail .mf-detail-tab {
    gap: 4px;
    font-size: var(--mf-font-size-meta);
  }

  .mf-portfolio-detail .mf-detail-tab em {
    min-width: 15px;
    height: 15px;
    padding-inline: 3px;
    font-size: 8.5px;
  }
}

/* Rail balance: separate direction, lifecycle, and custody into three readable information bands. */
.mf-portfolio-detail .mf-direction-identity {
  padding: 15px 0 17px;
}

.mf-portfolio-detail .mf-direction-identity strong {
  letter-spacing: 0;
}

.mf-portfolio-detail .mf-detail-identity-meta {
  padding-top: 14px;
}

/* The tone class carries the colour. This rule used to hard-code an amber tint and a 3px left stripe for
   every state, so a green "Holding" and a red "Action needed" both rendered amber — the status pill stopped
   encoding status. Border and tint now come from the .mf-detail-status-<tone> rules; the dot plus the label
   text still carry the meaning without colour, per the non-colour-semantics rule. */
.mf-portfolio-detail .mf-detail-status {
  min-height: 0;
  align-items: center;
  padding: 7px 12px;
  border: 1px solid currentColor;
  border-radius: var(--mf-radius-round);
  background: transparent;
}

.mf-portfolio-detail .mf-detail-status-holding { border-color: rgba(22, 135, 101, 0.34); background: var(--mf-pos-soft); color: var(--mf-pos); }
.mf-portfolio-detail .mf-detail-status-building,
.mf-portfolio-detail .mf-detail-status-rebalancing { border-color: rgba(168, 100, 31, 0.32); background: var(--mf-warn-soft); color: var(--mf-warn); }

.mf-portfolio-detail .mf-detail-status-dot {
  width: 8px;
  height: 8px;
}

.mf-portfolio-detail .mf-detail-status-copy {
  gap: 4px;
}

.mf-portfolio-detail .mf-detail-status-copy small {
  font-size: var(--mf-font-size-meta);
  line-height: 1.15;
  letter-spacing: 0.01em;
}

.mf-portfolio-detail .mf-detail-status-copy strong {
  font-size: 14px;
  line-height: 1.15;
}

.mf-portfolio-detail .mf-detail-status-attention {
  border-color: rgba(200, 82, 97, 0.34);
  background: rgba(200, 82, 97, 0.075);
  color: var(--mf-neg);
}

.mf-portfolio-detail .mf-detail-status-closed,
.mf-portfolio-detail .mf-detail-status-neutral {
  border-color: var(--mf-line-strong);
  background: transparent;
  color: var(--mf-muted);
}

/* Settlement (TAS-2391): closed-and-self-finishing — distinct from both in-flight and plain closed. */
.mf-portfolio-detail .mf-detail-status-settlement {
  border-color: rgba(31, 122, 112, 0.30);
  background: rgba(227, 242, 239, 0.6);
  color: var(--mf-accent-ink, #0e6a61);
}

/* A quiet inline chip, not a boxed card: it is provenance, not a control. */
.mf-portfolio-detail .mf-detail-wallet {
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.mf-portfolio-detail .mf-detail-wallet > svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--mf-cyan-ink);
}

.mf-portfolio-detail .mf-detail-wallet > span {
  font-size: 13px;
  font-weight: var(--mf-pf-weight-middle);
  line-height: 1.2;
}

.mf-portfolio-detail .mf-detail-wallet a {
  min-height: 30px;
  margin-top: 4px;
  padding: 4px 8px;
  border-color: rgba(14, 139, 168, 0.22);
  background: rgba(235, 252, 255, 0.72);
  font-size: var(--mf-font-size-label);
  line-height: 1;
}

.mf-portfolio-detail :is(
  .mf-detail-rail-eyebrow,
.mf-identity-block small,
.mf-detail-status-copy small,
.mf-detail-capital-label,
.mf-detail-stat small,
.mf-direction-section-head span,
.mf-market-metrics small,
.mf-detail-tab
) {
  font-weight: var(--mf-pf-weight-middle);
}

.mf-portfolio-detail :is(
  .mf-theme-identity h2,
  .mf-direction-identity strong,
  .mf-performance-head h2,
  .mf-direction-section-head h3,
  .mf-tab-section-head h3
) {
  font-weight: var(--mf-pf-weight-heading);
}

.mf-portfolio-detail :is(
  .mf-detail-status-copy strong,
.mf-detail-wallet > span,
.mf-detail-stat,
.mf-market-metrics strong
) {
  font-weight: var(--mf-pf-weight-middle);
}

.mf-portfolio-detail :is(
  .mf-direction-desc,
  .mf-market-meta
) {
  font-weight: var(--mf-pf-weight-body);
}

.mf-portfolio-detail .mf-market-title {
  font-weight: var(--mf-pf-weight-middle);
}

/* Mid-width collision guard: keep lifecycle copy, switch, and wallet inside their own cards. */
.mf-portfolio-detail .mf-detail-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-width: 0;
}

.mf-portfolio-detail .mf-detail-status-copy {
  min-width: 0;
}

.mf-portfolio-detail .mf-detail-status-copy strong {
  overflow-wrap: anywhere;
  white-space: normal;
}

@media (min-width: 761px) and (max-width: 900px) {
  .mf-portfolio-detail .mf-detail-identity {
    grid-template-columns: minmax(132px, 0.26fr) minmax(0, 1fr);
  }

  .mf-portfolio-detail .mf-detail-identity-meta {
    grid-template-columns: minmax(224px, 0.62fr) minmax(210px, 1fr);
    gap: 12px;
  }

  .mf-portfolio-detail .mf-detail-status {
    margin: 0;
  }

  .mf-portfolio-detail .mf-detail-wallet {
    min-width: 0;
    margin-top: 0;
    padding: 12px;
    border: 1px solid rgba(14, 139, 168, 0.17);
  }
}

/* ── Portfolio position-management controls (exit / collect / withdraw) — ported from the engine SPA ── */
/* Distinct names (mf-poscard-actbar / mf-wd-addr) to avoid colliding with the pre-existing .mf-poscard-actions
   and .mf-addr rules elsewhere in this sheet. */
.mf-poscard-actbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 14px;
}
.mf-residual-exposure {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--mf-pf-line);
}
.mf-residual-exposure-note {
  margin: 0;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 12px;
  line-height: 1.55;
}
.mf-residual-attempt {
  overflow: hidden;
  border: 1px solid rgba(154, 145, 122, 0.28);
  border-radius: 7px;
  background: rgba(247, 244, 235, 0.42);
}
.mf-residual-attempt-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--mf-line);
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: 11px;
}
.mf-residual-attempt-head strong { color: var(--mf-graphite); font-size: 12px; }
.mf-residual-attempt-head code { margin-left: auto; color: var(--mf-faint); font-family: var(--mf-mono); }
.mf-residual-market-list { display: grid; gap: 8px; padding: 10px; }
.mf-residual-market-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(154, 145, 122, 0.2);
  border-radius: var(--mf-radius-sm);
  background: rgba(255, 254, 250, 0.82);
}
.mf-residual-market-main { min-width: 0; display: grid; gap: 3px; }
.mf-residual-market-main strong { overflow-wrap: anywhere; color: var(--mf-ink); font-family: var(--mf-sans); font-size: 12px; }
.mf-residual-market-main span { color: var(--mf-muted); font-family: var(--mf-sans); font-size: var(--mf-font-size-meta); }
.mf-residual-market-facts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 16px; }
.mf-residual-market-facts > span { display: grid; gap: 2px; text-align: right; }
.mf-residual-market-facts small { color: var(--mf-faint); font-family: var(--mf-sans); font-size: var(--mf-font-size-meta); }
.mf-residual-market-facts strong { color: var(--mf-graphite); font-family: var(--mf-mono); font-size: 11px; }
@media (max-width: 640px) {
  .mf-residual-market-row { grid-template-columns: 1fr; }
  .mf-residual-market-facts { justify-content: flex-start; }
  .mf-residual-market-facts > span { text-align: left; }
}
.mf-exit-opt {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  margin-top: 10px;
  border: 1px solid var(--mf-line);
  border-radius: var(--mf-control-radius, 12px);
  cursor: pointer;
}
.mf-exit-opt input {
  margin-top: 3px;
}
.mf-exit-est {
  font-size: 11px;
  opacity: 0.85;
}

.mf-wd-addr {
  display: inline;
  font-family: var(--mf-mono, ui-monospace, monospace);
  font-size: 12px;
}

/* ── AI-management confirmation surfaces ─────────────────────────────────────── */
.mf-ai-stop-dialog {
  display: grid;
  gap: var(--mf-space-4);
  color: var(--mf-text-primary);
  font-family: var(--mf-font-sans);
}

.mf-ai-stop-dialog > p {
  max-width: var(--mf-layout-reading-max);
  margin: 0;
  color: var(--mf-text-secondary);
  font-size: var(--mf-font-size-body);
  line-height: var(--mf-line-height-body);
}

.mf-ai-stop-dialog > p strong {
  color: var(--mf-text-strong);
  font-weight: var(--mf-font-weight-semibold);
}

.mf-ai-stop-effects {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: var(--mf-rule-width) solid var(--mf-border-subtle);
  border-bottom: var(--mf-rule-width) solid var(--mf-border-subtle);
}

.mf-ai-stop-effects > span {
  display: grid;
  gap: var(--mf-space-1);
  min-width: 0;
  padding: var(--mf-space-3) 0;
}

.mf-ai-stop-effects > span + span {
  padding-left: var(--mf-space-3);
  border-left: var(--mf-rule-width) solid var(--mf-border-subtle);
}

.mf-ai-stop-effects small {
  color: var(--mf-text-secondary);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-font-weight-semibold);
}

.mf-ai-stop-effects strong {
  color: var(--mf-text-strong);
  font-size: var(--mf-font-size-body);
  font-weight: var(--mf-font-weight-semibold);
  line-height: var(--mf-line-height-title);
}

.mf-ai-stop-lock {
  display: grid;
  gap: var(--mf-space-1);
  padding: var(--mf-space-3);
  border: var(--mf-rule-width) solid var(--mf-border-default);
  border-left: var(--mf-signal-rail-width) solid var(--mf-status-warning);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-surface-subtle);
}

.mf-ai-stop-lock > strong {
  color: var(--mf-status-warning-text);
  font-size: var(--mf-font-size-body);
  font-weight: var(--mf-font-weight-semibold);
}

.mf-ai-stop-lock > span {
  color: var(--mf-text-secondary);
  font-size: var(--mf-font-size-body-sm);
  line-height: var(--mf-line-height-body);
}

@media (max-width: 640px) {
  .mf-ai-stop-effects {
    grid-template-columns: minmax(0, 1fr);
  }

  .mf-ai-stop-effects > span + span {
    padding-left: 0;
    border-top: var(--mf-rule-width) solid var(--mf-border-subtle);
    border-left: 0;
  }
}

/* ── Self-custody: export key / revoke platform signer (TAS-2378) ───────────────────────────────────
   A wallet-scoped card in the position detail rail, plus the same rows inside the account-level modal.
   Quiet by construction: this sits beside Execution Safeguard as standing information about the wallet,
   and must not read as a call to action competing with Close position / Collect. */

/* A <details>, not a standing card: export-key and revoke-signer are irreversible and low-frequency, and
   this page is opened routinely to check a position. Collapsed, the closed row still states ownership (which
   R1 needs) without putting a one-click revoke in the reading path to Close position. */
.mf-selfcustody {
  border: var(--mf-rule-width) solid var(--mf-border-subtle);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-surface-panel, #fffefa);
  font-family: var(--mf-font-sans);
}

.mf-selfcustody > summary {
  display: flex;
  align-items: center;
  gap: var(--mf-space-2);
  padding: var(--mf-space-3);
  cursor: pointer;
  list-style: none;
}

.mf-selfcustody > summary::-webkit-details-marker { display: none; }

.mf-selfcustody > summary::after {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  margin-left: auto;
  border-right: 1.5px solid var(--mf-text-disabled);
  border-bottom: 1.5px solid var(--mf-text-disabled);
  transform: rotate(45deg) translate(-2px, -2px);
  transition:transform var(--mf-duration-fast, 120ms) var(--mf-ease);
}

.mf-selfcustody[open] > summary::after { transform: rotate(225deg) translate(-2px, -2px); }

.mf-selfcustody > summary:focus-visible { outline: 2px solid var(--mf-cyan-ink, #08758a); outline-offset: -2px; }

/* min-width:0 on BOTH the flex child and the truncating line — a flex item defaults to min-width:auto and
   will not shrink below its content, so the address would push the row wide instead of ellipsing. */
.mf-selfcustody-summary-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.mf-selfcustody-summary-copy strong {
  color: var(--mf-text-strong);
  font-size: var(--mf-font-size-body-sm);
  font-weight: var(--mf-font-weight-semibold);
}

.mf-selfcustody-summary-copy small {
  min-width: 0;
  overflow: hidden;
  color: var(--mf-text-secondary);
  font-size: var(--mf-font-size-meta);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mf-selfcustody-body {
  display: grid;
  gap: var(--mf-space-3);
  padding: var(--mf-space-3);
  border-top: var(--mf-rule-width) solid var(--mf-border-subtle);
}

/* The rail is `display: contents` below 1121px, so the card lands in the detail grid itself — pin it to
   the left column or it auto-places into the content column beside the position body. */
.mf-portfolio-detail .mf-selfcustody {
  grid-column: 1;
}

.mf-selfcustody-head {
  display: flex;
  align-items: center;
  gap: var(--mf-space-2);
  min-width: 0;
}

.mf-selfcustody-head h4 {
  margin: 0;
  color: var(--mf-text-strong);
  font-size: var(--mf-font-size-body);
  font-weight: var(--mf-font-weight-semibold);
}

.mf-selfcustody-icon {
  display: inline-flex;
  flex: none;
  color: var(--mf-text-secondary);
}

.mf-selfcustody-wallet {
  display: grid;
  gap: var(--mf-space-1);
  min-width: 0;
}

.mf-selfcustody-wallet small {
  color: var(--mf-text-secondary);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-font-weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mf-selfcustody-addr {
  color: var(--mf-text-primary);
  font-family: var(--mf-font-mono);
  font-size: var(--mf-font-size-body-sm);
  overflow-wrap: anywhere;
}

.mf-selfcustody-badge {
  justify-self: start;
  padding: 2px var(--mf-space-2);
  border: var(--mf-rule-width) solid currentcolor;
  border-radius: var(--mf-radius-sm);
  font-family: var(--mf-font-mono);
  font-size: var(--mf-font-size-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mf-selfcustody-badge.is-exported {
  color: var(--mf-status-positive-text);
}

.mf-selfcustody-badge.is-revoked {
  color: var(--mf-status-warning-text);
}

.mf-selfcustody-badge.is-pending {
  background: var(--mf-warn-soft, rgba(150, 99, 28, 0.11));
  color: var(--mf-warn, #825215);
}

.mf-selfcustody-badge.is-legacy {
  color: var(--mf-text-disabled);
}

.mf-selfcustody-state {
  margin: 0;
  color: var(--mf-text-secondary);
  font-size: var(--mf-font-size-body-sm);
  line-height: var(--mf-line-height-body);
}

.mf-selfcustody-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--mf-space-2);
}

.mf-selfcustody-dialog {
  display: grid;
  gap: var(--mf-space-4);
  color: var(--mf-text-primary);
  font-family: var(--mf-font-sans);
}

.mf-selfcustody-dialog > p {
  max-width: var(--mf-layout-reading-max);
  margin: 0;
  color: var(--mf-text-secondary);
  font-size: var(--mf-font-size-body);
  line-height: var(--mf-line-height-body);
}

.mf-selfcustody-dialog > p strong {
  color: var(--mf-text-strong);
  font-weight: var(--mf-font-weight-semibold);
}

.mf-selfcustody-effects {
  display: grid;
  border-top: var(--mf-rule-width) solid var(--mf-border-subtle);
  border-bottom: var(--mf-rule-width) solid var(--mf-border-subtle);
}

.mf-selfcustody-effects > span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--mf-space-4);
  min-width: 0;
  padding: var(--mf-space-3) 0;
}

.mf-selfcustody-effects > span + span {
  border-top: var(--mf-rule-width) solid var(--mf-border-subtle);
}

.mf-selfcustody-effects small {
  flex: none;
  color: var(--mf-text-secondary);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-font-weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mf-selfcustody-effects strong {
  color: var(--mf-text-strong);
  font-size: var(--mf-font-size-body-sm);
  font-weight: var(--mf-font-weight-semibold);
  text-align: right;
}

/* The exported key itself. Monospace and wrapped rather than truncated: a private key the user cannot see
   in full is one they cannot check against the wallet they meant to export. */
.mf-selfcustody-key {
  display: block;
  padding: var(--mf-space-3);
  border: var(--mf-rule-width) solid var(--mf-border-default);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-surface-subtle);
  color: var(--mf-text-strong);
  font-family: var(--mf-font-mono);
  font-size: var(--mf-font-size-body-sm);
  line-height: var(--mf-line-height-body);
  overflow-wrap: anywhere;
  user-select: all;
}

.mf-selfcustody-lock {
  display: grid;
  gap: var(--mf-space-1);
  padding: var(--mf-space-3);
  border: var(--mf-rule-width) solid var(--mf-border-default);
  border-left: var(--mf-signal-rail-width) solid var(--mf-status-warning);
  border-radius: var(--mf-radius-sm);
  background: var(--mf-surface-subtle);
}

.mf-selfcustody-lock > strong {
  color: var(--mf-status-warning-text);
  font-size: var(--mf-font-size-body);
  font-weight: var(--mf-font-weight-semibold);
}

.mf-selfcustody-lock > span {
  color: var(--mf-text-secondary);
  font-size: var(--mf-font-size-body-sm);
  line-height: var(--mf-line-height-body);
}

.mf-selfcustody-entry {
  display: grid;
  gap: var(--mf-space-3);
  padding: var(--mf-space-4) 0;
}

.mf-selfcustody-entry + .mf-selfcustody-entry {
  border-top: var(--mf-rule-width) solid var(--mf-border-subtle);
}

/* ── Operator sign-in gate (ADMIN_DEPLOY_PLAN Phase 0) ──────────────────────────────────────────────
   Only ever rendered on a hosted, writable instance where the server requires an operator token. A
   loopback dev server never engages it, so index.html carries no gate markup — admin-auth.js builds it. */
.home-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.home-hero-top > h1 {
  margin: 0;
}

/* The shell is a trigger button, not a flex-growing panel — without a width bound it stretches to fill the
   header row. Mirrors the max-width discipline .measurement-list-actions already applies on the dashboard. */
.home-hero-top .auth-shell {
  flex: 0 0 auto;
  max-width: min(220px, 60vw);
}

.home-hero-top .auth-shell-view,
.home-hero-top .auth-trigger {
  max-width: 100%;
}

.admin-gate {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  /* Opaque, not translucent: behind this sits a workspace whose every panel 401'd, and a half-visible wall
     of error states reads as a broken app rather than a locked one. */
  background: var(--bg);
}

.admin-gate-card {
  max-width: 30rem;
  padding: 1.75rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-hi);
  box-shadow: var(--deck-shadow);
  text-align: left;
}

.admin-gate-title {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
  color: var(--text);
}

.admin-gate-body {
  margin: 0 0 1.15rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-dim);
}

.admin-gate-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.admin-gate-signin {
  height: 32px;
  padding: 0 0.95rem;
  border: 1px solid var(--text);
  border-radius: 6px;
  background: var(--text);
  color: var(--panel-hi);
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.admin-gate-signin:hover {
  opacity: 0.88;
}

@media (max-width: 640px) {
  .home-hero-top {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ══════════════════════════════════════════════════════════════════════════════════════════════════════════
   OPERATOR CONSOLE (index.html: Measure a theme · History · Review · Measurement Admin)
   ──────────────────────────────────────────────────────────────────────────────────────────────────────────
   DESIGN.md §1.1 classifies these as "Internal operations": they MAY stay denser and more mono-heavy than the
   public product, but they SHARE its semantic tokens and accessibility bar. index.html now loads
   design-system.css, so this block does the sharing — it re-points the console's legacy skin variables at the
   canonical --mf-* tokens (one place, instead of editing hundreds of literal colors) and moves UI chrome —
   headings, labels, controls, editorial copy fields — onto the product face. Data (ids, values, traces,
   tables of numbers) stays mono, which is the density the console is allowed to keep.
   Everything here is scoped to body.home-page, which only index.html carries — the public dashboard and
   landing surfaces are untouched.
   ══════════════════════════════════════════════════════════════════════════════════════════════════════════ */
body.home-page {
  --bg: var(--mf-surface-canvas, #fffefa);
  --bg-soft: var(--mf-surface-subtle, #f6f7f4);
  --panel: var(--mf-surface-raised, #ffffff);
  --panel-hi: var(--mf-surface-raised, #ffffff);
  --border: var(--mf-border-default, rgba(17, 19, 22, 0.18));
  --border-soft: var(--mf-border-subtle, rgba(17, 19, 22, 0.105));
  --text: var(--mf-text-strong, #111316);
  --text-dim: var(--mf-text-secondary, #65707a);
  /* The console's third text level was #858e9a — ~2.9:1 on paper, below AA, and it carried real meta (table
     headers, ids, ages). There is no AA-passing shade between secondary and disabled, so the two quiet levels
     collapse onto ONE accessible color and separate by size/weight instead; --mf-text-disabled stays reserved
     for genuinely disabled controls, exactly as the product uses it. */
  --text-faint: var(--mf-text-secondary, #65707a);
  /* accent is the product's cyan INK (the readable one), not the old console blue — the light cyan itself is a
     signal-rail/fill color and must never carry small text (design-system.css header rule). */
  --accent: var(--mf-signal-accent-ink, #08758a);
  --accent-2: var(--mf-text-secondary, #65707a);
  --accent-3: var(--mf-status-positive-text, #0f7357);
  --accent-soft: var(--mf-color-accent-soft, rgba(116, 222, 235, 0.18));
  --pos: var(--mf-status-positive-text, #0f7357);
  --neg: var(--mf-status-negative-text, #a73e50);
  --dir-low: var(--mf-status-warning-text, #825215);
  --dir-high: var(--mf-signal-accent-ink, #08758a);
  --mixed: var(--mf-text-secondary, #65707a);
  --surface-muted: var(--mf-surface-subtle, #f6f7f4);
  --surface-hover: var(--mf-color-accent-quiet, rgba(116, 222, 235, 0.09));
  --deck-shadow: var(--mf-shadow-card-quiet, 0 14px 30px rgba(17, 19, 22, 0.04));
  --deck-shadow-strong: var(--mf-shadow-card, 0 18px 36px rgba(17, 19, 22, 0.05));
  --mono: var(--mf-font-mono, "SF Mono", ui-monospace, Menlo, Consolas, monospace);
  --sans: var(--mf-font-sans, Inter, "Helvetica Neue", "Segoe UI", Arial, sans-serif);
  --r: var(--mf-radius-md, 8px);
  font-family: var(--sans);
}

/* Chrome on the product face. */
body.home-page button,
body.home-page input,
body.home-page select,
body.home-page textarea,
body.home-page header h1,
body.home-page .home-hero h1,
body.home-page .sub,
body.home-page .pane-head h2,
body.home-page .pane-sub,
body.home-page .status,
body.home-page .admin-state,
body.home-page .admin-count,
body.home-page .admin-filter,
body.home-page .compact-link,
body.home-page .admin-table,
body.home-page .admin-name,
body.home-page .review-back,
body.home-page .review-item,
body.home-page .review-label,
body.home-page .review-input,
body.home-page .rv-field-label,
body.home-page .review-image-head,
body.home-page .preview-banner { font-family: var(--sans); }
/* Data keeps the mono face: ids, values, traces, and anything explicitly marked .mono. */
body.home-page .mono,
body.home-page .id-cell,
body.home-page .admin-name-id,
body.home-page .rv-provenance,
body.home-page .rv-cred-strip,
body.home-page .review-side,
body.home-page .review-counter,
body.home-page pre,
body.home-page code { font-family: var(--mono); }
body.home-page .pane-head h2 { font-size: 20px; letter-spacing: var(--mf-letter-spacing-title, -0.01em); }
body.home-page .pane-sub,
body.home-page .status { font-size: 13px; }
body.home-page button:focus-visible,
body.home-page a:focus-visible,
body.home-page input:focus-visible,
body.home-page select:focus-visible { outline: 2px solid var(--mf-focus-color, #08758a); outline-offset: 2px; }

/* The two table-shaped tabs are wide by nature; give them the product's app width instead of the narrower
   reading width the "Measure a theme" tab wants. */
body.admin-workspace-view .home-main,
body.review-workspace-view .home-main,
body.history-workspace-view .home-main { width: min(var(--mf-layout-app-max, 1480px), calc(100% - 32px)); }

/* Controls at the product's default control height (36px) instead of the console's outsized 42px. */
body.home-page .compact-button,
body.home-page .danger-button,
body.home-page .compact-link,
body.home-page .admin-filter {
  height: var(--mf-control-height-default, 36px);
  min-height: var(--mf-control-height-default, 36px);
  border-radius: var(--r);
}
/* Hierarchy: on a table of rows, "Refresh" and "Recompose" are SECONDARY controls, so they read as quiet
   outlined chips rather than inheriting the global solid-graphite primary. The page's one primary action
   (Measure) and the publish gate keep their weight. */
body.home-page .compact-button {
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  box-shadow: none;
  font-weight: 650;
}
body.home-page .danger-button {
  border: 1px solid rgba(167, 62, 80, 0.4);
  background: var(--panel);
  color: var(--neg);
  box-shadow: none;
}
body.home-page .compact-button:hover,
body.home-page .danger-button:hover { transform: none; box-shadow: none; }
body.home-page .compact-button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
body.home-page .danger-button:hover:not(:disabled) { background: rgba(167, 62, 80, 0.09); border-color: var(--neg); }
body.home-page .review-publish { border-color: rgba(15, 115, 87, 0.55); background: rgba(15, 115, 87, 0.12); color: var(--pos); }
body.home-page .review-publish:hover:not(:disabled) { background: rgba(15, 115, 87, 0.2); }
body.home-page .admin-toolbar { flex-wrap: wrap; }
body.home-page .admin-tools { flex-wrap: wrap; }
body.home-page .admin-filter { width: min(340px, 38vw); min-width: 200px; font-size: 13px; }

/* Segmented control — the same object the public Requests board uses (.rb-seg), at console scale. */
.admin-seg {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border-soft);
  border-radius: var(--r);
  background: var(--panel);
}
.admin-seg-button {
  min-width: 0;
  width: auto;
  height: var(--mf-control-height-compact, 30px);
  min-height: var(--mf-control-height-compact, 30px);
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: calc(var(--r) - 2px);
  background: transparent;
  color: var(--text-dim);
  box-shadow: none;
  font-size: 12px;
  font-weight: 650;
}
.admin-seg-button:hover { transform: none; box-shadow: none; color: var(--text); }
.admin-seg-button.active {
  border-color: rgba(116, 222, 235, 0.48);
  background: rgba(235, 252, 255, 0.78);
  color: var(--text);
}
.admin-freshness { font-variant-numeric: tabular-nums; }

/* ── Measurement Admin table ─────────────────────────────────────────────────────────────────────────────
   Five columns of real information instead of six with a duplicate: the def ids ride under the name (they were
   the widest column and the least read), History is gone (the per-share cell already prints each side's build
   state), and the freed width pays for State + Created. */
body.home-page .admin-table { font-size: 12.5px; }
body.home-page .admin-table th {
  padding: 8px 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
body.home-page .admin-table td { padding: 3px 10px; }
/* The table is sized by its CONTENT, not by the window: the wrapper hugs it (max-content) so a wide monitor
   gets whitespace on the right instead of a 1400px row the eye has to travel. Below its natural width the
   wrapper still scrolls horizontally rather than crushing the columns. */
.admin-nav-section .admin-table-wrap { width: max-content; max-width: 100%; }
.admin-nav-table { min-width: 820px; }
.admin-nav-table th:nth-child(2) { width: 152px; }
.admin-nav-table th:nth-child(3) { width: 240px; }
.admin-nav-table th:nth-child(4) { width: 66px; }
.admin-nav-table th:nth-child(5) { width: 92px; }
.admin-nav-table th:nth-child(6) { width: 168px; }
.admin-nav-table td.admin-actions { white-space: nowrap; }
body.home-page .admin-name { min-width: 260px; max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
body.home-page .admin-name a { font-size: 13px; }
/* The id sits INLINE after the name (the mirror pair + thesis are the cell's tooltip), so the row stays one
   line tall and the column stays narrow enough to leave the table at a readable measure. */
.admin-name-id { margin-left: 8px; color: var(--text-faint); font-size: 10.5px; font-weight: 400; }
/* A flex/grid box may NOT be the <td> itself — that drops the element out of the table's column model and
   shifts every following cell out from under its header (which is what the paired per-share cell used to do).
   Both stacks live in a DIV inside a plain table-cell. */
.admin-state-cell { display: flex; flex-wrap: wrap; gap: 4px; }
.admin-state-cell:empty::before { content: "-"; color: var(--text-faint); }
.admin-created { white-space: nowrap; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.num-col { text-align: right; }
th.num-col { text-align: right; }
body.home-page .pub-badge { padding: 1px 6px; font-size: 11px; line-height: 1.35; }

/* Touch has no hover, so the queue's remove control cannot hide behind one. */
@media (hover: none) {
  .review-item-remove { opacity: 1; }
}

/* The theme box was an UNSTYLED default textarea (~20 columns, browser chrome) sitting in a flex row — the
   console's primary control, sized by the browser. It takes the same field treatment the retired #url input
   had, so "Measure a theme" finally looks like the page's main input. */
body.home-page #nav-theme {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 54px;
  padding: 10px 15px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #ffffff;
  color: var(--text);
  font-size: var(--type-body-size);
  line-height: 1.5;
  resize: vertical;
}
body.home-page #nav-theme::placeholder { color: var(--text-faint); }
body.home-page #nav-theme:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Measurement Admin fits ONE screen: the vertical budget above the table used to be 212px — a title block and
   a toolbar stacked as two separate bands — which cost four rows of the thing the operator actually came for.
   Title and controls share one band, the purpose line tucks under the title, and the shell stops at a
   readable measure instead of tracking a 1480px window. */
body.admin-workspace-view .home-main {
  width: min(1160px, calc(100% - 32px));
  padding-top: 14px;
  /* 72px of trailing air below a table is what pushed the last rows past the fold. */
  padding-bottom: 16px;
}
body.admin-workspace-view .workspace-tabs { margin-bottom: 8px; }
body.admin-workspace-view .admin-shell {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  align-items: start;
  column-gap: 20px;
  row-gap: 0;
}
body.admin-workspace-view .admin-shell > .pane-head { grid-column: 1; margin: 0 0 8px; }
body.admin-workspace-view .admin-shell > .admin-toolbar { grid-column: 2; justify-content: flex-end; margin: 0 0 8px; }
body.admin-workspace-view .admin-shell > .admin-toolbar .admin-tools { justify-content: flex-end; }
/* Every other child spans the full width. Without naming them, an auto-placed child (the batch panel) lands in
   column 1 and its max-content width drags the title column out, squeezing the toolbar into three rows. */
body.admin-workspace-view .admin-shell > #admin-status,
body.admin-workspace-view .admin-shell > .admin-nav-section { grid-column: 1 / -1; }
body.admin-workspace-view .admin-nav-section { margin-top: 0; }
body.admin-workspace-view .pane-head h2 { font-size: 18px; }
body.admin-workspace-view .pane-sub { font-size: 12px; }
/* Controls and state chips share the one band — stacking them made the right column taller than the title
   block beside it, which put the cost straight back into the vertical budget. */
body.admin-workspace-view .admin-toolbar { flex-wrap: wrap; justify-content: flex-end; gap: 8px 10px; }
/* Sized so the whole band stays ONE row beside the title: at 340px the filter alone pushed the state chips
   onto a second line, which cost 40px of vertical budget — more than a row of the table. */
body.admin-workspace-view .admin-filter { width: 200px; min-width: 160px; }
body.admin-workspace-view .admin-state,
body.admin-workspace-view .admin-count { height: 28px; font-size: 10.5px; }

/* In-row actions are TEXT, not chips: a 36px control in every row set the row height for the whole table (it
   was the tallest thing in it). They keep their colors, their disabled states, and their confirm dialogs. */
body.home-page .admin-actions .compact-button,
body.home-page .admin-actions .danger-button {
  height: auto;
  min-height: 0;
  padding: 2px 6px;
  border: 1px solid transparent;
  border-radius: var(--mf-radius-xs, 4px);
  background: transparent;
  font-size: 11.5px;
  font-weight: 650;
}
body.home-page .admin-actions .compact-button { color: var(--accent); }
body.home-page .admin-actions .danger-button { color: var(--neg); }
body.home-page .admin-actions .compact-button:hover:not(:disabled) { border-color: var(--accent); background: var(--accent-soft); }
body.home-page .admin-actions .danger-button:hover:not(:disabled) { border-color: var(--neg); background: rgba(167, 62, 80, 0.09); }

@media (max-width: 1080px) {
  /* Not enough width for title and controls to share a band — go back to stacking them. */
  body.admin-workspace-view .admin-shell { display: block; }
  body.admin-workspace-view .admin-shell > .admin-toolbar { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* ── Measure a theme: one Measurement or thirty ───────────────────────────────────────────────────────────
   This is the console's primary surface, not a collapsible panel: the input, the pre-flight verdict and the
   live run all share one column, because a single theme is a batch of one and must not read as a special case. */
.run-region { display: flex; flex-direction: column; gap: 8px; }
.batch-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 2px 2px 6px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.batch-head[hidden] { display: none; }
.batch-head a { color: var(--accent); }
/* the only moving thing on a 15-minute item — a real number, not a spinner */
.batch-live { color: var(--accent); }
.batch-live::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: batch-pulse 1.6s ease-in-out infinite;
}
@keyframes batch-pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) {
  .batch-live::before { animation: none; }
}
.batch-input {
  width: 100%;
  min-height: 104px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: #ffffff;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.5;
  resize: vertical;
}
.batch-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.batch-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.batch-summary { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.batch-summary.bad { color: var(--neg); }
.batch-summary.warn { color: var(--dir-low); }
/* The cost line. It is loud because one click here is hours of writer time and real spend. */
.batch-warning {
  margin: 0;
  padding: 8px 11px;
  border: 1px solid rgba(150, 99, 28, 0.3);
  border-left: 3px solid var(--dir-low);
  border-radius: var(--r);
  background: rgba(150, 99, 28, 0.07);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}
body.home-page .batch-run { border-color: rgba(15, 115, 87, 0.55); background: rgba(15, 115, 87, 0.12); color: var(--pos); }
body.home-page .batch-run:hover:not(:disabled) { background: rgba(15, 115, 87, 0.2); }
.batch-verdict { display: flex; flex-direction: column; max-height: min(52vh, 560px); overflow-y: auto; }
.batch-verdict:empty { display: none; }
.batch-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(0, 340px);
  gap: 10px;
  align-items: baseline;
  padding: 6px 2px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 12px;
}
.batch-row:last-child { border-bottom: 0; }
.batch-n { color: var(--text-faint); font-family: var(--mono); font-size: 10.5px; }
.batch-theme { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.batch-flag { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); font-family: var(--mono); font-size: 11px; }
.batch-row.ok .batch-flag { color: var(--pos); }
.batch-row.bad .batch-flag { color: var(--neg); }
.batch-row.warn .batch-flag { color: var(--dir-low); }
.batch-row.live { background: var(--surface-hover); }
.batch-row.live .batch-flag { color: var(--accent); }
.batch-flag a { color: inherit; }
.batch-time { margin-left: 6px; color: var(--text-faint); font-variant-numeric: tabular-nums; }
.batch-row.live .batch-time { color: var(--accent); }
/* the CURRENT stage, not a trace: one word, and it is the triage key when an item fails */
.batch-stage {
  display: inline-flex;
  align-items: center;
  padding: 0 6px;
  border-radius: var(--mf-radius-xs, 4px);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
/* one NON-accumulating line under the running row — the detail the pipeline last narrated */
.batch-sub {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--text-faint);
  font-size: 10.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#examples a.disabled { pointer-events: none; opacity: 0.45; }
/* A batch running in another process (the CLI): presence only — its per-item progress is not readable here. */
.batch-foreign {
  margin: 0;
  padding: 8px 11px;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
  background: var(--surface-hover);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}
/* Typed gate, revoke only. Export hands off to Privy's own modal on privy.io, so it already has a
   third-party confirmation behind the last click; Privy's removeSigners is headless, so revoke had none.
   The last 4 address characters also prove which wallet is being revoked when several exist. */
.mf-selfcustody-gate {
  display: grid;
  gap: var(--mf-space-1-5);
  font-size: var(--mf-font-size-body-sm);
}

.mf-selfcustody-gate > span { color: var(--mf-text-secondary); }
.mf-selfcustody-gate > span b { color: var(--mf-text-strong); font-family: var(--mf-mono); font-weight: var(--mf-font-weight-semibold); }

.mf-selfcustody-gate input {
  width: 9ch;
  padding: 7px 10px;
  border: var(--mf-rule-width) solid var(--mf-border-default);
  border-radius: var(--mf-radius-xs);
  background: var(--mf-paper, #fff);
  color: var(--mf-text-strong);
  font-family: var(--mf-mono);
  font-size: var(--mf-font-size-body);
  letter-spacing: 0.12em;
}

.mf-selfcustody-gate input:focus-visible { outline: 2px solid var(--mf-cyan-ink, #08758a); outline-offset: 1px; }
.mf-selfcustody-gate input.is-matched { border-color: var(--mf-pos, #168765); }
.mf-selfcustody-gate input:disabled { background: var(--mf-surface-subtle, #f6f7f4); color: var(--mf-text-disabled); }

/* Degraded-feed warning. The healthy-state source badge is gone; this renders only when the order feed is
   unavailable, because the list otherwise says "No open orders" — a false claim about the user's money. */
.mf-wallet-source {
  color: var(--mf-warn, #825215);
  font-size: var(--mf-font-size-body-sm);
  font-weight: var(--mf-font-weight-medium);
}

.mf-fundstage-label {
  margin: 0;
  min-width: 0;
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-font-weight-medium);
  line-height: 1.2;
}

.mf-fundstage-state {
  margin: 0;
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-meta);
  font-weight: var(--mf-font-weight-semibold);
  color: var(--mf-muted);
}

/* Hero composition: identity and live state share the top line, the figure sits below it on the left.
   Deliberately not a stat-tile row — one figure at one size, everything else subordinate. */
.mf-hero-top {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
}

/* Row, not a stack: the two actions sit beside the figure they act on, not under it. The whole group still
   hugs the hero's right edge (justify-content:flex-end) the way the figure alone used to.
   align-items:flex-end, not center: a state with a pill and explanatory copy (paused, needs review, an
   in-progress rebalance) makes the headline column much taller than the plain tracking case. Centering the
   action band against that height stranded it in a band of empty space above the copy that motivates it —
   flex-end lands it flush with the copy's own last line, so the actions read as following the explanation
   rather than floating beside it. The plain case (no pill, one line of copy) still looks fine at flex-end;
   it only lands a few pixels lower than centered would have. */
.mf-hero-state {
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px 20px;
}

@media (max-width: 700px) {
  /* Side-by-side doesn't fit a phone width alongside two full-size buttons — back to a stack, headline
     above actions, both left-aligned like the rest of the page. */
  .mf-hero-state { flex-direction: column; align-items: flex-start; justify-content: flex-start; }
  .mf-hero-state .mf-position-headline { justify-items: start; text-align: left; }
  .mf-hero-state .mf-hero-figure-line { justify-content: flex-start; }
}

/* F3's one-way Direction gate. It used to sit inside the status pill, where `margin-left: auto` pushed it to
   the pill's right edge; in the hero it is its own control under the pill and must not inherit that push. */
.mf-portfolio-detail .mf-ai-management-control {
  margin-left: 0;
  color: var(--mf-muted);
  border-color: var(--mf-line-strong);
  background: transparent;
}

.mf-portfolio-detail .mf-ai-management-control:hover:not(:disabled) {
  border-color: var(--mf-neg);
  color: var(--mf-neg);
  background: transparent;
}

.mf-portfolio-detail .mf-detail-status-copy {
  display: flex;
  align-items: baseline;
  gap: 0;
}

.mf-portfolio-detail .mf-detail-status-copy small {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.mf-portfolio-detail .mf-detail-status-copy strong { font-size: var(--mf-font-size-body-sm); line-height: 1.15; }

/* Provenance reads as one quiet line, not a bordered card with its own label above a boxed address. It now
   sits with the rest of the position's identity (title, direction) rather than off with the corner actions. */
.mf-portfolio-detail .mf-hero-subject .mf-detail-wallet {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--mf-font-size-label);
}

.mf-portfolio-detail .mf-hero-subject .mf-detail-wallet > svg { width: 14px; height: 14px; margin: 0; }

.mf-portfolio-detail .mf-hero-subject .mf-detail-wallet a {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--mf-font-size-label);
}

.mf-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  /* Visually hidden, but an h2 still inherits the browser's 1.5em default — the audit counts it. */
  font-size: var(--mf-font-size-body);
}

.mf-portfolio-detail .mf-hero-subject .mf-detail-wallet { gap: 6px; min-height: 0; margin-top: 1px; }

/* <small> otherwise inherits the browser's 0.83em default off the page base, landing on 11.25px — the last
   value on this page outside DESIGN.md §4.3's ladder. */
.mf-portfolio-detail .mf-identity-copy small {
  color: var(--mf-muted);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-font-weight-medium);
  line-height: 1.3;
}

.mf-position-headline .mf-hero-figure-line { margin-top: 1px; }

/* The wallet address and its self-custody entry point read as one quiet provenance line, not two separate
   affordances at opposite corners of the hero. flex-end (not center): every item here — the wallet icon,
   the address link, the settings button — should sit flush on the same bottom edge as the avatar below it,
   not float at three slightly different heights because their own intrinsic sizes differ. */
.mf-hero-wallet-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  min-width: 0;
}

/* .mf-portfolio button:not(.mf-btn) resets plain buttons to width/height:auto at (0,2,1) specificity — beat
   it with a third scoping class rather than fight it with !important. Matched to the wallet chip's own
   16px content height, not larger: with flex-end, a button taller than its row-mates opens a gap above
   itself — the row grows to fit it, and everything shorter hangs off the shared bottom edge with dead
   space overhead. At 16px there's no leftover, so the title→direction→wallet rhythm reads as one consistent
   4px step instead of the wallet line sitting noticeably further from "Theme Higher" than the other rows are
   from each other. */
.mf-portfolio-detail .mf-hero-wallet-row .mf-hero-settings-btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  border-radius: var(--mf-radius-round);
  background: none;
  color: var(--mf-faint);
  cursor: pointer;
  transition: background var(--mf-duration-standard, 180ms) var(--mf-ease), color var(--mf-duration-standard, 180ms) var(--mf-ease);
}
/* Mathematically centered in its own 16px hit box, this glyph still sits 2px above the wallet address
   text and its external-link icon right beside it (measured via getBoundingClientRect: icon centers at
   163.8, text/link-icon center at 165.8) — two independently flex-centered contexts (this button's own
   box vs. the wallet link's inline-flex) that never shared one reference line. Nudge the glyph, not the
   box: the box itself still drives this row's shared bottom edge with the avatar (see .mf-hero-wallet-row
   above) — only what's visibly drawn inside it moves. */
.mf-hero-settings-btn svg { width: 12px; height: 12px; transform: translateY(2px); }
.mf-hero-settings-btn:hover { color: var(--mf-ink); background: rgba(17, 19, 22, 0.06); }
.mf-hero-settings-btn:focus-visible { outline: 2px solid var(--mf-cyan-ink, #08758a); outline-offset: 2px; }

/* Modal body: a labelled wallet row, one state sentence, then the two actions ranked by consequence. */
.mf-selfcustody-dialog[data-selfcustody-position] .mf-selfcustody-entry {
  display: grid;
  gap: var(--mf-space-3, 12px);
  padding: var(--mf-space-4, 16px);
  border: 1px solid var(--mf-border-subtle);
  border-radius: var(--mf-radius-md);
  background: var(--mf-surface-subtle, #f6f7f4);
}

/* Every action in one band. They used to sit at three different heights in three different cells; a single
   row makes the set scannable and gives the destructive one a fixed, predictable home. */
.mf-action-band {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--mf-space-2, 8px);
  padding-top: var(--mf-space-4, 16px);
  border-top: 1px solid var(--mf-pf-line);
}

.mf-action-band .mf-btn { white-space: nowrap; }

.mf-position-headline .mf-fundstage-label { margin-bottom: 2px; }

/* ── Identity band ─────────────────────────────────────────────────────────────────────────────── */

/* The avatar is its own column, row-spanning the whole subject so its height always matches however tall
   the text stack (title+status, direction, wallet) turns out to be — no fixed avatar size to keep in sync
   with content that can grow a line (e.g. the wallet chip appearing once loaded). */
.mf-portfolio-detail { --mf-hero-avatar: 80px; --mf-hero-avatar-gap: 16px; }

.mf-hero-subject {
  min-width: 0;
  display: grid;
  grid-template-columns: var(--mf-hero-avatar) minmax(0, auto) auto;
  grid-template-rows: auto auto auto;
  align-items: stretch;
  column-gap: var(--mf-hero-avatar-gap);
  row-gap: 4px;
}

.mf-hero-subject > .mf-theme-identity { grid-column: 1; grid-row: 1 / -1; }
.mf-hero-subject > .mf-hero-title-link { grid-column: 2; grid-row: 1; align-self: center; min-width: 0; }
.mf-hero-subject > .mf-detail-status { grid-column: 3; grid-row: 1; align-self: center; }
.mf-hero-subject > .mf-hero-direction { grid-column: 2 / -1; grid-row: 2; }
.mf-hero-subject > .mf-hero-wallet-row { grid-column: 2 / -1; grid-row: 3; }

@media (max-width: 620px) {
  .mf-hero-subject { grid-template-columns: var(--mf-hero-avatar) minmax(0, 1fr); grid-template-rows: auto auto auto auto; }
  .mf-hero-subject > .mf-detail-status { grid-column: 2; grid-row: 2; justify-self: start; }
  .mf-hero-subject > .mf-hero-direction { grid-column: 2 / -1; grid-row: 3; }
  .mf-hero-subject > .mf-hero-wallet-row { grid-column: 2 / -1; grid-row: 4; }
}

/* The owned side of the pair. DESIGN.md §6.5 assigns the cyan rail to a selected View, and owning a position
   IS the selection; the same §6.5 forbids tinting a View name with performance colour, so the emphasis comes
   from the rail plus weight, never from green or red. */
.mf-hero-direction {
  margin: 0;
  padding-left: 10px;
  border-left: var(--mf-signal-rail-width, 3px) solid var(--mf-cyan);
  color: var(--mf-graphite);
  font-family: var(--mf-sans);
  font-size: var(--mf-font-size-body-lg);
  font-weight: var(--mf-font-weight-semibold);
  line-height: 1.25;
}

.mf-portfolio-detail .mf-hero-state .mf-action-band { padding-top: 0; border-top: 0; justify-content: flex-end; }

/* ── Measures band ─────────────────────────────────────────────────────────────────────────────── */

/* flex-end, not baseline: each figure is itself an inline-flex icon+number group, and a flex container with
   no baseline-bearing first child (the SVG icon has none) synthesizes one from its own bottom edge — through
   two nested levels that lands nowhere near the actual digits. Bottom-edge alignment is unambiguous. */
.mf-hero-figure-line { min-height: calc(var(--mf-font-size-title-lg) * 1.05); align-items: flex-end; }

/* <b> resolves the browser's `bolder` against the parent, landing on 900 — outside DESIGN.md §4.3's
   400/500/600/700 ladder. */
.mf-hero-direction b { font-weight: var(--mf-font-weight-semibold); }

/* ── Status: dot + label, not a pill ──────────────────────────────────────────────────────────────
   A bordered, tinted pill next to the title read as loud as the title itself for a fact users check once
   and then ignore. Tone still carries meaning through colour on the dot and label — DESIGN.md's ban is on
   colour as the ONLY signal, not on colour reinforcing text that is already there. */
.mf-portfolio-detail .mf-detail-status {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.mf-portfolio-detail .mf-detail-status-dot {
  width: 6px;
  height: 6px;
  border: 0;
  box-shadow: none;
}

.mf-portfolio-detail .mf-detail-status-copy strong {
  font-size: var(--mf-font-size-label);
  font-weight: var(--mf-font-weight-medium);
}

.mf-portfolio-detail .mf-detail-status-holding { color: var(--mf-pos); }
.mf-portfolio-detail .mf-detail-status-building,
.mf-portfolio-detail .mf-detail-status-rebalancing { color: var(--mf-warn); }
.mf-portfolio-detail .mf-detail-status-attention { color: var(--mf-neg); }
.mf-portfolio-detail .mf-detail-status-closed,
.mf-portfolio-detail .mf-detail-status-neutral { color: var(--mf-muted); }
.mf-portfolio-detail .mf-detail-status-settlement { color: var(--mf-accent-ink, #0e6a61); }

/* ── Touch: no sticky hover lift ──────────────────────────────────────────────────────────────────
   A touch device has no pointer to leave, so it synthesizes :hover on tap and the state STICKS until
   the user taps somewhere else. Every hover lift in this file therefore reads as a tapped card that
   stays raised — most visibly on the Trends list, where browsing IS tapping card after card.

   Selectors are repeated verbatim from their original rules so specificity matches and this block,
   being last, wins on source order. Only the transform is dropped: the border/background hover
   states carry no false affordance on touch and are left alone, so nothing loses its tap feedback. */
@media (hover: none) {
  button:hover,
  .idx-card:hover,
  body.dashboard-view .index-sort-button:hover,
  body.dashboard-view .range-custom-apply:hover,
  .measurement-card:hover,
  .nav-chart-panel .range-custom-apply:hover,
  .nav-clear-filters:hover,
  .nav-trade-btn:hover,
  .mf-btn:hover,
  #mf-modal-host button.mf-pay-rail:hover,
  .mf-poscard:hover,
  .rb-cta:hover,
  .app-back:hover,
  #mf-modal-host .app-back:hover,
  .mf-portfolio .app-back:hover {
    transform: none;
  }
  .mf-detail-back:hover svg,
  .nav-audit-provlink:hover .nav-audit-provarrow {
    transform: none;
  }
}

/* ── Forced Colors Mode ────────────────────────────────────────────────────────────────────────────
   This program deliberately moves structure off strokes and onto ground. Forced Colors Mode discards
   author background-colors and keeps borders, so on that path every boundary expressed as a value step
   disappears and the page collapses into one undifferentiated field. Restore a stroke for exactly the
   surfaces whose border was removed because the ground now does the work. Nothing here is decorative —
   each rule re-states a boundary that exists in the design, using the system colours the mode provides. */
@media (forced-colors: active) {
  body.detail-view,
  body.portfolio-view { background: Canvas; }

  .tdi-epoch-rail-host,
  .tdi-composition-bar,
  .tdi-market-card-grid,
  .nav-key-events-scroll,
  .measurement-card,
  .mf-poscard {
    border: 1px solid CanvasText;
  }

  /* Selection is a ground step plus a cyan dot; the dot survives, the ground step does not. */
  .tdi-composition-segment[aria-pressed="true"],
  .tdi-composition-segment.is-active { outline: 2px solid Highlight; outline-offset: -2px; }

  /* The share wash is a background and is therefore invisible here — the figure beside it still states the
     share, so no information is lost, but the row must not look empty. */
  .tdi-composition-segment > em { display: none; }
}
