.etf-flow-page {
  padding-top: clamp(20px, 2vw, 28px);
}

.etf-flow-intro {
  max-width: 760px;
}

.etf-flow-intro .page-h1 {
  margin-bottom: 12px;
}

.etf-flow-intro > p:last-child {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.etf-flow-dashboard {
  margin-top: 28px;
  border-top: 1px solid var(--line-strong);
}

.etf-flow-toolbar {
  display: grid;
  grid-template-columns: minmax(190px, 280px) auto minmax(180px, 1fr);
  gap: 14px 24px;
  align-items: end;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

.etf-flow-asset-control {
  display: grid;
  gap: 6px;
}

.etf-flow-asset-control > span,
.etf-flow-summary span,
.etf-flow-fund-head,
.etf-flow-history-head {
  color: var(--quiet);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  line-height: 1.25;
  text-transform: uppercase;
}

.etf-flow-asset-control select {
  width: 100%;
  height: 38px;
  border: 1px solid rgba(139, 158, 165, 0.44);
  border-radius: 7px;
  padding: 0 34px 0 11px;
  color: var(--ink);
  background: #fff;
  font-size: 14px;
  font-weight: 500;
}

.etf-flow-asset-control select:focus-visible {
  border-color: var(--teal);
  outline: 2px solid rgba(31, 101, 118, 0.16);
  outline-offset: 2px;
}

.etf-flow-range {
  display: flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  padding: 5px;
  border: 1px solid rgb(241, 244, 245);
  border-radius: 10px;
  overflow: auto;
}

.etf-flow-range > span,
.etf-flow-range > button {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 7px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.etf-flow-range > span {
  display: inline-flex;
  align-items: center;
}

.etf-flow-asof {
  justify-self: end;
  margin: 0 0 7px;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.35;
  text-align: end;
}

.etf-flow-asof.is-partial,
.etf-flow-asof.is-unavailable {
  color: var(--amber);
}

.etf-flow-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-bottom: 1px solid var(--line-strong);
}

.etf-flow-summary article {
  display: grid;
  min-width: 0;
  min-height: 116px;
  align-content: center;
  padding: 18px clamp(14px, 2vw, 26px);
  border-inline-end: 1px solid var(--line);
}

.etf-flow-summary article:first-child {
  padding-inline-start: 0;
}

.etf-flow-summary article:last-child {
  border-inline-end: 0;
  padding-inline-end: 0;
}

.etf-flow-summary strong {
  overflow: hidden;
  margin-top: 9px;
  color: var(--ink);
  font-family: var(--font-data);
  font-size: clamp(20px, 2.1vw, 28px);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: var(--tracking-title);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etf-flow-summary small {
  margin-top: 7px;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.3;
}

.etf-flow-summary strong.is-positive,
.is-positive {
  color: var(--green);
}

.etf-flow-summary strong.is-negative,
.is-negative {
  color: var(--red);
}

.etf-flow-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line-strong);
}

.etf-flow-section-heading .eyebrow {
  margin-bottom: 5px;
  color: var(--quiet);
  font-size: 12px;
}

.etf-flow-section-heading h2,
.etf-flow-method h2,
.etf-flow-empty-state h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.012em;
}

.etf-flow-section-heading > time,
.etf-flow-section-heading > span {
  color: var(--quiet);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  text-align: end;
}

.etf-flow-main-grid,
.etf-flow-history {
  margin-top: clamp(42px, 5vw, 64px);
}

.etf-flow-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.etf-flow-trend {
  min-width: 0;
  overflow: hidden;
}

.etf-flow-main-grid .etf-flow-section-heading {
  min-height: 69px;
  padding: 14px 18px;
}

.etf-flow-funds {
  min-width: 0;
  border-inline-start: 1px solid var(--line);
}

.etf-flow-legend {
  display: flex;
  gap: 16px;
  align-items: center;
  color: var(--quiet);
  font-size: 12px;
  font-weight: 600;
}

.etf-flow-legend span {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.etf-flow-legend span::before {
  width: 16px;
  height: 3px;
  background: currentColor;
  content: "";
}

.etf-flow-bars {
  --etf-flow-chart-padding-top: 22px;
  --etf-flow-chart-padding-bottom: 32px;
  --etf-flow-chart-axis-height: 22px;
  position: relative;
  display: flex;
  height: 518px;
  gap: 0;
  padding: var(--etf-flow-chart-padding-top) 4px var(--etf-flow-chart-padding-bottom);
}

.etf-flow-zero-line {
  position: absolute;
  top: var(--etf-flow-chart-padding-top);
  right: 0;
  bottom: calc(var(--etf-flow-chart-padding-bottom) + var(--etf-flow-chart-axis-height));
  left: 0;
  pointer-events: none;
}

.etf-flow-zero-line::before {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
  background: var(--line-strong);
  content: "";
  transform: translateY(-0.5px);
}

.etf-flow-chart-day {
  display: grid;
  position: relative;
  flex: 1 1 0;
  grid-template-rows: 1fr var(--etf-flow-chart-axis-height);
  min-width: 0;
}

.etf-flow-chart-day[hidden],
.etf-flow-history-list > article[hidden] {
  display: none;
}

.etf-flow-bar-plot {
  display: grid;
  grid-template-rows: 1fr 1fr;
  min-height: 0;
}

.etf-flow-bar {
  display: block;
  width: min(72%, 18px);
  min-width: 1px;
  height: max(2px, var(--flow-magnitude));
  justify-self: center;
  border-radius: 2px 2px 0 0;
  background: var(--quiet);
}

.etf-flow-chart-day.is-positive .etf-flow-bar {
  align-self: end;
  grid-row: 1;
  background: var(--green);
}

.etf-flow-chart-day.is-negative .etf-flow-bar {
  align-self: start;
  grid-row: 2;
  border-radius: 0 0 2px 2px;
  background: var(--red);
}

.etf-flow-chart-day.is-flat .etf-flow-bar {
  align-self: start;
  grid-row: 2;
}

.etf-flow-chart-day.is-unavailable .etf-flow-bar {
  display: none;
}

.etf-flow-chart-day time {
  display: none;
  position: absolute;
  top: calc(100% - 17px);
  left: 50%;
  color: var(--quiet);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transform: translateX(-50%);
}

.etf-flow-chart-day.is-axis-label time {
  display: block;
}

.etf-flow-zero-line + .etf-flow-chart-day time,
.etf-flow-chart-day[hidden] + .etf-flow-chart-day time {
  right: auto;
  left: 0;
  transform: none;
}

.etf-flow-chart-day:last-child time {
  right: 0;
  left: auto;
  transform: none;
}

.etf-flow-fund-head,
.etf-flow-fund-row {
  display: grid;
  grid-template-columns: minmax(230px, 1.5fr) minmax(120px, 0.75fr) minmax(90px, 0.58fr) minmax(90px, 0.58fr) minmax(92px, 0.55fr);
  gap: 18px;
  align-items: center;
}

.etf-flow-main-grid .etf-flow-fund-head {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  min-height: 38px;
  padding: 0 16px;
}

.etf-flow-main-grid .etf-flow-fund-head > :nth-child(n + 3) {
  display: none;
}

.etf-flow-main-grid .etf-flow-fund-ledger {
  max-height: 518px;
  overflow: auto;
  scrollbar-width: thin;
}

.etf-flow-main-grid .etf-flow-fund-row {
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 12px;
  min-height: 68px;
  padding: 9px 16px;
}

.etf-flow-main-grid .etf-flow-fund-name {
  grid-row: 1 / span 2;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 7px;
}

.etf-flow-main-grid .etf-flow-fund-row > :nth-child(3),
.etf-flow-main-grid .etf-flow-fund-row > :nth-child(4) {
  display: none;
}

.etf-flow-main-grid .etf-flow-fund-row > :nth-child(5) {
  text-align: end;
}

.etf-flow-fund-head {
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.etf-flow-fund-head span:not(:first-child),
.etf-flow-fund-row > :not(:first-child) {
  text-align: end;
}

.etf-flow-fund-row {
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.etf-flow-fund-name {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  min-width: 0;
  font-family: var(--font-sans);
}

.etf-flow-fund-name strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}

.etf-flow-fund-name span {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etf-flow-amount {
  font-family: var(--font-data);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: -0.008em;
}

.etf-flow-row-status {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
}

.etf-flow-row-status.is-estimated {
  color: var(--amber);
}

.etf-flow-row-status.is-unavailable,
.etf-flow-row-status.is-not_published,
.etf-flow-row-status.is-new_fund,
.etf-flow-row-status.is-stale {
  color: var(--quiet);
}

.etf-flow-row-status.is-revised,
.etf-flow-row-status.is-split_adjusted {
  color: var(--teal);
}

.etf-flow-history-head,
.etf-flow-history-toggle {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(120px, 0.78fr) minmax(150px, 0.95fr) minmax(150px, 0.95fr) 60px;
  gap: 18px;
  align-items: center;
}

.etf-flow-history-head {
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.etf-flow-history-head span:not(:first-child),
.etf-flow-history-toggle > :not(:first-child) {
  text-align: end;
}

.etf-flow-history-list > article {
  border-bottom: 1px solid var(--line);
}

.etf-flow-history-toggle {
  width: 100%;
  min-height: 62px;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  text-align: start;
}

.etf-flow-history-toggle:hover {
  background: rgba(241, 245, 245, 0.58);
}

.etf-flow-history-toggle:active {
  transform: none;
  transition: none;
}

.etf-flow-history-toggle:focus-visible {
  outline: 2px solid rgba(31, 101, 118, 0.24);
  outline-offset: -2px;
}

.etf-flow-history-toggle time,
.etf-flow-history-toggle > strong,
.etf-flow-history-toggle > span {
  font-variant-numeric: tabular-nums;
}

.etf-flow-history-toggle time {
  color: var(--ink);
  font-weight: 600;
}

.etf-flow-history-toggle > strong {
  font-family: var(--font-data);
  font-size: 13px;
}

.etf-flow-history-toggle > span b {
  margin-inline-end: 8px;
  color: var(--ink);
  font-size: 12px;
}

.etf-flow-fund-count {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
}

.etf-flow-fund-count i {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 0.15s ease;
}

.etf-flow-history-toggle[aria-expanded="true"] .etf-flow-fund-count i {
  transform: translateY(2px) rotate(225deg);
}

.etf-flow-history-detail {
  padding: 2px 0 14px clamp(18px, 3vw, 34px);
  border-top: 1px dashed var(--line);
  background: rgba(241, 245, 245, 0.34);
}

.etf-flow-history-detail[hidden] {
  display: none;
}

.etf-flow-history-detail > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  min-height: 44px;
  align-items: center;
  padding-inline-end: clamp(18px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.etf-flow-history-detail > div:last-child {
  border-bottom: 0;
}

.etf-flow-history-detail span {
  display: flex;
  min-width: 0;
  gap: 12px;
  align-items: baseline;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.etf-flow-history-detail span strong {
  min-width: 48px;
  color: var(--ink);
  font-size: 13px;
}

.etf-flow-history-detail > div > b {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
}

.etf-flow-empty,
.etf-flow-empty-state,
.etf-flow-method p {
  color: var(--quiet);
  font-size: 13px;
  line-height: 1.55;
}

.etf-flow-empty {
  margin: 0;
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}

.etf-flow-empty-state {
  padding: clamp(42px, 7vw, 82px) 0;
  border-bottom: 1px solid var(--line-strong);
}

.etf-flow-empty-state h2 {
  margin-bottom: 10px;
}

.etf-flow-empty-state p {
  max-width: 62ch;
  margin: 0;
}

.etf-flow-method {
  display: grid;
  gap: 10px;
  margin-top: clamp(56px, 7vw, 88px);
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}

.etf-flow-method p {
  max-width: 78ch;
  margin: 0;
}

html[dir="rtl"] .etf-flow-asset-control select {
  padding: 0 11px 0 34px;
}

@media (max-width: 900px) {
  .etf-flow-toolbar {
    grid-template-columns: minmax(190px, 1fr) auto;
  }

  .etf-flow-asof {
    grid-column: 1 / -1;
    justify-self: start;
    margin: 0;
    text-align: start;
  }

  .etf-flow-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .etf-flow-summary article:nth-child(2) {
    border-inline-end: 0;
  }

  .etf-flow-summary article:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .etf-flow-summary article:nth-child(3) {
    padding-inline-start: 0;
  }

  .etf-flow-fund-head,
  .etf-flow-fund-row {
    grid-template-columns: minmax(210px, 1.5fr) minmax(120px, 0.72fr) minmax(86px, 0.55fr) minmax(90px, 0.55fr);
  }

  .etf-flow-fund-head > :nth-child(4),
  .etf-flow-fund-row > :nth-child(4) {
    display: none;
  }

  .etf-flow-history-head,
  .etf-flow-history-toggle {
    grid-template-columns: minmax(140px, 1fr) minmax(118px, 0.75fr) minmax(140px, 0.9fr) 60px;
  }

  .etf-flow-history-head > :nth-child(4),
  .etf-flow-history-toggle > :nth-child(4) {
    display: none;
  }
}

@media (max-width: 1040px) {
  .etf-flow-main-grid {
    grid-template-columns: 1fr;
  }

  .etf-flow-funds {
    border-top: 1px solid var(--line);
    border-inline-start: 0;
  }

  .etf-flow-main-grid .etf-flow-fund-ledger {
    max-height: none;
  }

  .etf-flow-main-grid .etf-flow-fund-head,
  .etf-flow-main-grid .etf-flow-fund-row {
    grid-template-columns: minmax(230px, 1.5fr) minmax(120px, 0.75fr) minmax(90px, 0.58fr) minmax(90px, 0.58fr) minmax(92px, 0.55fr);
    gap: 18px;
    padding-inline: 16px;
  }

  .etf-flow-main-grid .etf-flow-fund-name {
    grid-row: auto;
    grid-template-columns: 62px minmax(0, 1fr);
    gap: 10px;
  }

  .etf-flow-main-grid .etf-flow-fund-head > :nth-child(n + 3),
  .etf-flow-main-grid .etf-flow-fund-row > :nth-child(3),
  .etf-flow-main-grid .etf-flow-fund-row > :nth-child(4) {
    display: block;
  }

  .etf-flow-bars {
    height: 360px;
  }
}

@media (max-width: 900px) {
  .etf-flow-main-grid .etf-flow-fund-head,
  .etf-flow-main-grid .etf-flow-fund-row {
    grid-template-columns: minmax(210px, 1.5fr) minmax(120px, 0.72fr) minmax(86px, 0.55fr) minmax(90px, 0.55fr);
  }

  .etf-flow-main-grid .etf-flow-fund-head > :nth-child(4),
  .etf-flow-main-grid .etf-flow-fund-row > :nth-child(4) {
    display: none;
  }
}

@media (max-width: 760px) {
  .etf-flow-page {
    padding-top: 18px;
  }

  .etf-flow-dashboard {
    margin-top: 24px;
  }

  .etf-flow-toolbar {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .etf-flow-range {
    display: grid;
    grid-template-columns: max-content repeat(4, max-content);
    align-items: stretch;
    gap: 3px;
    padding: 4px;
  }

  .etf-flow-range > span,
  .etf-flow-range > button {
    width: auto;
    min-width: 0;
    min-height: 30px;
    padding: 5px 4px;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.1;
    text-overflow: ellipsis;
  }

  .etf-flow-range > span {
    padding-inline: 10px;
  }

  .etf-flow-range > button {
    padding-inline: 12px;
  }

  .etf-flow-asof {
    grid-column: auto;
  }

  .etf-flow-summary article {
    min-height: 96px;
    padding: 15px 14px;
  }

  .etf-flow-summary article:nth-child(odd) {
    padding-inline-start: 0;
  }

  .etf-flow-summary article:nth-child(even) {
    padding-inline-end: 0;
  }

  .etf-flow-summary strong {
    font-size: clamp(18px, 6vw, 24px);
  }

  .etf-flow-section-heading {
    align-items: start;
  }

  .etf-flow-bars {
    height: 236px;
    margin-inline: -4px;
  }

  .etf-flow-legend {
    display: grid;
    gap: 4px;
  }

  .etf-flow-fund-head,
  .etf-flow-history-head {
    display: none;
  }

  .etf-flow-fund-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 18px;
    min-height: 82px;
    padding: 12px 0;
  }

  .etf-flow-main-grid .etf-flow-fund-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 5px 18px;
    min-height: 82px;
    padding: 12px 16px;
  }

  .etf-flow-main-grid .etf-flow-fund-name {
    grid-row: 1 / span 2;
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .etf-flow-main-grid .etf-flow-fund-row > :nth-child(3),
  .etf-flow-main-grid .etf-flow-fund-row > :nth-child(4) {
    display: none;
  }

  .etf-flow-fund-name {
    grid-row: 1 / span 2;
    grid-template-columns: 54px minmax(0, 1fr);
  }

  .etf-flow-fund-row > :nth-child(3),
  .etf-flow-fund-row > :nth-child(4) {
    display: none;
  }

  .etf-flow-fund-row > :nth-child(5) {
    text-align: end;
  }

  .etf-flow-history-toggle {
    grid-template-columns: minmax(0, 1fr) auto minmax(48px, max-content);
    gap: 4px 12px;
    min-height: 96px;
    padding: 10px 0;
  }

  .etf-flow-history-toggle time {
    grid-column: 1;
    grid-row: 1;
  }

  .etf-flow-history-toggle > strong {
    grid-column: 2;
    grid-row: 1;
  }

  .etf-flow-history-toggle > span:nth-of-type(1) {
    grid-column: 1 / span 2;
    grid-row: 2;
    color: var(--quiet);
    text-align: start;
  }

  .etf-flow-history-toggle > span:nth-of-type(2) {
    display: block;
    grid-column: 1 / span 2;
    grid-row: 3;
    color: var(--quiet);
    text-align: start;
  }

  .etf-flow-history-toggle .etf-flow-fund-count {
    display: flex;
    grid-column: 3;
    grid-row: 1 / span 3;
    padding-inline-end: 2px;
  }

  .etf-flow-history-detail {
    padding-inline-start: 12px;
  }
}

@media (max-width: 420px) {
  .etf-flow-summary span,
  .etf-flow-summary small {
    font-size: 12px;
  }

  .etf-flow-section-heading {
    gap: 14px;
  }

  .etf-flow-section-heading h2,
  .etf-flow-method h2 {
    font-size: 16px;
  }

  .etf-flow-chart-day time {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .etf-flow-fund-count i {
    transition: none;
  }
}
