/* Uses the existing type and colour tokens; only layout, hierarchy and navigation. */
/* ETF views drawn by etf.js (plain screens, 15 Oct 2026): a short summary first, detail behind disclosures. */
.etf-report { padding-top: 12px; min-width: 0; }
.etf-result-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 6px 20px; flex-wrap: wrap; margin: 4px 0 14px; }
.etf-result-head h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.3px; }
.etf-result-head p { margin: 0; }
.etf-figures { margin: 0 0 10px; }
.glance.etf-figures .g-sub { white-space: normal; overflow: visible; }  /* short captions may wrap on phones */
.etf-figure .g-value.pos { color: var(--pos); } .etf-figure .g-value.neg { color: var(--neg); }
.etf-report > h3 { margin: 22px 0 10px; font-size: 16px; }
.etf-report > .help { margin: 0 0 14px; }
.etf-line { margin: 12px 0; font-size: 14px; max-width: 75ch; line-height: 1.6; }
.etf-more { margin-top: 4px; }
.etf-more .broker-disclosure-body > .help { max-width: 75ch; line-height: 1.6; }
.etf-more h4 { margin: 14px 0 8px; font-size: 14px; }
.etf-secondary .glance-card { background: var(--inset); border-color: transparent; box-shadow: none; }
.etf-report .table-wrap { max-width: 100%; }
.etf-report th { white-space: normal; min-width: 100px; }
.etf-report td { font-variant-numeric: tabular-nums; }
.etf-holding { margin: 12px 0; }
.etf-holding summary { cursor: pointer; line-height: 1.8; }
.equity-history { padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; min-width: 0; }
.history-header { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; }
.history-readout { display: grid; gap: 5px; font-variant-numeric: tabular-nums; }
.history-readout strong { font-size: clamp(24px,2.2vw,30px); font-weight: 500; line-height: 1.3; }
.history-details { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 12px; color: var(--text-2); }
.history-details b { font-weight: 500; color: var(--text); }
.history-ranges { display: flex; flex-wrap: wrap; gap: 3px; padding: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 9px; }
.history-ranges button { padding: 7px 10px; border: 0; background: transparent; color: var(--text-2); font-size: 13px; }
.history-ranges button[aria-pressed=true] { background: var(--surface); color: var(--link); box-shadow: 0 1px 4px #0001; }
.equity-history svg { display: block; width: 100%; margin-top: 18px; touch-action: pan-y; cursor: crosshair; outline: none; }
.equity-history svg:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; border-radius: 4px; }
.history-grid { stroke: var(--border); stroke-dasharray: 3 5; }
.history-axis { fill: var(--text-2); font-family: inherit; font-size: 11px; }
.history-line { fill: none; stroke: var(--link); stroke-width: 2; stroke-linejoin: round; }
.history-fill { fill: var(--link); opacity: .06; }
.history-baseline { stroke: var(--text-2); stroke-dasharray: 6 4; opacity: .65; }
.history-drawdown { fill: var(--neg); opacity: .3; }
.history-cross { stroke: var(--text-2); stroke-dasharray: 4 4; opacity: .6; }
.history-dot { fill: var(--link); stroke: var(--surface); stroke-width: 2; }
.history-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 0 0; margin-top: 8px; border-top: 1px solid var(--border); }
.history-date { margin-right: auto; font-size: 13px; color: var(--text-2); }
.history-date span { color: var(--text); font-weight: 500; }
.history-stepper { display: flex; align-items: center; gap: 6px; }
.history-controls input { width: 146px; min-width: 0; max-width: 100%; height: 36px; margin: 0; font-size: 13px; }
.history-controls button { min-height: 36px; font-size: 12px; padding: 7px 10px; }
.history-comparisons { display: flex; flex-wrap: wrap; gap: 10px 20px; font-size: 12px; margin-top: 12px; font-variant-numeric: tabular-nums; }
.history-comparisons:empty { display: none; }
.history-comparisons i { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; }
.history-caption { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: 11px; color: var(--text-2); }
@media (max-width:600px) {
  .equity-history { padding: 16px 12px; }
  .history-header { flex-direction: column; gap: 14px; }
  .history-ranges { align-self: stretch; justify-content: space-between; }
  .history-controls { gap: 8px; }
  .history-date { flex: 1; }
  .history-stepper { order: 2; width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
  .history-stepper input { grid-column: 1 / -1; grid-row: 1; width: 100%; }
  .history-controls button { padding: 8px 6px; }
}
body[data-page] main { max-width: none; }
main > .lead { max-width: 100ch; }
.skip-main { position: fixed; top: 8px; left: 8px; transform: translateY(-160%); z-index: 100; padding: 10px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; }
.skip-main:focus { transform: none; }
.nav-section { margin: 14px 12px 6px; font-size: 11px; font-weight: 500; color: var(--text-2); letter-spacing: .04em; }
.page-finder-button { display: inline-flex; align-items: center; gap: 22px; color: var(--text-2); border-color: var(--border); }
.page-finder-button kbd { font: inherit; font-size: 11px; border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; }
#page-finder { width: min(540px, calc(100vw - 32px)); }
#page-finder .body { padding: 22px; }
#page-matches { display: grid; gap: 4px; max-height: 48vh; overflow-y: auto; margin: 10px 0; }
#page-matches a { display: flex; flex-direction: column; padding: 10px 12px; border-radius: 8px; text-decoration: none; color: var(--text); }
#page-matches a:hover, #page-matches a:focus-visible { background: var(--sel-bg); color: var(--sel-text); }
#page-matches small { color: var(--text-2); font-size: 12px; }
.workspace-tools { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 18px 0 22px; }
.workspace-links { display: flex; gap: 8px; flex-wrap: wrap; }
.workspace-guide { position: relative; flex: 0 0 auto; max-width: 100%; }
.workspace-guide > summary { padding: 7px 0; color: var(--link); cursor: pointer; font-size: 13px; }
.workspace-guide > div { position: absolute; top: 100%; right: 0; width: 380px; max-width: calc(100vw - 48px); padding: 16px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); z-index: 4; font-size: 13px; }
.workspace-guide ol { margin: 0 0 12px; padding-left: 20px; }
.workspace-guide li + li { margin-top: 8px; }
.section-links { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.section-links > span { font-size: 12px; color: var(--text-2); margin: 0 10px 0 0; }
.section-links a { padding: 4px 9px; border-radius: 6px; font-size: 13px; text-decoration: none; }
.section-links a:hover { background: var(--sel-bg); }
.workspace-tools a[aria-disabled=true], .section-links a[aria-disabled=true] { opacity: .5; cursor: default; }
main :is(h2[id], section[id], div[id].tabs) { scroll-margin-top: 80px; }
.workspace-sample { padding: 12px 18px; }
.workspace-sample > summary { color: var(--text-2); font-size: 13px; cursor: pointer; }
.workspace-sample p { margin-bottom: 0; }
.step-marker { display: inline-grid; place-items: center; width: 26px; height: 26px; margin-right: 8px; background: var(--sel-bg); color: var(--sel-text); border-radius: 8px; font-size: 13px; }
body[data-page=backtest] .bt-run { border-top: 0; padding-top: 4px; }
body[data-page=backtest] .bt-periods { flex-basis: 100%; }
body[data-page=backtest] #periods { width: fit-content; max-width: 100%; flex-wrap: wrap; }
body[data-page=backtest] #run { min-width: 160px; }
.report-ranges { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; }
.report-ranges .help { margin-left: 4px; }
.notification-filters, .guide-search .row { align-items: flex-end; gap: 12px; }
.notification-filters label:first-child { flex: 3 1 240px; }
.notification-filters label:nth-child(2) { flex: 1 1 180px; }
.customer-search { max-width: 520px; margin: 12px 0; }
.guide-search { max-width: none; }
.guide-search input { width: 100%; }
.guide-index .row { gap: 8px; }
.guide-index a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; font-size: 13px; }
.guide-index a:hover { background: var(--sel-bg); }
body[data-page=help] main > section:not(.guide-search) :is(p, ol, ul) { max-width: 100ch; }
body[data-page=help] main > section[id] { padding: 24px; }
body[data-page=account] main > section p { max-width: 90ch; }
.notification-filters + p { margin-bottom: 0; }
/* Keep filtered rows and guides hidden even where a component sets display. */
.guide-index a[hidden], main > section[hidden], tbody tr[hidden] { display: none; }
@media (min-width: 901px) {
  html.nav-collapsed .nav-section { height: 1px; background: var(--border); font-size: 0; margin: 12px 6px; }
}
@media (max-width: 900px) {
  .nav-section { margin-top: 10px; }
  .workspace-tools { flex-direction: column; gap: 8px; margin: 12px 0 18px; }
  .workspace-guide { width: 100%; }
  .workspace-guide > div { position: static; width: 100%; max-width: none; margin: 6px 0; }
  .workspace-links .button { min-height: 40px; }
  .section-links { gap: 4px; padding: 8px; }
  .section-links a { padding: 6px 8px; }
  .page-finder-button { padding: 4px 8px; min-height: 36px; white-space: nowrap; }
  .page-finder-button kbd { display: none; }
  .topbar .tools { gap: 6px; }
  body[data-page=backtest] #run { margin-left: 0; flex: 1 1 100%; }
  body[data-page=help] main > section[id] { padding: 18px; }
  .notification-filters > button, .guide-search .row > button { min-height: 40px; }
}

/* Simulator working states: visible actions, compact analysis and clear next steps. */
.sim-app { height: auto; min-height: 0; }
.sim-step-title { font-size: 15px; margin: 0 0 12px; }
.sim-toolbar { align-items: center; }
.sim-steps { margin: 0; }
.sim-run { margin-left: auto; }
.sim-more-time { position: relative; font-size: 13px; }
.sim-more-time summary { padding: 8px; cursor: pointer; }
.sim-more-time > div { position: absolute; z-index: 8; top: 100%; right: 0; width: 290px; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
.sim-chain-help, .sim-analysis-help { margin: 0 0 12px; }
.sim-left, .sim-right { min-width: 0; }
.sim-right { overflow: visible; }
.sim-info > .state { grid-column: 1 / -1; }
.sim-info > button { justify-self: start; align-self: center; }
.sim-app .chain-wrap { flex: 1 1 auto; height: 0; min-height: 620px; max-height: none !important; }
.sim-app .chain td.edge .acts { display: inline-flex; opacity: 0; pointer-events: none; }
.sim-app .chain tr:hover td.edge .acts, .sim-app .chain tr:focus-within td.edge .acts { opacity: 1; pointer-events: auto; }
.sim-app .chain td.edge { position: relative; }
.sim-app .chain td.edge .held { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.sim-app .chain tr:hover td.edge .held, .sim-app .chain tr:focus-within td.edge .held { display: none; }
.sim-leg-actions { display: inline-flex; align-items: center; gap: 6px; }
.sim-app .chain tr:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.sim-app .chain .tiny { min-width: 25px; min-height: 28px; }
.sim-app .chain-stats { display: flex; flex-wrap: wrap; }
.sim-view { min-height: 0; }
.sim-right .payoff-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.sim-right .payoff-summary[hidden] { display: none; }
.sim-right .payoff-summary > span { min-width: 0; white-space: normal; overflow-wrap: anywhere; padding: 8px 10px; background: var(--inset); border-radius: 8px; }
.sim-right .payoff-summary b { display: block; margin: 3px 0 0; font-size: 15px; }
.sim-position-link { font-size: 13px; white-space: nowrap; }
.sim-app .positions-area, #sim-analysis, #chain-h, #controls { scroll-margin-top: 80px; }
.sim-jumps { display: flex; flex-wrap: wrap; gap: 8px; }
.sim-jumps a { padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; font-size: 13px; }
@media (max-width: 1100px) {
  .sim-app .chain-wrap { flex: none; height: 480px; min-height: 300px; max-height: 70vh !important; }
  .sim-jumps { position: sticky; bottom: 66px; z-index: 6; justify-content: center; background: var(--surface); padding: 8px; border: 1px solid var(--border); border-radius: 10px; }
}
@media (max-width: 600px) {
  .sim-right .payoff-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sim-pane-head { flex-wrap: wrap; }
  .sim-more-time > div { right: auto; left: 0; }
  .sim-steps { gap: 2px; }
  .sim-steps input[type=date] { width: 135px; }
  .sim-jumps { gap: 2px; padding: 4px; }
  .sim-jumps a { padding: 7px; border: 0; }
}

body[data-page=backtest] #results section[id] { scroll-margin-top: 80px; }
.mix-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
@media (max-width: 600px) { .mix-item { flex-wrap: wrap; } .mix-item .check { flex-basis: 100%; } }

/* Compact simulator header and semantic figures, using the existing theme tokens. */
.sim-page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 12px; }
.sim-page-head h1 { margin: 0; }
.sim-page-head p { margin: 2px 0 0; }
.sim-page-tools .workspace-tools { margin: 0; align-items: center; gap: 16px; }
.sim-step-title { margin-bottom: 6px; }
.sim-top #feed-status { margin: 2px 0 0; font-size: 12px; }
.sim-top #live-controls { gap: 8px; }
.sim-app .chain td { padding-top: 6px; padding-bottom: 6px; }
.sim-right .payoff-summary b.pos { color: var(--pos); }
.sim-right .payoff-summary b.neg { color: var(--neg); }
.sim-right .payoff-summary b.zero { color: var(--text); }
.model-workspace-nav { padding: 10px 12px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.model-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.model-tabs button { border-color: transparent; background: transparent; color: var(--text-2); padding: 7px 12px; }
.model-tabs button[aria-selected=true] { background: var(--sel-bg); color: var(--sel-text); }
.model-workspace-nav p { margin: 8px 4px 0; }
.model-context { margin: 0 0 12px; }
#model > [role=tabpanel][hidden] { display: none; }
#model > [role=tabpanel]:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
@media (max-width: 900px) {
  .sim-page-tools { width: 100%; }
  .sim-page-tools .workspace-tools { flex-direction: row; flex-wrap: wrap; gap: 4px 12px; }
  .sim-page-tools .workspace-guide { width: auto; }
  .sim-page-tools .workspace-guide[open] { width: 100%; }
  .model-tabs button { padding: 8px 10px; }
}

.model-report-head { margin: 16px 0; }
.model-report-head h2 { margin-bottom: 4px; }
.model-edit-mix, .model-comparison-details { margin: 0 0 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.model-edit-mix > summary, .model-comparison-details > summary { padding: 12px 16px; cursor: pointer; color: var(--link); }
.model-edit-mix .panel, .model-comparison-details .panel { margin: 0; border: 0; box-shadow: none; }
.chart-readout { background: var(--inset); padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.chart-readout.kv b.pos { color: var(--pos); } .chart-readout.kv b.neg { color: var(--neg); }
.model-chart .cross { stroke: var(--text-2); stroke-dasharray: 4 4; pointer-events: none; }
.model-chart:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.result-detail-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 10px; }
.etf-live { margin-bottom: 24px; }
.etf-workspace-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 12px 0 24px; }
.etf-workspace-head .tabs { margin: 0; }
.etf-capital-controls { margin-bottom: 24px; }
.etf-capital-controls .row { margin-top: 10px; flex-wrap: wrap; }
.etf-capital-controls input { width: 220px; max-width: 100%; }
@media(max-width:600px) { .etf-workspace-tabs { width: 100%; overflow-x: auto; } .etf-workspace-tabs button { white-space: nowrap; } .etf-capital-controls .row > * { width: 100%; } }
.etf-live > button, .etf-live > a { margin: 8px 12px 8px 0; }
/* ETF setup: three steps. Wide screens stack them; phones show one at a time with Continue / Back. */
.etf-steps { display: grid; gap: 12px; margin: 8px 0 14px; }
.etf-step { padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); min-width: 0; }
.etf-step h4 { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; font-size: 16px; font-weight: 500; }
.etf-step h4:focus { outline: none; }
.etf-step h4:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }
.etf-step-n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px;
  background: var(--inset); border: 1px solid var(--border); }
.etf-step > p { margin: 0 0 12px; max-width: 70ch; }
.etf-amount { align-items: center; margin: 6px 0 10px; }
.etf-amount input { width: 220px; max-width: 100%; margin: 0; }
.etf-result p { margin: 6px 0; }
.etf-verdict { font-weight: 500; font-size: 15px; }
.etf-link { border: 0; background: none; padding: 0; min-height: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; }
.etf-link:hover { background: none; }
.etf-consent { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--inset);
  margin: 14px 0 6px; line-height: 1.5; font-size: 14px; max-width: 800px; }
.etf-consent input[type=checkbox] { flex: 0 0 18px; width: 18px; height: 18px; margin: 2px 0 0; }
.etf-step-nav { display: none; gap: 8px; justify-content: space-between; margin-top: 14px; }
.etf-step-nav > .primary { margin-left: auto; }
.etf-step-nav .quiet, .etf-actions .quiet, .etf-card-head .quiet { border-color: transparent; background: transparent; color: var(--link); }
.etf-step-nav .quiet:hover, .etf-actions .quiet:hover, .etf-card-head .quiet:hover { background: var(--inset); }
/* ETF status after enrolment: one card */
.etf-card { display: grid; gap: 12px; }
.etf-card-head { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.etf-card-head > button { margin-left: auto; }
.etf-problem { margin: 0; padding: 10px 12px; border: 1px solid var(--neg); border-radius: 10px; background: var(--neg-fill); font-size: 14px; }
.etf-card .etf-figures { margin: 0; }
.etf-actions { align-items: center; }
@media (max-width: 760px) {
  .etf-step:not(.on) { display: none; }
  .etf-step-nav { display: flex; }
  .etf-step { padding: 14px; }
  .etf-amount { flex-wrap: nowrap; }
  .etf-amount input { flex: 1 1 0; width: auto; min-width: 0; }
  .etf-step > button.primary { width: 100%; }
  .etf-actions > * { flex: 1 1 auto; }
}

/* Touch screens (phone sweep, 16 Oct 2026): "How to use this page" and its guide link at least 44 px tall */
@media (pointer: coarse) {
  .workspace-guide > summary { display: flex; align-items: center; min-height: 44px; padding-block: 0; }
  .workspace-guide > div > a { display: inline-flex; align-items: center; min-height: 44px; }
}

/* Touch screens (phone sweep 2, 16 Oct 2026): "On this page" links and the simulator's jump link 44 px tall */
@media (pointer: coarse) {
  .section-links a, .sim-position-link { display: inline-flex; align-items: center; min-height: 44px; }
}
