/* Portfolio Margin Engine demo. Loaded after style.css and demo.css: everything the two demos
   share comes from those, and this file adds what only this one needs — the Roll-Up pane with
   its outline of groups and its table of scenarios. */

:root { --posc: 111, 214, 162; --solid: #051327; }

/* ---------- inputs ---------- */
/* Symbols with a price and a yield, and house stress ranges: a small grid of type-over fields. */
.grid-head, .grid-row { display: grid; gap: 8px; align-items: center; }
.grid-head { margin-bottom: 6px; font-size: 12.5px; color: var(--dim); }
.grid-row + .grid-row { margin-top: 6px; }
.grid-row b { font-weight: 500; font-size: 15px; letter-spacing: .03em; }
.ul-grid { grid-template-columns: 84px minmax(0, 1fr) minmax(0, 1fr); }
.hs-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 26px; }
.pane .grid-row input { text-align: right; padding: 7px 11px; font-size: 13.5px; }
.pane .grid-row input[data-h="id"] { text-align: left; }
.group + .hint { margin-top: 18px; }
.fgrid.cfg { grid-template-columns: minmax(0, 170px) minmax(0, 250px); }
.editor .bad-note { color: var(--neg); }

.info { padding-top: 6px; max-width: 46em; }
.info h3 { margin: 22px 0 8px; font-weight: 500; font-size: 17px; letter-spacing: -.015em; }
.info p { font-size: 15px; line-height: 1.55; color: var(--dim); }
.info p + p { margin-top: 8px; }
.info b { font-weight: 500; color: var(--ink); }
.info a { color: var(--accent); }
.info a:hover { color: var(--ink); }

/* ---------- the account's result ---------- */
/* The house figure and the time sit beside the headline figure, flush right, when there is room.
   When there is not they drop under it, flush left; pm.js marks that case (fitHead). Beside it they
   stand on its baseline (on its bottom edge in a browser that does not know last baseline). */
#result .headline { column-gap: 16px; align-items: last baseline; }
#result .hside .mini { gap: 20px; text-align: right; }
#result .hside.below .mini { text-align: left; }
#result .hside .mini dd { font-size: 16px; color: var(--ink); }
#result .hside .mini div:last-child dd { color: var(--dim); }
/* excess, the headline figure and the house one beside it: green above zero, red below */
#result .num.cr, #result .hside .mini dd.cr { color: var(--pos); }
#result .num.db, #result .hside .mini dd.db { color: var(--neg); }
.ledger b.amt { font-weight: 500; }
.ledger b.quiet { color: var(--faint); }
/* The breakdown of the requirement sits under its own label, on the plain pane: only the headline
   and the account's ledger above it are lit. */
.brk { padding-top: 22px; padding-bottom: 24px; }
.brk > .lab { margin-bottom: 2px; }
/* The ledger again as one bar: what is required, then what each level of offsets saved. */
.stack { display: flex; height: 10px; margin-top: 6px; border-radius: 99px; overflow: hidden; background: rgba(213, 225, 240, .08); }
.stack i { display: block; height: 100%; transition: width .6s cubic-bezier(.16, .8, .2, 1); }
.s-net { background: var(--accent); box-shadow: 0 0 14px rgba(var(--glow), .6); }
.s-off { background: repeating-linear-gradient(135deg, rgba(var(--posc), .8) 0 2px, rgba(var(--posc), .16) 2px 5px); }
.s-off.two { background: repeating-linear-gradient(45deg, rgba(var(--posc), .8) 0 2px, rgba(var(--posc), .16) 2px 5px); border-left: 1px solid rgba(var(--bgc), .9); }
.stack-note { margin-top: 10px; font-size: 13.5px; color: var(--faint); }
.stack-note b { font-weight: 500; color: var(--pos); font-family: var(--mono); font-size: 13px; }
.pre { margin-top: 20px; }
.pa { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 30px; align-items: baseline; font-size: 15.5px; }
.pa b { font: 500 16px var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.pa .pa-h { font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); text-align: right; }
.pa .pa-h.l { text-align: left; }
.pa .pa-sub { color: var(--faint); }
.pa .pa-rule { grid-column: 1 / -1; height: 1px; margin: 4px 0; background: var(--rule); }
/* What the excess is made of, under the headline figure: net liquidating value, less each requirement. */
.headline .acc { flex: 0 0 100%; }
.acc .ledger li { padding: 11px 0; }
.acc .ledger li:first-child { border-top: 1px solid var(--rule); }
.acc .ledger li:last-child { padding-bottom: 0; }
/* Net liquidating value is a parent row with its two parts, cash and position value, nested under
   it: indented behind a guide line, smaller and dimmer, with no rule between the three. Their
   figures stay in the ledger's one column. A rule and some room then set the requirements apart. */
.acc .ledger li.whole { padding-bottom: 7px; border-bottom: 0; }
.acc .ledger li.part { margin-left: 3px; padding: 4px 0 4px 15px; border-left: 1px solid rgba(var(--glow), .5); border-bottom: 0; font-size: 14.5px; color: var(--dim); }
.acc .ledger li.part b { font-size: 14.5px; font-weight: 400; color: var(--dim); }
.acc .ledger li.part + li:not(.part) { margin-top: 15px; border-top: 1px solid var(--rule); }
.warns { margin-top: 20px; }
.warns p { padding-left: 14px; border-left: 2px solid rgba(var(--glow), .6); font-size: 14.5px; line-height: 1.5; color: var(--dim); }
.warns p + p { margin-top: 8px; }
/* with reduced motion a new figure glows where it stands */
.fv.go { animation: basis-glow .6s ease-out both; }

/* ---------- the roll-up pane ---------- */
#rollup { position: relative; padding-bottom: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 12.5px; color: var(--dim); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend i { display: block; width: 18px; height: 8px; border-radius: 2px; }
.k-net { background: var(--accent); }
.k-off { background: repeating-linear-gradient(135deg, rgba(var(--posc), .85) 0 2px, rgba(var(--posc), .16) 2px 5px); }
.legend .k-worst { width: 14px; height: 14px; border-radius: 4px; box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 10px rgba(var(--glow), .5); }
.roll { display: grid; grid-template-columns: minmax(0, 384px) minmax(0, 1fr); align-items: stretch; }

/* the outline: one row per group, indented by depth */
.outline { border-right: 1px solid var(--rule); padding: 6px 0 0; display: flex; flex-direction: column; }
.outline > .empty { margin: 20px 26px; }
.ol-head { display: flex; justify-content: space-between; padding: 10px 22px 10px 26px; font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.ol-head span:last-child { text-align: right; }
.ol-head small { display: block; font-size: 10px; letter-spacing: .12em; opacity: .8; }
.node {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; column-gap: 12px; row-gap: 8px; align-items: center; width: 100%;
  padding: 13px 22px 14px calc(26px + var(--d) * 16px); border: 0; border-top: 1px solid var(--rule); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer;
  transition: background .2s, box-shadow .2s;
}
.node:hover { background: rgba(213, 225, 240, .05); }
.node:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.node.sel { background: rgba(var(--glow), .1); box-shadow: inset 3px 0 0 var(--accent); }
.n-name { min-width: 0; }
.n-name b { display: block; font-weight: 500; font-size: 15px; letter-spacing: -.01em; }
.n-name small, .drill small, .d-title small { display: block; margin-top: 3px; font: 10.5px/1.35 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.drill small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node.k-cg .n-name b { font-size: 14px; color: var(--dim); }
.node.k-cg.sel .n-name b, .node.k-cg:hover .n-name b { color: var(--ink); }
.n-fig { text-align: right; }
.n-fig b { display: block; font: 500 14.5px var(--mono); font-variant-numeric: tabular-nums; }
.n-fig small { display: block; margin-top: 3px; font: 11.5px var(--mono); font-variant-numeric: tabular-nums; color: var(--faint); }
.n-fig .dz.out { right: 0; }
.n-roll { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; min-width: 0; }
.n-bar { flex: none; display: flex; width: 132px; height: 6px; }
.n-bar i { display: block; height: 100%; min-width: 2px; transition: width .6s cubic-bezier(.16, .8, .2, 1); }
.n-bar .net { background: var(--accent); border-radius: 2px 0 0 2px; }
.n-bar .off { background: repeating-linear-gradient(135deg, rgba(var(--posc), .85) 0 2px, rgba(var(--posc), .16) 2px 5px); border-radius: 0 2px 2px 0; }
.n-note { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.n-note b { font: 500 12px var(--mono); color: var(--pos); }
/* a group's P&L across the scenarios, small: up from the middle for a gain, down for a loss */
.spark { display: flex; gap: 1px; height: 24px; }
.spark i { display: block; width: 4px; border-radius: 1px; height: calc(var(--h) * 11px); }
.spark .up { align-self: flex-end; margin-bottom: 12px; background: rgba(var(--posc), .75); }
.spark .dn { align-self: flex-start; margin-top: 12px; background: rgba(var(--negc), .75); }
.spark .w { background: var(--neg); box-shadow: 0 0 0 1px var(--accent), 0 0 8px rgba(var(--glow), .8); }
.spark .hot { background: var(--ink); box-shadow: 0 0 8px rgba(var(--glow), .9); }
.spark .none.hot { background: none; box-shadow: none; }
.ol-total { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 16px 22px 18px 26px; border-top: 1px solid var(--rule); background: rgba(var(--glow), .05); font-size: 15px; }
.ol-total b { font: 500 16px var(--mono); font-variant-numeric: tabular-nums; }

/* the detail: the selected group */
.detail { min-width: 0; padding: 22px 0 26px; scroll-margin-top: 84px; }
.d-head, .d-top, .full-wrap { padding: 0 26px; }
.d-path { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-bottom: 8px; font: 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.d-path button { padding: 2px 6px; margin-left: -6px; border: 0; border-radius: 6px; background: none; font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--dim); cursor: pointer; transition: color .2s, background .2s; }
.d-path button:hover, .d-path button:focus-visible { outline: none; color: var(--ink); background: rgba(var(--glow), .2); }
.d-title { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.d-title h3 { font-weight: 500; font-size: 24px; letter-spacing: -.025em; line-height: 1.1; }
.d-title small { margin-top: 6px; font-size: 11px; white-space: normal; }
.d-title .add { margin: 0 0 0 auto; padding: 4px 12px 4px 10px; font-size: 12.5px; }
.chip.miss { margin-left: 0; color: var(--neg); border-color: rgba(var(--negc), .6); }
.d-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 14px 34px; align-items: start; margin-top: 18px; }
.d-top > .why { margin: 6px 0 0; }
/* a group's own lines, ending in its requirement */
.wf-r { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 14px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--rule); font-size: 15px; }
.wf.two .wf-r { grid-template-columns: minmax(0, 1fr) 104px 104px; }
.wf-r > span { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.wf-r em:not(.chip) { font-style: normal; font-size: 12.5px; color: var(--faint); }
.wf-r .chip { margin-left: 0; }
.wf-r b { font: 500 14.5px var(--mono); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.wf-r b.fv .dz.out { right: 0; }
.wf-h { padding: 0 0 6px; border-bottom: 0; }
.wf-h b { font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.wf-r.sum { border-bottom: 0; }
.wf-r.sum > span { font-weight: 500; }
.wf-r.sum b { font-size: 16px; color: var(--ink); }
.wf-r.sum b:nth-of-type(1) { text-shadow: 0 0 20px rgba(var(--glow), .5); }
/* a class group has three figures and nothing to add up: they sit in a row */
.d-top.one { grid-template-columns: 1fr; }
.tiles { display: flex; flex-wrap: wrap; gap: 14px 44px; padding: 14px 0 2px; border-top: 1px solid var(--rule); }
.tiles dt { display: flex; align-items: center; gap: 8px; min-height: 22px; margin-bottom: 4px; font-size: 13.5px; color: var(--dim); }
.tiles dt em { font-style: normal; font-size: 12.5px; color: var(--faint); }
.tiles dt .chip { margin-left: 0; font-style: normal; }
.tiles dd { font: 500 19px var(--mono); font-variant-numeric: tabular-nums; }
.tiles dd.hs { margin-top: 5px; font: 12.5px var(--mono); color: var(--faint); }
.tiles dd.hs em { font-style: normal; font-family: 'Inter Tight', sans-serif; }
.tiles dd .fv { display: inline-block; }
.tiles dd .dz.out { right: auto; left: 0; }
.tiles .sum dd:first-of-type { text-shadow: 0 0 20px rgba(var(--glow), .5); }
/* the offset formula for one scenario: the worst case, or the one under the pointer */
.math { padding: 14px 18px 16px; border-radius: 12px; border: 1px solid var(--rule); background: rgba(var(--bgc), .38); }
.math .lab { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; min-height: 22px; }
.math .lab .chip { margin-left: 0; }
.eq { display: flex; flex-wrap: wrap; gap: 2px 8px; font: 15px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.eq b { font-size: 16px; }
.eq-key { margin-top: 8px; font-size: 12.5px; color: var(--faint); }
.eq-key b { font: 500 12px var(--mono); }
.math .add { margin: 14px 0 0; padding: 4px 12px; font-size: 12.5px; }
.full-wrap { margin-top: 16px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(213, 225, 240, .28) transparent; }
.full { width: 100%; border-collapse: collapse; font: 12.5px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.full th, .full td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--rule); font-weight: 400; }
.full thead th { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.full th:first-child { text-align: left; padding-left: 0; }
.full tbody th { font: 500 13px 'Inter Tight', sans-serif; color: var(--ink); }
.full tbody th .chip { margin-left: 10px; }
.full td { color: var(--dim); }
.full td.fm { color: var(--ink); }
.full tr.w td, .full tr.w th { background: rgba(var(--glow), .08); }
.full tr.hot td, .full tr.hot th { background: rgba(var(--glow), .16); }

/* ---------- the table of scenarios ----------
   One grid for every level. The first column names the row; every other column is a scenario,
   in the same place whatever the row is. A cell's colour is the size of its P&L: soft red for
   a loss, soft green for a gain. */
.mx-wrap { margin-top: 20px; padding: 0 26px 4px; overflow-x: auto; scrollbar-width: thin; scrollbar-color: rgba(213, 225, 240, .28) transparent; }
.mx { --lab: 272px; --cw: 54px; min-width: calc(var(--lab) + var(--n) * (var(--cw) + 2px)); }
/* Twelve columns (a house scenario at either end) are a tighter fit: smaller figures, and five-figure
   amounts in their short form. The full amount is always in the cell's tooltip. */
.mx.wide { --lab: 258px; --cw: 45px; }
.mx.wide .mx-c { padding: 0 4px; font-size: 10.5px; }
.mx.wide .r-axis .mx-c { font-size: 10px; } .mx.wide .r-axis .mx-c small { font-size: 9.5px; }
.mx-c .ns, .mx.wide .mx-c .nf { display: none; }
.mx.wide .mx-c .ns { display: inline; }
.mx-row { display: grid; grid-template-columns: var(--lab) repeat(var(--n), minmax(var(--cw), 1fr)); column-gap: 2px; align-items: stretch; margin-top: 2px; }
.mx-lab { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding-right: 12px; font-size: 13.5px; color: var(--dim); }
.mx-lab b { font-weight: 500; color: var(--ink); }
.mx-lab small { margin-top: 2px; font-size: 11.5px; color: var(--faint); }
.mx-c { position: relative; display: flex; align-items: center; justify-content: flex-end; min-width: 0; height: 30px; padding: 0 6px; border-radius: 4px;
  font: 11.5px var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--dim); cursor: default; }
.mx-c.heat.ls { background: rgba(var(--negc), var(--a)); color: #fde3e4; }
.mx-c.heat.gn { background: rgba(var(--posc), var(--a)); color: #dcf7ea; }
.mx-c.heat.zero { background: rgba(213, 225, 240, .05); color: var(--faint); }
.mx-c.none { background: none; }
/* the scenario under the pointer: one lit band down the table */
.mx-c.hot::after { content: ''; position: absolute; inset: -2px 0; border-radius: 0; background: rgba(var(--glow), .15); box-shadow: -1px 0 0 rgba(var(--glow), .5), 1px 0 0 rgba(var(--glow), .5); pointer-events: none; }
/* the scenario that sets a requirement is ringed; a house worst case is ringed with dashes */
.mx-c.w { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 14px rgba(var(--glow), .5); color: #fff; z-index: 1; }
.mx-c.hw { outline: 1.5px dashed var(--tag2); outline-offset: -5px; }
.r-kid .mx-c.w { box-shadow: inset 0 0 0 1px rgba(213, 225, 240, .7); }
.mx-head { margin-top: 0; }
.mx-head .mx-lab { justify-content: flex-end; padding-bottom: 5px; font: 11px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.mx-head .mx-c { flex-direction: column; align-items: flex-end; justify-content: flex-end; gap: 1px; height: 40px; padding-bottom: 5px; border-radius: 4px 4px 0 0; }
.mx-head .mx-c small { font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); }
.mx-head .mx-c b { font-weight: 500; font-size: 12.5px; color: var(--dim); }
.mx-head .mx-c.hot b, .mx-head .mx-c.hot small { color: var(--ink); }
/* a row of stress moves and stressed prices: an axis, not a P&L */
.r-axis { margin-top: 10px; }
.r-axis .mx-lab { flex-direction: row; align-items: baseline; justify-content: flex-start; gap: 8px; font-size: 15px; }
.r-axis .mx-c { height: 36px; flex-direction: column; align-items: flex-end; justify-content: center; gap: 1px; font-size: 11px; color: var(--dim); border-bottom: 1px solid var(--rule); border-radius: 0; }
.r-axis .mx-c small { font-size: 10px; color: var(--faint); }
.mx-curve + .r-axis { margin-top: 2px; }
/* sums and totals */
.r-sum .mx-c { height: 26px; }
.r-sum .mx-c.gn { color: var(--pos); }
.r-sum .mx-c.ls { color: var(--neg); }
.r-sum.first { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--rule); }
.r-total { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); }
.r-sum + .r-total { border-top: 0; padding-top: 0; margin-top: 4px; }
.r-total .mx-c { height: 34px; font-weight: 500; font-size: 12px; }
.r-total .mx-lab { font-size: 15px; }
/* the curve over the columns */
.mx-curve .mx-lab { justify-content: flex-end; padding-bottom: 8px; font-size: 12.5px; }
.mx-plot { grid-column: 2 / -1; height: 76px; }
.mx-plot svg { display: block; width: 100%; height: 100%; overflow: visible; }
.mx-plot path { fill: none; vector-effect: non-scaling-stroke; }
.cv-zero { stroke: var(--rule); stroke-width: 1; }
.cv-area.up { fill: rgba(var(--posc), .2); }
.cv-area.dn { fill: rgba(var(--negc), .2); }
.cv-line { stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.cv-ghost { stroke: var(--faint); stroke-width: 1; stroke-dasharray: 3 4; }
.cv-dot { stroke: var(--ink); stroke-width: 5; stroke-linecap: round; }
.cv-dot.w { stroke: var(--accent); stroke-width: 10; }
.cv-dot.hot { stroke: #fff; stroke-width: 9; }
/* a child group, named in its row: click to open it */
.drill { display: block; width: 100%; min-width: 0; margin-left: -8px; padding: 3px 8px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: background .2s, box-shadow .2s; }
.drill b { display: block; font-size: 13.5px; }
.drill small { margin-top: 1px; font-size: 10px; }
.drill:hover, .drill:focus-visible { outline: none; background: rgba(var(--glow), .2); box-shadow: inset 0 0 0 1px rgba(var(--glow), .85); }
.r-kid .mx-c { height: 38px; }
/* a position: the chip, small, with its Greeks one click away */
.pos.sm { grid-template-columns: 50px 54px 72px 50px 26px; height: 28px; font-size: 12px; }
.pos.sm.stk { grid-template-columns: 50px 54px 150px; }
.pos.sm .dl { display: none; } .pos.sm .ds { display: inline; }
.pos.sm > * { padding: 0 7px; }
.pos.sm .c-s, .pos.sm .c-sh { font-size: 12px; }
.mx.wide .pos.sm { grid-template-columns: 44px 50px 66px 46px 24px; }
.mx.wide .pos.sm.stk { grid-template-columns: 44px 50px 136px; }
.mx.wide .pos.sm > * { padding: 0 5px; }
.plab { display: flex; align-items: center; gap: 2px; margin-left: -6px; padding: 1px 4px 1px 2px; border: 0; border-radius: 9px; background: none; color: inherit; cursor: pointer; transition: background .2s; }
.plab .caret { flex: none; margin: 0 2px 0 0; transform: rotate(-90deg); }
.plab[aria-expanded="true"] .caret { transform: none; }
.plab:hover, .plab:focus-visible { outline: none; background: rgba(var(--glow), .2); }
.plab:hover .caret { stroke: var(--ink); }
.r-pos .mx-lab { align-items: flex-start; }
.mx-drawer { display: block; }
.gk { display: flex; flex-wrap: wrap; gap: 10px 26px; margin: 2px 0 6px 12px; padding: 12px 16px; border-radius: 0 10px 10px 10px; border: 1px solid rgba(var(--glow), .45); background: rgba(var(--glow), .06); }
.gk dt { font-size: 11.5px; color: var(--faint); margin-bottom: 3px; }
.gk dd { font: 13.5px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); }
/* what a cell holds, in full */
.tip { position: absolute; z-index: 6; transform: translateX(-50%); padding: 6px 10px; border-radius: 8px; border: 1px solid rgba(var(--glow), .55); background: #071a33; box-shadow: 0 10px 28px rgba(0, 0, 0, .5), 0 0 18px rgba(var(--glow), .2);
  font: 12px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; pointer-events: none; }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* a new response: the heat cells sweep in from the first scenario to the last */
  .mx.fresh .mx-c.heat, .mx.fresh .r-sum .mx-c { animation: cell-in .46s cubic-bezier(.16, .8, .2, 1) both; animation-delay: calc(.12s + var(--c) * 26ms); }
  .mx.fresh .mx-plot { animation: fade .7s ease .2s both; }
  /* another group: its panel slides in, row after row */
  .detail.move .d-head, .detail.move .d-top, .detail.move .full-wrap { animation: move-in .36s cubic-bezier(.16, .8, .2, 1) both; }
  .detail.move .mx-row { animation: move-in .4s cubic-bezier(.16, .8, .2, 1) both; animation-delay: calc(40ms + var(--i, 0) * 22ms); }
}
@keyframes cell-in { from { opacity: 0; transform: scale(.72); filter: blur(3px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes move-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }

/* ---------- narrower screens ---------- */
/* Laptop widths: the outline narrows and the table tightens, so the two still sit side by side.
   With twelve columns there is no room for that, and the outline goes on top. */
@media (max-width: 1439px) {
  .roll { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
  .n-bar { width: 92px; }
  .node { column-gap: 10px; padding-right: 18px; padding-left: calc(22px + var(--d) * 14px); }
  .ol-head, .ol-total { padding-left: 22px; padding-right: 18px; }
  .mx { --lab: 256px; --cw: 48px; }
  .mx .mx-c { padding: 0 4px; font-size: 11px; }
  .mx .r-axis .mx-c { font-size: 10.5px; }
  .mx-c .nf { display: none; } .mx-c .ns { display: inline; }
  .pos.sm { grid-template-columns: 44px 50px 66px 46px 24px; }
  .pos.sm.stk { grid-template-columns: 44px 50px 136px; }
  .pos.sm > * { padding: 0 5px; }
  .n-name b { font-size: 14px; } .node.k-cg .n-name b { font-size: 13.5px; }
  .n-fig b { font-size: 14px; }
  .gk { gap: 10px 20px; padding: 10px 14px; }
  .roll.wide { grid-template-columns: 1fr; }
  .roll.wide .outline { border-right: 0; border-bottom: 1px solid var(--rule); }
  .roll.wide .n-bar { width: 132px; }
}
@media (max-width: 1219px) {
  .roll { grid-template-columns: 1fr; }
  .outline { border-right: 0; border-bottom: 1px solid var(--rule); }
  .n-bar { width: 132px; }
}
/* Below this the table can be wider than the pane: it scrolls sideways and the row names stay put. */
@media (max-width: 960px) {
  .mx-lab { position: sticky; left: 0; z-index: 2; background: var(--solid); }
  .mx-wrap { padding-left: 0; } .mx-lab { padding-left: 26px; } .mx, .mx.wide { --lab: 284px; }
}
@media (max-width: 820px) {
  .d-head, .d-top, .full-wrap { padding: 0 18px; }
  .d-top { grid-template-columns: 1fr; }
  .ol-head, .ol-total { padding-left: 18px; padding-right: 18px; }
  .node { padding-right: 18px; padding-left: calc(18px + var(--d) * 12px); }
  .d-title h3 { font-size: 21px; }
  .d-title .add { margin-left: 0; }
  .wf-r, .wf.two .wf-r { gap: 10px; } .wf-r { grid-template-columns: minmax(0, 1fr) 96px; } .wf.two .wf-r { grid-template-columns: minmax(0, 1fr) 92px 92px; }
}
/* On a phone the row's name sits on its own line and stays put while the scenarios scroll under it. */
@media (max-width: 700px) {
  .mx, .mx.wide { --cw: 50px; min-width: calc(var(--n) * (var(--cw) + 2px) + 36px); }
  .mx-wrap { padding: 0 0 4px; }
  .mx-row { grid-template-columns: repeat(var(--n), minmax(var(--cw), 1fr)); padding: 0 18px; }
  .mx-lab { grid-column: 1 / -1; width: max-content; max-width: calc(100vw - 2 * var(--pad) - 38px); padding: 6px 0 4px; left: 18px; background: none; }
  .mx-head .mx-lab { display: none; }
  .mx-plot { grid-column: 1 / -1; }
  .r-axis .mx-lab { padding-top: 10px; }
  .gk { margin-left: 18px; margin-right: 18px; max-width: calc(100vw - 2 * var(--pad) - 38px); position: sticky; left: 18px; }
  .legend { display: none; }
  .pa { gap: 8px 18px; }
}
/* On a phone a ledger's label sits on its own line, above its CPM and house figures. */
@media (max-width: 520px) {
  .pa { grid-template-columns: 1fr 1fr; gap: 3px 18px; }
  .pa > span:not(.pa-h), .pa > .pa-h.l { grid-column: 1 / -1; }
  .pa > span:empty { display: none; }
  .pa > span:not(.pa-h) { margin-top: 7px; font-size: 14.5px; }
  .pa .pa-rule { margin: 9px 0 0; }
}

/* This demo's six tabs fit a small laptop as they are, so they keep their usual spacing where
   demo.css takes a little more off for the Strategy-Based demo's longer labels. */
@media (min-width: 1001px) and (max-width: 1360px) { #in-tabs { gap: 4px; } #in-tabs button { padding: 7px 11px; gap: 6px; } }
