/* One component language for all eleven portfolio betas, in both themes. */
html:root body:is(.portfolio-profile,.daily-profile) .rp-app-shell :is(#performance,#profile-performance) :is(.comparison-head,.rp-comparison-head) { padding-block:18px; min-height:58px; box-sizing:border-box; align-items:center; line-height:1.5; }
html:root body.portfolio-profile .comparison-row[data-value-stats="VTV"] .comparison-name i { background:var(--red,#ad6777); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-annual-layout { display:grid; grid-template-columns:minmax(0,1.65fr) minmax(260px,1fr); gap:48px; align-items:start; padding:24px 0 8px; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-record-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:16px; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-record-heading p { margin:0 0 8px; font:500 13px/1.5 var(--font-ui); color:var(--rp-muted); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-record-heading h3 { margin:0; font:600 23px/1.3 var(--font-ui); color:var(--rp-text); text-transform:none; letter-spacing:0; }
html:root body:is(.portfolio-profile,.daily-profile) :is(.profile-ui-record-heading,.profile-ui-monthly-toolbar) label { display:flex; align-items:center; flex-wrap:wrap; gap:10px; font:400 13px/1.5 var(--font-ui); color:var(--rp-muted); }
html:root body:is(.portfolio-profile,.daily-profile) :is(.profile-ui-record-heading,.profile-ui-monthly-toolbar) select { font:400 14px/1.5 var(--font-ui); padding:9px 28px 9px 12px; color:var(--rp-text); background:var(--rp-bg); border:1px solid var(--rp-line); border-radius:10px; }
html:root body:is(.portfolio-profile,.daily-profile) :is(.profile-ui-record-note,.profile-ui-drawdown-copy,.profile-ui-empty-record) { font:400 14px/1.65 var(--font-ui); color:var(--rp-muted); margin:16px 0 22px; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-annual-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(126px,1fr)); gap:10px; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-year-card { display:grid; gap:12px; padding:16px; border:1px solid var(--rp-line); border-radius:10px!important; background:var(--rp-soft); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-year-card > span { font:500 14px/1.4 var(--font-ui); color:var(--rp-muted); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-year-card strong { font:500 21px/1.3 var(--font-ui); font-variant-numeric:tabular-nums; color:var(--rp-blue); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-year-card.is-negative strong { color:var(--chart-ahlyx,var(--ms-slate)); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-year-card small { font:400 12px/1.5 var(--font-ui); color:var(--rp-muted); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-downside { padding-left:32px; border-left:1px solid var(--rp-line); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-drawdown-value { font:500 40px/1.25 var(--font-ui); color:var(--rp-blue); font-variant-numeric:tabular-nums; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-drawdown-track { height:6px; margin-top:22px; border-radius:4px; overflow:hidden; background:var(--rp-line); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-drawdown-track span { display:block; height:100%; background:var(--rp-blue); }
html:root body:is(.portfolio-profile,.daily-profile) :is(.allocation-mosaic,.rp-mosaic,#ms-allocation-mosaic) { display:grid; grid-template-columns:repeat(auto-fill,minmax(156px,1fr)); grid-auto-rows:max-content; gap:10px; max-height:550px; overflow:auto; align-items:stretch; align-content:start; }
html:root body:is(.portfolio-profile,.daily-profile) :is(.asset-tile,.rp-asset-tile) { display:flex; flex-direction:column; justify-content:flex-start; min-height:0; height:auto; padding:16px; gap:20px; text-align:left; border:1px solid var(--rp-line); border-radius:10px!important; background:var(--rp-bg); color:var(--rp-text); box-shadow:none; animation:none; transform:none; }
html:root body:is(.portfolio-profile,.daily-profile) :is(.asset-tile,.rp-asset-tile) > * { flex-shrink:0; }
/* The moved allocation panel must not retain the outer section's padding. */
html:root body.portfolio-profile .rp-app-shell .profile-original-allocation { padding:0; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-holding-heading { display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:6px; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-holding-heading strong { font:600 17px/1.4 var(--font-ui); color:var(--rp-text); }
html:root body:is(.portfolio-profile,.daily-profile) :is(.profile-ui-holding-heading,.profile-ui-holding-weight,.profile-ui-holding-quote) small { font:400 12px/1.5 var(--font-ui); color:var(--rp-muted); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-holding-weight { display:grid; gap:4px; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-holding-weight b { font:500 19px/1.4 var(--font-ui); color:var(--rp-text); font-variant-numeric:tabular-nums; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-holding-quote { display:grid; gap:6px; margin-top:auto; padding-top:12px; border-top:1px solid var(--rp-line); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-quote-values { display:flex; flex-wrap:wrap; justify-content:space-between; gap:4px 10px; font:500 14px/1.5 var(--font-ui); color:var(--rp-muted); font-variant-numeric:tabular-nums; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-quote-values :is(b,span) { font:inherit; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-quote-values b { color:var(--rp-text); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-quote-values .positive { color:var(--rp-blue); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-quote-values .negative { color:var(--chart-ahlyx,var(--ms-slate)); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-allocation-note { font:400 13px/1.6 var(--font-ui); color:var(--rp-muted); margin:0 0 20px; }
html:root body.daily-profile #daily-price-quote { margin-top:26px; max-width:320px; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-monthly-toolbar { display:flex; justify-content:space-between; align-items:center; gap:20px; flex-wrap:wrap; margin:20px 0; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-return-key { display:flex; flex-wrap:wrap; gap:12px 20px; color:var(--rp-muted); font:400 14px/1.5 var(--font-ui); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-return-key span { display:inline-flex; gap:7px; align-items:center; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-return-key i { width:8px; height:8px; border-radius:3px; background:var(--rp-blue); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-return-key i.is-negative { background:var(--chart-ahlyx,var(--ms-slate)); }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-return-key small { font-size:13px; }
html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-heatmap-hint { font:400 13px/1.6 var(--font-ui); color:var(--rp-muted); margin:16px 0 0; }
html:root body.portfolio-profile .profile-monthly-view :is(.managed-monthly,.monthly-returns,.rp-monthly) h2 { display:block; font:500 20px/1.4 var(--font-ui); text-transform:none; letter-spacing:0; margin-top:0; }
html:root body.portfolio-profile .profile-monthly-view :is(.managed-section-head,.monthly-returns-head) p { font:400 15px/1.65 var(--font-ui); }
html:root body.portfolio-profile .profile-monthly-view :is(.managed-history-span,.monthly-returns-span) { font:400 14px/1.5 var(--font-ui); color:var(--rp-muted); }
/* Keep the return text readable; only the table scrolls on narrow screens. */
html:root body:is(.portfolio-profile,.daily-profile) .rp-app-shell :is(.managed-heatmap-scroll,.heatmap-scroll,.rp-monthly-scroll) { width:100%; max-width:100%; min-width:0; overflow:auto; overscroll-behavior-x:contain; }
html:root body:is(.portfolio-profile,.daily-profile) .rp-app-shell :is(.managed-monthly-grid,.monthly-heatmap,.rp-monthly-grid) { width:100%; min-width:1150px; }
html:root body:is(.portfolio-profile,.daily-profile) .rp-app-shell :is(.managed-heatmap-row,.heatmap-row,.rp-month-row) { display:grid; grid-template-columns:64px repeat(12,minmax(76px,1fr)) 96px; gap:6px; align-items:center; }
html:root body:is(.portfolio-profile,.daily-profile) .rp-app-shell :is(.managed-heatmap-cell,.heatmap-cell,.rp-month-cell) { box-sizing:border-box; min-width:0; padding:0 6px; white-space:nowrap; font-variant-numeric:tabular-nums; }
@media(max-width:760px) {
 html:root body.portfolio-profile .ms-current-grid { grid-template-columns:minmax(0,1fr); }
 html:root body.portfolio-profile .ms-current-grid > * { min-width:0; }
 html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-annual-layout { grid-template-columns:1fr; gap:32px; }
 html:root body:is(.portfolio-profile,.daily-profile) .profile-ui-downside { padding:28px 0 0; border-left:0; border-top:1px solid var(--rp-line); }
 html:root body:is(.portfolio-profile,.daily-profile) :is(.allocation-mosaic,.rp-mosaic,#ms-allocation-mosaic) { grid-template-columns:repeat(2,minmax(0,1fr)); }
 html:root body:is(.portfolio-profile,.daily-profile) :is(.asset-tile,.rp-asset-tile) { padding:12px; }
}

/* Match the dark navigation band without changing the light-theme hero. */
html:root[data-theme="dark"] body.portfolio-profile .rp-app-shell > .profile-ui-hero,
html:root[data-theme="dark"] body.regime-portfolio-page.daily-profile[data-portfolio-model="daily"] .rp-app-shell > .profile-ui-hero {
 box-sizing:border-box; width:100%; padding-inline:max(var(--profile-ui-gutter),calc((100% - 1360px)/2)); background:#111619;
}
/* The selected pill provides the grouping; no enclosing rectangular frame. */
html:root body:is(.portfolio-profile,.daily-profile) .rp-app-shell :is(.factor-analytics__tabs,.range-control,.ms-range-controls,.profile-ui-chart-mode) {
 border:0!important; box-shadow:none!important; background:transparent!important; outline:0; padding:4px; gap:6px;
}
html:root body.portfolio-profile .factor-analytics__head { grid-template-columns:minmax(0,1fr); align-items:start; gap:24px; margin-bottom:32px; }
/* One compact hierarchy across exposure, flow, contribution and drawdown panels. */
html:root body.portfolio-profile .factor-analytics .factor-analytics__head h2 { font:600 22px/1.3 var(--font-ui); }
html:root body.portfolio-profile .factor-analytics .section-kicker { font-size:12px; }
html:root body.portfolio-profile :is(.factor-active-label strong,.factor-active-value,.factor-active-legend,.factor-flow-stream span,.factor-flow-stream b,.factor-flow-sector strong,.factor-flow-sector span) { font:500 12px/1.5 var(--font-ui); }
html:root body.portfolio-profile :is(.factor-active-label span,.factor-flow-book span,.factor-flow-book small) { font:400 12px/1.5 var(--font-ui); }
html:root body.portfolio-profile .factor-flow-book strong { font:500 18px/1.3 var(--font-ui); }
html:root body.portfolio-profile .factor-analytics__head p { max-width:none; margin-top:8px; font:400 13px/1.65 var(--font-ui); }
html:root body.portfolio-profile .factor-analytics__tabs { max-width:100%; width:fit-content; overscroll-behavior-x:contain; }
html:root body.portfolio-profile .factor-analytics__tab { min-height:44px; padding:10px 16px; font:500 13px/1.4 var(--font-ui); }
/* Preserve tab geometry; selection is an underline, not a filled capsule. */
html:root body.portfolio-profile .factor-analytics__tabs .factor-analytics__tab { border-radius:0!important; background:transparent!important; box-shadow:none!important; }
html:root body.portfolio-profile .factor-analytics__tabs .factor-analytics__tab:is(.is-active,[aria-selected="true"]) { box-shadow:inset 0 -2px 0 var(--site-accent,var(--blue))!important; }
html:root body.portfolio-profile .factor-analytics__panel-head { align-items:start; margin-bottom:24px; gap:16px; }
html:root body.portfolio-profile .factor-analytics__panel-head h3 { margin:0 0 8px; font:600 18px/1.3 var(--font-ui); letter-spacing:-.02em; }
html:root body.portfolio-profile .factor-analytics__panel-head p { margin:0; font:400 13px/1.6 var(--font-ui); }
html:root body.portfolio-profile .factor-analytics__panel-head .mini-pill { flex-shrink:0; font:400 13px/1.5 var(--font-ui); }
html:root body.portfolio-profile :is(.rebalance-summary,.factor-drawdown-summary) { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:0; margin:0 0 24px; padding:20px 0; border:0; border-top:1px solid var(--rp-line); border-bottom:1px solid var(--rp-line); background:transparent; }
html:root body.portfolio-profile :is(.rebalance-stat,.factor-drawdown-stat) { min-width:0; display:grid; align-content:start; gap:8px; padding:0 24px; border:0; border-right:1px solid var(--rp-line); background:transparent; }
html:root body.portfolio-profile :is(.rebalance-stat,.factor-drawdown-stat):first-child { padding-left:0; }
html:root body.portfolio-profile :is(.rebalance-stat,.factor-drawdown-stat):last-child { border-right:0; }
html:root body.portfolio-profile :is(.rebalance-stat,.factor-drawdown-stat) > span { margin:0; font:400 13px/1.5 var(--font-ui); color:var(--rp-muted); text-transform:none; letter-spacing:0; }
html:root body.portfolio-profile :is(.rebalance-stat,.factor-drawdown-stat) > strong { margin:0; font:500 18px/1.3 var(--font-ui); color:var(--rp-text); font-variant-numeric:tabular-nums; }
html:root body.portfolio-profile .rebalance-recent { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:20px; margin-top:24px; }
html:root body.portfolio-profile .rebalance-month { display:grid; gap:6px; padding:16px 0; border:0; border-top:1px solid var(--rp-line); background:transparent; }
html:root body.portfolio-profile .rebalance-month b { font:500 13px/1.5 var(--font-ui); color:var(--rp-muted); }
html:root body.portfolio-profile .rebalance-month strong { font:500 18px/1.4 var(--font-ui); color:var(--rp-text); }
html:root body.portfolio-profile .rebalance-month span { font:400 13px/1.5 var(--font-ui); color:var(--rp-muted); }
html:root body.portfolio-profile .factor-chart-surface { min-height:0; padding:20px 0; }
html:root body.portfolio-profile .factor-chart-axis { font-family:var(--font-ui); font-size:12px; font-weight:400; }
html:root body.portfolio-profile .factor-contribution-scroll { max-width:100%; overscroll-behavior-x:contain; }
html:root body.portfolio-profile .factor-contribution-heatmap { gap:6px; }
html:root body.portfolio-profile .factor-contribution-row { gap:6px; }
html:root body.portfolio-profile .factor-contribution-sector { font:500 12px/1.5 var(--font-ui); padding-right:12px; }
html:root body.portfolio-profile .factor-contribution-month { font:500 12px/1.5 var(--font-ui); }
html:root body.portfolio-profile .factor-contribution-cell { box-sizing:border-box; height:40px; min-width:0; padding:0 6px; border:1px solid var(--line)!important; border-radius:10px!important; font:500 12px/1.5 var(--font-ui); font-variant-numeric:tabular-nums; white-space:nowrap; color:var(--text); }
html:root body.portfolio-profile .factor-contribution-cell.is-empty { background:var(--empty-cell); color:var(--muted); }
/* Monthly and contribution cells share 12px figures, including the daily portfolio. */
html:root body:is(.portfolio-profile,.daily-profile) .rp-app-shell :is(#performance,#profile-performance) :is(.managed-heatmap-cell,.heatmap-cell,.rp-month-cell,.managed-heatmap-label,.heatmap-month-label,.managed-heatmap-year,.heatmap-year,.managed-heatmap-total,.heatmap-total,.rp-month-row > :first-child,.rp-month-row > strong:last-child,.rp-month-row.is-head > span),
html:root body.daily-profile .rp-app-shell #performance :is(.rp-month-cell,.rp-month-row > :first-child,.rp-month-row > strong:last-child,.rp-month-row.is-head > span) { font:500 12px/1.5 var(--font-ui); font-variant-numeric:tabular-nums; }
html:root body.portfolio-profile .profile-ui-drawdown-plot { position:relative; }
html:root body.portfolio-profile .profile-ui-drawdown-interactive { user-select:none; -webkit-user-select:none; touch-action:pan-y; border-radius:4px; }
html:root body.portfolio-profile .profile-ui-drawdown-interactive:focus-visible { outline:2px solid var(--rp-blue); outline-offset:4px; }
html:root body.portfolio-profile .profile-ui-drawdown-interactive.is-pointer-focused { outline:0; }
html:root body.portfolio-profile .factor-drawdown-line { stroke:var(--rp-blue); }
html:root body.portfolio-profile .factor-drawdown-area { fill:var(--blue-soft); }
html:root body.portfolio-profile .profile-ui-drawdown-interactive > circle { fill:var(--rp-blue); }
html:root body.portfolio-profile .profile-ui-drawdown-cursor line { stroke:var(--rp-muted); stroke-width:1; stroke-dasharray:3 5; }
html:root body.portfolio-profile .profile-ui-drawdown-cursor circle { fill:var(--rp-blue); stroke:var(--rp-bg); stroke-width:2; }
html:root body.portfolio-profile .profile-ui-drawdown-cursor circle.is-benchmark { fill:var(--chart-ahlyx); }
html:root body.portfolio-profile .profile-ui-drawdown-tooltip { position:absolute; top:12px; left:0; z-index:1; pointer-events:none; box-sizing:border-box; width:240px; max-width:100%; padding:16px; border:1px solid var(--rp-line); border-radius:12px; background:var(--rp-soft); color:var(--rp-text); font:400 13px/1.5 var(--font-ui); }
html:root body.portfolio-profile .profile-ui-drawdown-tooltip > strong { display:block; margin-bottom:10px; font-weight:500; }
html:root body.portfolio-profile .profile-ui-drawdown-tooltip > div { display:flex; justify-content:space-between; gap:18px; margin-top:6px; color:var(--rp-muted); }
html:root body.portfolio-profile .profile-ui-drawdown-tooltip b { color:var(--rp-text); font-weight:500; font-variant-numeric:tabular-nums; }
html:root body.portfolio-profile .profile-ui-drawdown-guide { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px 24px; margin-top:20px; font:400 12px/1.5 var(--font-ui); color:var(--rp-muted); }
html:root body.portfolio-profile .profile-ui-drawdown-legend { display:flex; flex-wrap:wrap; gap:20px; }
html:root body.portfolio-profile .profile-ui-drawdown-legend span { display:flex; align-items:center; gap:8px; }
html:root body.portfolio-profile .profile-ui-drawdown-legend i { display:block; width:20px; border-top:2px solid var(--rp-blue); }
html:root body.portfolio-profile .profile-ui-drawdown-legend i.is-benchmark { border-color:var(--chart-ahlyx); border-top-style:dashed; }
@media(max-width:760px) {
 html:root body.portfolio-profile :is(.rebalance-summary,.factor-drawdown-summary) { grid-template-columns:repeat(2,minmax(0,1fr)); row-gap:24px; }
 html:root body.portfolio-profile :is(.rebalance-stat,.factor-drawdown-stat) { padding:0 16px; }
 html:root body.portfolio-profile :is(.rebalance-stat,.factor-drawdown-stat):nth-child(odd) { padding-left:0; }
 html:root body.portfolio-profile :is(.rebalance-stat,.factor-drawdown-stat):nth-child(even) { border-right:0; padding-right:0; }
 html:root body.portfolio-profile .rebalance-recent { grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px 24px; }
 html:root body.portfolio-profile .factor-analytics__tabs { width:100%; }
 html:root body.portfolio-profile .factor-analytics__head { gap:18px; margin-bottom:24px; }
 html:root body.portfolio-profile .factor-analytics__panel-head { flex-direction:column; }
 html:root body.portfolio-profile .factor-active-row { grid-template-columns:minmax(90px,1fr) minmax(64px,1fr) 60px; gap:8px; }
 html:root body.portfolio-profile .factor-flow-map { grid-template-columns:76px minmax(0,1fr) 76px; gap:8px; }
}
