:root {
  font-family: var(--font-family);
  color: var(--text);
  background: var(--page-bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
main { max-width: 1440px; margin: auto; padding: 32px 28px 52px; }
h1, h2, p { margin-top: 0; }
h1, h2 { color: var(--brand-navy); }
h1 { margin-bottom: 3px; font-size: 28px; line-height: 1.5; }
h2 { margin-bottom: 0; font-size: 18px; }
.hidden { display: none !important; }
.fund-etf-shareholders { margin-bottom: 18px; padding: 18px; }
.fund-etf-shareholders .section-heading { display:flex; justify-content:space-between; align-items:start; gap:14px; }
.fund-etf-shareholders .section-heading h2 { margin:0; }
.fund-etf-shareholders a { color:var(--primary); }
.fund-etf-shareholders .trend-chart { min-height:0; margin:8px 0; }
.fund-etf-shareholders .trend-chart svg text { font:11px var(--font-family); fill:var(--text-secondary); }
.fund-etf-shareholders .more-button { font:inherit; color:var(--primary); }
@media(max-width:650px){.fund-etf-shareholders{padding:12px}.fund-etf-shareholders .section-heading{flex-direction:column}}
.portfolio-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
#market-view[aria-busy="true"] { opacity: .45; pointer-events: none; }
.portfolio-tabs button { padding: 10px 22px; color: var(--text-secondary); background: none; border: 0; border-bottom: 3px solid transparent; cursor: pointer; }
.portfolio-tabs button[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }
.analytics-controls { flex-wrap: wrap; }
.analytics-controls .control { flex: 1; min-width: 170px; }
.analytics-table { min-width: 0; font-variant-numeric: tabular-nums; }
.analytics-table td:first-child { min-width: 0; }
.analytics-table th, .analytics-table td { padding: 11px 16px; }
#market-view .analytics-table th:not(:first-child), #market-view .analytics-table td:not(:first-child) { text-align: center; }
.analytics-table button { padding: 0; color: inherit; border: 0; background: none; cursor: pointer; text-align: inherit; }
.analytics-table th button { font-weight: 700; }
.analytics-table tbody tr:hover { background: var(--selected-bg); }
.analytics-table tr.selected { background: var(--selected-bg); }
.holdings-panel th:not(:first-child), .holdings-panel td.numeric { text-align: center; }
.composition-table td:first-child button { display: flex; gap: 8px; align-items: center; }
.composition-table .swatch { display: inline-block; }
.methodology { padding: 12px 22px 18px; color: var(--text-secondary); font-size: 12px; line-height: 1.9; }
.methodology summary { cursor: pointer; color: var(--primary); }
.methodology p { margin: 8px 0 0; }
.trend-chart { margin: 0 22px 12px; }
.trend-chart svg { display: block; width: 100%; height: auto; min-height: 170px; }
.trend-chart svg text { font: 11px var(--font-family); fill: var(--text-secondary); }
.trend-chart svg .axis-tick { font: 600 13px var(--font-family); fill: var(--text-secondary); }
.trend-chart svg .axis-date { font: 600 12px var(--font-family); fill: var(--text-secondary); }
.trend-chart svg .axis-title { font: 700 14px var(--font-family); fill: var(--brand-navy); }
.line-key:before { content: ''; display: inline-block; vertical-align: middle; width: 22px; height: 0; margin-left: 6px; border-top: 3px solid var(--series-3); }
.line-key.average:before { border-color: var(--series-4); border-top-style: dashed; }
.line-key.median:before { border-color: var(--primary); border-top-style: dotted; }
.change-strip { display: flex; flex-wrap: wrap; gap: 15px; padding: 0 22px; color: var(--text-secondary); font-size: 13px; }
.change-strip span { padding: 8px 12px; background: var(--page-bg); border-radius: 6px; }
.change-strip small { display: block; margin-top: 4px; color: var(--text-secondary); }
.category-tabs { display: flex; gap: 8px; padding: 0 22px 15px; overflow-x: auto; }
.category-tab { flex: 0 0 auto; padding: 8px 13px; color: var(--text-secondary); background: var(--page-bg); border: 1px solid var(--border); border-radius: 99px; cursor: pointer; font-size: 12px; }
.category-tab[aria-pressed="true"] { color: var(--surface); background: var(--primary); border-color: var(--primary); }
.contextual-heading { border-top: 1px solid var(--page-bg); padding-top: 16px; }
.contextual-heading h3, .contextual-exploration h3 { margin: 0; color: var(--brand-navy); font-size: 14px; }
.contextual-exploration { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; padding: 8px 22px 22px; }
.context-range { position: relative; height: 12px; margin: 16px 0 8px; background: var(--page-bg); border-radius: 99px; }
.context-band { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--primary) 33.3%, transparent); border-radius: 99px; }
.context-median { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--brand-navy); }
.context-list { margin-top: 8px; }
.context-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 34px; border-bottom: 1px solid var(--page-bg); font-size: 12px; }
.context-fund { overflow: hidden; color: var(--primary); border: 0; background: none; text-align: right; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.context-item strong { flex: none; font-variant-numeric: tabular-nums; }
.explorer-controls { padding: 0 22px; flex-wrap: wrap; }
.explorer-controls .control { flex: 1; }
.explorer-table { min-width: 880px; }
.explorer-table th { position: sticky; top: 0; }
.explorer-table td:first-child { width: 26%; }
.explorer-table td:first-child button { color: var(--primary); line-height: 1.7; }
.explorer-table td.numeric { white-space: nowrap; }
.explorer-table td.change-12m { text-align: center; }
.explorer-table td.change-12m .pp-value { justify-content: center; }
.pp-value { display: inline-flex; direction: rtl; unicode-bidi: isolate; align-items: baseline; gap: 4px; white-space: nowrap; }
.pp-value .fmap-number { direction: ltr; unicode-bidi: isolate; }
.pp-value .pp-unit { direction: rtl; unicode-bidi: isolate; }
.benchmark-rows { padding: 0 22px 14px; }
.benchmark-row { display: grid; grid-template-columns: 200px minmax(150px, 1fr) minmax(260px, 1.5fr); align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); font-size: 12px; }
.bullet-track { position: relative; height: 12px; background: var(--page-bg); border-radius: 3px; }
.bullet-fill { position: absolute; right: 0; height: 100%; border-radius: 3px; }
.bullet-median { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--brand-navy); }
.bullet-iqr { position: absolute; top: -2px; height: 16px; background: color-mix(in srgb, var(--series-3) 14.1%, transparent); }
.benchmark-numbers { line-height: 1.9; }
.legend-toggle { color: inherit; display: flex; align-items: center; gap: 6px; border: 0; padding: 3px 0; background: none; cursor: pointer; }
.legend-toggle[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.market-gap .history-stack { background: var(--page-bg); }
.month-coverage { font-size: 10px; color: var(--text-secondary); white-space: nowrap; }
#market-history { direction: ltr; }
#market-history .history-month { flex: 1 0 48px; }
#market-history .history-label { direction: ltr; unicode-bidi: isolate; }
#market-insufficient { margin: 0 22px 18px; font-size: 13px; }
button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
@media (max-width: 850px) { .benchmark-row { grid-template-columns: 1fr 1fr; } .benchmark-numbers { grid-column: 1 / -1; } }
@media (max-width: 650px) {
  .analytics-controls .control { min-width: 0; }
  .composition-table { font-size: 11px; }
  .composition-table th { white-space: normal; }
  .composition-table th, .composition-table td { padding: 10px 8px; }
  .trend-chart { margin: 0 12px 12px; }
  .trend-chart svg .axis-tick { font-size: 26px; }
  .trend-chart svg .axis-date { font-size: 25px; }
  .trend-chart svg .axis-title { font-size: 28px; }
  .change-strip, .benchmark-rows, .explorer-controls, .category-tabs { padding-right: 15px; padding-left: 15px; }
  .contextual-exploration { grid-template-columns: 1fr; padding-right: 15px; padding-left: 15px; }
  .explorer-table { min-width: 0; }
  .explorer-table thead { display: none; }
  .explorer-table tbody, .explorer-table tr { display: block; }
  .explorer-table tr { padding: 12px 15px; border-top: 1px solid var(--border); }
  .explorer-table td { display: flex; justify-content: space-between; width: 100% !important; border: 0; padding: 5px 0; font-size: 12px; }
  .explorer-table td:before { content: attr(data-label); direction: rtl; color: var(--text-secondary); padding-left: 10px; }
  .explorer-table td:first-child { display: block; font-weight: 700; margin-bottom: 6px; }
  .explorer-table td.numeric { direction: rtl; text-align: center; }
  .explorer-table td.change-12m { display: grid; grid-template-columns: 1fr 1fr; align-items: center; }
  .explorer-table td.change-12m:before { grid-column: 1; }
  .explorer-table td.change-12m .pp-value { grid-column: 2; justify-self: center; }
}
.page-header { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding-bottom: 20px; margin-bottom: 20px; border-bottom: 2px solid var(--border); }
.eyebrow { margin-bottom: 5px; color: var(--primary); font-size: 12px; font-weight: 700; }
.subtitle { margin: 0; color: var(--text-secondary); font-size: 14px; }
.coverage { margin: 0 0 5px; color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.controls { display: flex; align-items: end; gap: 16px; margin-bottom: 20px; }
.control { display: grid; gap: 7px; color: var(--text-secondary); font-size: 13px; font-weight: 700; }
.fund-control { width: min(440px, 44vw); }
.fund-picker { position: relative; }
.fund-results { position: absolute; z-index: 10; top: calc(100% + 4px); right: 0; left: 0; max-height: 290px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: none; }
.fund-result { display: block; width: 100%; padding: 10px 12px; color: var(--text); background: var(--surface); border: 0; border-bottom: 1px solid var(--page-bg); text-align: right; cursor: pointer; font-size: 13px; font-weight: 400; }
.fund-result:last-child { border-bottom: 0; }
.fund-result:hover, .fund-result:focus-visible, .fund-result[aria-selected="true"] { background: var(--selected-bg); outline: 0; }
.fund-no-results { margin: 0; padding: 12px; color: var(--text-secondary); font-size: 12px; font-weight: 400; }
.month-control { width: 235px; }
input, select, button { font: inherit; }
.control input, .control select, .history-heading select { width: 100%; min-height: 44px; padding: 9px 12px; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; outline: 0; }
.control input:focus, .control select:focus, .history-heading select:focus { border-color: var(--primary); box-shadow: none; }
.control select:disabled { color: var(--text-secondary); background: var(--page-bg); }
.month-count { margin: 0 0 12px; color: var(--text-secondary); font-size: 12px; }
.status { margin: 0 0 14px; color: var(--text-secondary); font-size: 13px; }
.status:empty { display: none; }
.empty, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: none; }
.empty { padding: 34px; color: var(--text-secondary); text-align: center; }
.portfolio-heading { display: flex; justify-content: space-between; align-items: end; gap: 24px; padding: 5px 0 20px; }
.portfolio-heading h2 { font-size: 23px; }
.total-value { display: flex; align-items: baseline; gap: 9px; color: var(--text-secondary); font-size: 12px; }
.total-value strong { color: var(--brand-navy); font-size: 25px; font-variant-numeric: tabular-nums; }
.total-value small { font-size: 12px; }
.panel { margin-bottom: 20px; overflow: hidden; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 22px 16px; }
.section-heading p { margin: 4px 0 0; color: var(--text-secondary); font-size: 12px; }
.unit-note { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.allocation-chart { display: flex; width: calc(100% - 44px); height: 25px; margin: 0 22px 23px; overflow: hidden; border-radius: 6px; background: var(--page-bg); direction: rtl; }
.allocation-segment { min-width: 0; height: 100%; padding: 0; border: 0; border-left: 2px solid var(--surface); cursor: pointer; }
.allocation-segment:first-child { border-right: 0; }
.allocation-segment:hover, .allocation-segment:focus-visible { filter: brightness(1.12); outline: 2px solid var(--brand-navy); outline-offset: -2px; }
.allocation-head, .allocation-row { display: grid; grid-template-columns: minmax(190px, 1fr) 190px 100px; align-items: center; gap: 12px; }
.allocation-head { padding: 10px 22px; color: var(--text-secondary); background: var(--page-bg); font-size: 12px; }
.allocation-head span:not(:first-child), .allocation-row span:not(:first-child) { text-align: left; }
.allocation-list { padding-bottom: 8px; }
.allocation-row { width: 100%; min-height: 55px; padding: 11px 22px; color: var(--text-secondary); background: var(--surface); border: 0; border-top: 1px solid var(--border); border-right: 4px solid transparent; text-align: right; cursor: pointer; font-size: 13px; }
.allocation-row:hover, .allocation-row:focus-visible { background: var(--selected-bg); outline: 0; }
.allocation-row[aria-pressed="true"] { background: var(--selected-bg); border-right-color: var(--primary); color: var(--brand-navy); font-weight: 700; }
.allocation-name { display: flex; align-items: center; gap: 10px; }
.swatch { flex: none; width: 10px; height: 10px; border-radius: 2px; }
.allocation-row .numeric { direction: ltr; font-variant-numeric: tabular-nums; }
.count-badge { padding: 5px 10px; color: var(--text-secondary); background: var(--page-bg); border-radius: 99px; font-size: 12px; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
table { width: 100%; min-width: 790px; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 20px; border-top: 1px solid var(--border); text-align: right; }
th { color: var(--brand-navy); background: var(--page-bg); font-weight: 700; white-space: nowrap; }
th small { color: var(--text-secondary); font-weight: 400; }
td { color: var(--text-secondary); }
td:first-child { min-width: 260px; }
td .detail { display: block; margin-top: 3px; color: var(--text-secondary); font-size: 11px; }
td.numeric { text-align: left; white-space: nowrap; direction: ltr; font-variant-numeric: tabular-nums; }
.holdings-footer { display: flex; justify-content: center; padding: 10px 20px 16px; }
.more-button { padding: 9px 18px; color: var(--primary); background: var(--surface); border: 1px solid var(--border); border-radius: 7px; cursor: pointer; font-weight: 700; font-size: 12px; }
.more-button:hover, .more-button:focus-visible { background: var(--selected-bg); outline: 0; }
.history-heading label { display: grid; gap: 5px; color: var(--text-secondary); font-size: 12px; }
.history-heading select { min-height: 36px; padding: 5px 10px; }
.history-legend { display: flex; flex-wrap: wrap; gap: 10px 18px; padding: 0 22px 14px; color: var(--text-secondary); font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.history-scroll { overflow-x: auto; margin: 0 22px; scrollbar-width: thin; }
.history-chart { display: flex; align-items: end; min-height: 225px; width: max-content; min-width: 100%; gap: 7px; padding: 12px 0 0; border-bottom: 1px solid var(--border); background: var(--page-bg); }
.history-month { display: grid; justify-items: center; gap: 7px; flex: 0 0 34px; padding: 0; color: var(--text-secondary); background: none; border: 0; cursor: pointer; }
.history-month:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
.history-stack { display: flex; flex-direction: column-reverse; width: 27px; height: 180px; overflow: hidden; background: var(--page-bg); border-radius: 3px 3px 0 0; }
.history-month:hover .history-stack, .history-month.selected .history-stack { outline: 2px solid var(--brand-navy); outline-offset: 2px; }
.history-piece { width: 100%; min-height: 0; }
.history-label { height: 23px; font-size: 10px; white-space: nowrap; }
.history-note { margin: 0; padding: 13px 22px 18px; color: var(--text-secondary); font-size: 11px; }
@media (max-width: 850px) {
  .portfolio-heading { align-items: start; flex-direction: column; gap: 10px; }
  .fund-control { width: min(440px, 55vw); }
}
@media (max-width: 650px) {
  main { padding: 18px 12px 32px; }
  h1 { font-size: 23px; }
  .page-header { align-items: start; flex-direction: column; gap: 8px; }
  .coverage { white-space: normal; }
  .controls { align-items: stretch; flex-direction: column; gap: 12px; }
  .fund-control, .month-control { width: 100%; }
  .month-count { margin: -4px 0 0; }
  .total-value { flex-wrap: wrap; }
  .section-heading { padding: 17px 15px 12px; }
  .allocation-chart { width: calc(100% - 30px); margin: 0 15px 18px; }
  .allocation-head, .allocation-row { grid-template-columns: minmax(120px, 1fr) 110px 65px; gap: 5px; padding-left: 12px; padding-right: 12px; font-size: 11px; }
  .allocation-row { min-height: 51px; }
  .history-legend { padding-right: 15px; padding-left: 15px; }
  .history-scroll { margin: 0 15px; }
  .history-note { padding-right: 15px; padding-left: 15px; }
}

/* Shared density refinements for this workspace; chart and table geometry stay intact. */
main { padding-top: 22px; padding-bottom: 38px; }
.page-header { padding-bottom: 14px; margin-bottom: 15px; border-bottom-width: 1px; }
.controls { gap: 12px; margin-bottom: 12px; }
.portfolio-heading { padding-bottom: 14px; }
.panel { margin-bottom: 15px; border-radius: 10px; }
.section-heading { padding-top: 16px; padding-bottom: 13px; }
.table-scroll, .history-scroll { scrollbar-width: thin; overscroll-behavior-inline: contain; }

@media (max-width: 650px) {
  main { padding: 14px 12px 26px; }
  .page-header { margin-bottom: 12px; padding-bottom: 12px; }
  .controls { gap: 9px; margin-bottom: 9px; }
  .portfolio-heading { gap: 7px; padding: 2px 0 11px; }
  .portfolio-heading h2 { font-size: 20px; }
  .total-value strong { font-size: 22px; }
  .panel { margin-bottom: 12px; }
  .section-heading { padding-top: 14px; padding-bottom: 11px; }
  .allocation-chart { height: 22px; }
  .table-scroll, .history-scroll { max-width: 100%; }
}

.market-gap .history-stack { border: 1px dashed var(--border); }
