:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-deep: #f7f8fa;
  --panel: #f1f3f7;
  --panel-soft: #f7f8fa;
  --line: #d6dbe3;
  --line-soft: #e5e8ed;
  --text: #191c22;
  --muted: #535c69;
  --muted-2: #626c79;
  --green: #1e6d52;
  --red: #a34560;
  --blue: #253fc7;
  --blue-soft: #edf1ff;
  --green-soft: #edf7f2;
  --red-soft: #fcf0f2;
  --accent-fill: #253fc7;
  --accent-text: #ffffff;
  --chart-portfolio: #253fc7;
  --chart-ahlyx: #098577;
  --chart-aqmix: #6b7481;
  --chart-grid: #d6dce6;
  --empty-cell: #f3f5f8;
  --stripe: #f8f9fb;
  --track: #e4e8f0;
  --managed-monthly-positive-rgb: 37,63,199;
  --managed-monthly-negative-rgb: 83,92,105;
  --font-ui: "Roboto", Arial, sans-serif;
  --font-display: "League Gothic", "Arial Narrow", sans-serif;
  --content-width: 1480px;
  --sticky-height: 108px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0d0f;
  --bg-deep: #12161a;
  --panel: #12161a;
  --panel-soft: #101419;
  --line: #26303a;
  --line-soft: #1d252d;
  --text: #edf1f7;
  --muted: #d7dee7;
  --muted-2: #ced8e2;
  --green: #b5d4ff;
  --red: #eee3d4;
  --blue: #bfdcff;
  --blue-soft: #182433;
  --green-soft: #182433;
  --red-soft: #24221f;
  --accent-fill: #23384f;
  --accent-text: #d2e1f5;
  --chart-portfolio: #bfdcff;
  --chart-ahlyx: #eee3d4;
  --chart-aqmix: #b6c2cf;
  --chart-grid: #25303a;
  --empty-cell: #15191e;
  --stripe: #11161b;
  --track: #202932;
  --managed-monthly-positive-rgb: 181,212,255;
  --managed-monthly-negative-rgb: 238,227,212;
}


/* Shared portfolio presentation; portfolio data and layout logic remain page-owned. */
html, body { background: var(--bg); color: var(--text); }
body, button, input, select, .font-mono { font-family: var(--font-ui); }
body { font-size: 14px; line-height: 1.5; }
h1, .brand-title strong { font: 400 48px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: 0; }
h2, .section-head h2, .managed-section-head h2, .managed-breakdown-head h2, .factor-analytics__head h2 { font: 400 28px/1.1 var(--font-display); text-transform: uppercase; letter-spacing: 0; }
h3, .factor-analytics__panel-head h3 { font: 600 18px/1.3 var(--font-ui); text-transform: none; letter-spacing: 0; }
.brand-title span { font-size: 15px; font-weight: 400; }
.topbar { position: relative; top: auto; padding: 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.book-meta, .book-meta span { font-size: 12px; font-weight: 400; color: var(--muted); }
.book-meta b { font-size: 13px; font-weight: 500; }
.topbar .book-live .live-primary strong { font-size: 30px; font-weight: 500; }
.topbar .book-live .live-primary span { font-size: 12px; font-weight: 400; }
.performance-panel, .allocation-panel, .managed-monthly, .managed-breakdown, .factor-analytics { padding: 28px 24px; border-radius: 0; background: var(--bg); box-shadow: none; border-bottom: 1px solid var(--line); }
.section-head { margin-bottom: 18px; }
.comparison-head { padding: 12px; font-size: 12px; font-weight: 500; background: var(--panel); color: var(--muted); }
.comparison-row { min-height: 52px; padding: 12px; }
.comparison-row:nth-child(odd) { background: var(--stripe); }
.comparison-row.is-portfolio { background: var(--blue-soft); }
.comparison-name { font-size: 14px; font-weight: 600; }
.comparison-stat strong { font-size: 15px; font-weight: 500; }
.chart-title strong, .sector-allocation-head strong { font: 600 18px/1.3 var(--font-ui); text-transform: none; }
.chart-span, .chart-legend, .quote-note, .coverage-note, .asof-label, .allocation-summary, .managed-history-span { font-size: 12px; color: var(--muted); font-weight: 400; }
.history-chart text, .factor-chart-axis { fill: var(--muted); font-family: var(--font-ui); }
.range-control, .range-button { border-radius: 0; box-shadow: none; }
.range-control { background: var(--bg); border: 1px solid var(--line); }
.range-button { min-height: 38px; font-size: 12px; color: var(--muted); background: transparent; }
.range-button.active, .factor-analytics__tab.is-active { background: var(--accent-fill); color: var(--accent-text); box-shadow: none; }
.asset-tile, .asset-tile.is-up, .asset-tile.is-down { background: var(--bg); border-color: var(--line); border-radius: 0; animation: none; }
.asset-tile:hover { background: var(--blue-soft); border-color: var(--blue); transform: none; }
.asset-tile.is-up span, .positive { color: var(--green); }
.asset-tile.is-down span, .negative { color: var(--red); }
.heat-dot.up { background: var(--green); }
.heat-dot.down { background: var(--red); }
.allocation-mosaic { min-height: 0; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); grid-auto-rows: 72px; max-height: 470px; gap: 0; }
.asset-tile strong { font-size: 14px; }
.asset-tile span { font-size: 12px; }
.managed-heatmap-cell { height: 36px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.managed-heatmap-cell.is-empty { background: var(--empty-cell); border-color: var(--line-soft); }
[data-theme="dark"] .managed-heatmap-cell:not(.is-empty) { --managed-monthly-alpha: clamp(.08, calc(.08 + var(--monthly-magnitude, 0) * 1.28), .72); border-color: var(--line) !important; }
.managed-heatmap-label, .managed-heatmap-year, .managed-heatmap-total { font-size: 12px; color: var(--muted); }
table { font-variant-numeric: tabular-nums; }
thead, .managed-breakdown thead { background: var(--panel); }
th, .managed-breakdown th { color: var(--muted); font-size: 12px; font-weight: 500; }
td, .managed-breakdown td { font-size: 13px; font-weight: 500; }
tbody tr:nth-child(even) { background: var(--stripe); }
tbody tr:hover { background: var(--blue-soft); }
.managed-search input, .managed-sector-select, .managed-export { background: var(--bg); color: var(--text); border-color: var(--line); border-radius: 0; min-height: 42px; font-size: 12px; }
.factor-analytics__tabs { background: var(--bg); border-radius: 0; }
.factor-analytics__tab { border-radius: 0; min-height: 42px; font-size: 12px; font-weight: 500; }
.factor-analytics__stage { min-height: 0; }
.factor-active-label strong, .factor-active-value { font-size: 13px; }
.factor-active-label span { font-size: 12px; }
.nav-rail, .terminal-sidebar, .terminal-header { background: var(--panel); color: var(--text); border-color: var(--line); }
.nav-link:hover, .nav-link.active { background: var(--blue-soft); color: var(--blue); }
.terminal-card { background: var(--bg); border: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.terminal-card:hover { border-color: var(--blue); background: var(--panel-soft); box-shadow: none; }
.portfolio-theme-switch { position: fixed; right: 20px; bottom: 20px; z-index: 90; width: 42px; height: 42px; display: grid; place-items: center; background: var(--panel); color: var(--text); border: 1px solid var(--line); cursor: pointer; }
.portfolio-theme-switch svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.portfolio-theme-switch .theme-sun, [data-theme="dark"] .portfolio-theme-switch .theme-moon { display: none; }
[data-theme="dark"] .portfolio-theme-switch .theme-sun { display: block; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
@media(min-width:1181px) { .app-shell { width: min(1480px, calc(100% - 120px)); margin-left: 96px; } }
@media(max-width:760px) {
 h1, .brand-title strong { font-size: 38px; }
 .topbar { grid-template-columns: 1fr; padding: 24px 16px; }
 .performance-panel, .allocation-panel, .managed-monthly, .managed-breakdown, .factor-analytics { padding: 24px 16px; }
 .comparison-stat span { font-size: 11px; font-weight: 500; }
 .comparison-head { display: none; }
 .allocation-mosaic { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); min-height: 0; }
 .book-meta { flex-wrap: wrap; gap: 12px; }
 .portfolio-theme-switch { right: 12px; bottom: 12px; }
}

.overview .performance-panel, .overview .allocation-panel { border-radius: 0; border-color: var(--line); padding: 28px 24px; }
.performance-panel .section-head h2, .allocation-panel .section-head h2 { font-size: 28px; }
.monthly-returns { border-radius: 0; background: var(--bg); border-color: var(--line); padding: 24px; }
.heatmap-cell { height: 36px; border-radius: 10px; color: var(--text); font-size: 12px; font-weight: 500; }
.heatmap-cell.is-empty { background: var(--empty-cell); border-color: var(--line); }
.heatmap-month-label, .heatmap-year, .heatmap-total { font-size: 12px; color: var(--muted); }
.heatmap-legend .gain { background: var(--green); }
.heatmap-legend .loss { background: var(--red); }
.chart-legend span:nth-child(2) i { background: var(--chart-ahlyx); }
.chart-legend span:nth-child(3) i { background: var(--chart-aqmix); }
.factor-waterfall-positive { fill: var(--green); }
.factor-waterfall-negative { fill: var(--red); }
.factor-drawdown-area { fill: var(--red-soft); }
.factor-drawdown-benchmark { stroke: var(--chart-ahlyx); }
.chart-tooltip { background: var(--panel); color: var(--text); border-color: var(--line); border-radius: 0; }
:root { --amber: #7b8491; }
:root[data-theme="dark"] { --amber: #d4dfed; }
@media(max-width:760px) { .overview .performance-panel, .overview .allocation-panel, .monthly-returns { padding: 24px 16px; } }
.chart-wrap { background: var(--bg); }
.chart-area { fill: var(--green-soft); }
.chart-grid, .factor-chart-grid { stroke: var(--chart-grid); }
.chart-benchmark { opacity: .85; }
.breakdown, .history-lab, .rebalance-panel { background: var(--bg); border-color: var(--line); border-radius: 0; }
.breakdown td.positive, .breakdown td.negative { background: transparent; }

/* Portfolio masthead shared with Macro Regimes. */
.site-header, .portfolio-masthead { background: #111215; color: #fff; }
[data-theme="dark"] .site-header, [data-theme="dark"] .portfolio-masthead { background: var(--panel); color: var(--text); }
.site-header { position: relative; z-index: 60; }
.site-header-inner, .portfolio-band-inner { width: min(1480px, calc(100% - 64px)); margin-inline: auto; }
.site-header-inner { height: 78px; display: flex; align-items: center; justify-content: space-between; gap: 24px; border-bottom: 1px solid #383a40; }
[data-theme="dark"] .site-header-inner { border-color: var(--line); }
.site-brand { display: flex; align-items: center; gap: 18px; font: 400 32px/1 var(--font-display); }
.site-brand span { max-width: 100px; padding-left: 18px; border-left: 1px solid #777b83; font: 11px/1.5 var(--font-ui); text-transform: uppercase; }
.site-links { display: flex; align-items: center; gap: 32px; font-size: 12px; font-weight: 600; }
.site-links > a:hover { text-decoration: underline; text-underline-offset: 5px; }
.site-links button { display: grid; place-items: center; flex: 0 0 42px; width: 42px; height: 42px; padding: 0; border: 1px solid #62676e; border-radius: 0; background: transparent; color: inherit; cursor: pointer; }
[data-theme="dark"] .site-links button { border-color: var(--line); }
.site-links button:hover { background: #ffffff0c; }
.site-links svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.site-links .theme-sun, [data-theme="dark"] .site-links .theme-moon { display: none; }
[data-theme="dark"] .site-links .theme-sun { display: block; }
.portfolio-masthead { padding: 24px 0; }
.masthead-eyebrow { margin: 0 0 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; color: #bac3d5; }
.portfolio-masthead h1 { margin: 0; font: 400 48px/1.1 var(--font-display); text-transform: uppercase; }
.masthead-description { margin: 12px 0 0; font-size: 15px; color: #dce0e7; }
.masthead-meta { display: flex; flex-wrap: wrap; gap: 12px 28px; margin-top: 16px; color: #b9c0ce; font-size: 12px; }
.masthead-meta b { margin-left: 8px; font-weight: 500; color: #fff; }
[data-theme="dark"] .masthead-eyebrow, [data-theme="dark"] .masthead-meta { color: var(--muted); }
[data-theme="dark"] .masthead-description, [data-theme="dark"] .masthead-meta b { color: var(--text); }
body .app-shell, body.nav-expanded .app-shell { width: 100%; max-width: none; margin: 0 0 48px; }
.app-shell > :not(.portfolio-masthead) { width: min(1480px, calc(100% - 64px)); margin-inline: auto; }
.portfolio-live-band { padding: 24px 0; border-bottom: 1px solid var(--line); }
.portfolio-live-band .book-live { justify-content: start; grid-template-columns: repeat(2, minmax(140px, 220px)); gap: 32px; }
.portfolio-live-band .live-primary strong { font-size: 30px; font-weight: 500; }
.portfolio-live-band .live-primary span { font-size: 12px; font-weight: 400; }
.portfolio-live-band .live-primary-secondary { padding-left: 32px; }
body .nav-rail { position: absolute; inset: 78px 0 auto auto; z-index: 70; width: min(360px, 100%); height: auto; max-height: calc(100dvh - 78px); padding: 24px; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); box-shadow: none; }
body .nav-rail:not(.is-expanded) { display: none; }
body .nav-rail.is-expanded { display: block; width: min(360px, 100%); }
body .nav-rail .nav-brand { display: none; }
body .nav-rail .nav-links { display: grid; gap: 0; }
body .nav-rail .nav-link { display: flex; min-width: 0; min-height: 44px; gap: 14px; padding: 10px 8px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; font-size: 13px; }
body .nav-rail .nav-link span { display: inline; opacity: 1; width: auto; }
body .nav-rail .nav-link svg { width: 18px; height: 18px; flex: 0 0 18px; }
@media(max-width:760px) {
 .site-header-inner, .portfolio-band-inner, .app-shell > :not(.portfolio-masthead) { width: calc(100% - 32px); }
 .site-header-inner { height: 68px; }
 .site-brand { font-size: 29px; gap: 12px; }
 .site-brand span { padding-left: 12px; font-size: 9px; }
 .site-links { gap: 8px; }
 .site-links > a { display: none; }
 .site-links button { width: 38px; height: 38px; flex-basis: 38px; }
 .portfolio-masthead h1 { font-size: 38px; }
 .masthead-meta { gap: 7px 18px; font-size: 11px; }
 .portfolio-live-band .book-live { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 20px; }
 .portfolio-live-band .live-primary-secondary { padding-left: 20px; }
 body .nav-rail { top: 68px; max-height: calc(100dvh - 68px); }
}
@media(max-width:360px) { .site-brand span { display: none; } }

/* Keep current returns alongside the masthead, as on the original portfolios. */
.portfolio-masthead .portfolio-band-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 40px; }
.portfolio-masthead .masthead-eyebrow, .portfolio-masthead h1, .portfolio-masthead .masthead-description, .portfolio-masthead .masthead-meta { grid-column: 1; }
.portfolio-masthead .book-live { grid-column: 2; grid-row: 1 / 5; align-self: center; display: grid; grid-template-columns: auto auto; gap: 24px; margin: 0; padding: 0; }
.portfolio-masthead .live-primary { gap: 7px; }
.portfolio-masthead .live-primary span { font-size: 12px; font-weight: 400; color: #dce0e7; }
.portfolio-masthead .live-primary strong { font-size: 30px; font-weight: 500; white-space: nowrap; }
.portfolio-masthead .live-primary-secondary { padding-left: 24px; border-left: 1px solid #383a40; }
.portfolio-masthead .live-primary-secondary strong { font-size: 24px; }
[data-theme="dark"] .portfolio-masthead .live-primary span { color: var(--muted); }
[data-theme="dark"] .portfolio-masthead .live-primary-secondary { border-color: var(--line); }
:root[data-theme="light"] .portfolio-masthead .live-primary strong.positive { color: #b5d4ff; }
:root[data-theme="light"] .portfolio-masthead .live-primary strong.negative { color: #eee3d4; }
@media(max-width:760px) {
 .portfolio-masthead .portfolio-band-inner { grid-template-columns: minmax(0, 1fr); }
 .portfolio-masthead .book-live { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 24px; }
}

@media (min-width: 761px) {
  .portfolio-masthead .book-live { margin-right: 15px; }
}
