/* Demo workspace: the site's theme applied to an application screen. Loaded after style.css. */

/* The demo's two signal colours, softened to sit on the dark blue: green for a credit, red for a
   debit and for anything the account is not permitted to do. */
:root { --pos: #6fd6a2; --neg: #f2898d; --negc: 242, 137, 141; }

[hidden] { display: none !important; }

.dsec { min-height: 100vh; padding-top: 128px; padding-bottom: 8vh; gap: 28px; justify-content: flex-start; }
.sec.dsec::before { inset: 0; background: rgba(var(--bgc), .5); -webkit-mask-image: none; mask-image: none; }
.dend { min-height: 0; padding: 0; height: 1px; }
.dend::before { display: none; }

.dhead h1 { font-weight: 500; font-size: clamp(30px, 3.4vw, 52px); letter-spacing: -.034em; line-height: 1; }
.dhead .crumb { margin-bottom: 20px; flex-wrap: wrap; }
.dhead .lede { margin-top: 16px; max-width: 50em; font-size: 16.5px; }

/* The examples: a label, and one button that names the current example and opens a list of them
   all (example-menu.js). The list lies over the panes below it and scrolls inside itself when the
   examples outgrow it. The same menu (.exm) holds the spread level in the Strategy-Based demo. */
.examples { position: relative; z-index: 3; display: flex; align-items: center; gap: 14px; }
.examples > span { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.exm { position: relative; flex: 0 1 300px; min-width: 0; }
.exm > button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; min-height: 42px; padding: 0 16px 0 18px; border-radius: 99px;
  border: 1px solid var(--rule); background: rgba(var(--bgc), .4); font: 500 14px 'Inter Tight', sans-serif; color: var(--ink); text-align: left; cursor: pointer; transition: border-color .25s, box-shadow .25s; }
.exm > button span, .exm li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exm > button.none span { color: var(--dim); }
.exm > button .caret { flex: none; margin: 0; stroke: var(--dim); }
.exm > button[aria-expanded="true"] .caret { transform: rotate(180deg); }
.exm > button:disabled { opacity: .4; cursor: default; }
.exm > button:hover:not(:disabled), .exm > button:focus-visible, .exm > button[aria-expanded="true"] { outline: none; border-color: rgba(var(--glow), .8); box-shadow: 0 0 20px rgba(var(--glow), .28); }
.exm > ul { position: absolute; z-index: 5; top: calc(100% + 8px); left: 0; min-width: 100%; width: max-content; max-width: min(420px, calc(100vw - 2 * var(--pad))); overflow-y: auto; overscroll-behavior: contain;
  margin: 0; padding: 6px; list-style: none; border-radius: 14px; border: 1px solid rgba(var(--glow), .55); background: #071a33; box-shadow: 0 14px 34px rgba(0, 0, 0, .5), 0 0 22px rgba(var(--glow), .22);
  outline: none; scroll-margin: 90px 0 14px; scrollbar-width: thin; scrollbar-color: rgba(var(--glow), .5) transparent; }
.exm li { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 40px; padding: 0 12px; border-radius: 9px; font-size: 14.5px; color: var(--dim); cursor: pointer; }
.exm li + li { margin-top: 2px; }
.exm li[aria-selected="true"] { color: var(--ink); }
.exm li.act { color: var(--ink); background: rgba(var(--glow), .2); }
.exm .tick { flex: none; width: 13px; height: 13px; fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.exm li[aria-selected="true"] .tick { visibility: visible; }
.exm > ul.up { top: auto; bottom: calc(100% + 8px); }
@media (prefers-reduced-motion: no-preference) { .exm > ul { animation: exm-in .16s ease-out; } .exm > ul.up { animation-name: exm-up; } }
@keyframes exm-in { from { opacity: 0; transform: translateY(-5px); } }
@keyframes exm-up { from { opacity: 0; transform: translateY(5px); } }

.work { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); gap: 20px; align-items: start; }
.pane { padding: 0 0 26px; overflow: hidden; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 18px 26px; border-bottom: 1px solid var(--rule); }
.pane-head h2 { font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); line-height: 1.4; }

/* tabs and two-way switches share one quiet control style */
.tabs, .seg { display: flex; gap: 4px; padding: 4px; border-radius: 99px; border: 1px solid var(--rule); background: rgba(var(--bgc), .4); max-width: 100%; overflow-x: auto; }
.tabs button, .seg button {
  font: 500 13.5px 'Inter Tight', sans-serif; color: var(--dim); background: none; border: 0; cursor: pointer; white-space: nowrap;
  padding: 7px 14px; border-radius: 99px; display: inline-flex; align-items: center; gap: 7px; transition: color .25s, background .25s;
}
/* six tabs are a tight fit in the inputs panel: trim them, and never show a scrollbar under them */
.tabs { scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
#in-tabs button { padding: 7px 11px; gap: 6px; }
/* On a small laptop the two panes sit side by side and the six are a few pixels too wide: a little
   more comes off, so they fit at 1280. Narrower than that they scroll, with the cue below. */
@media (min-width: 1001px) and (max-width: 1360px) { #in-tabs { gap: 2px; } #in-tabs button { padding: 7px 9px; gap: 5px; } }
/* A strip with more tabs than fit (tab-strip.js). The pill becomes a wrapper, .tabstrip, the same
   size as the strip was, and the strip scrolls inside it. On a side with tabs out of view the tabs
   fade toward the edge (a mask, so the pill's border stays crisp) and a round chevron sits over the
   fade. --l and --r are how far in the fade starts on the left and right, --lc and --rc how much at
   the very edge is clear; the script sets them, and all four are 0 where nothing is hidden. The
   chevrons are laid over the strip, so nothing moves when one comes or goes. */
.tabstrip { position: relative; display: flex; min-width: 0; max-width: 100%; border-radius: 99px; border: 1px solid var(--rule); background: rgba(var(--bgc), .4); }
.tabstrip > .tabs { flex: 1 1 auto; min-width: 0; max-width: none; border: 0; background: none; --l: 0px; --lc: 0px; --r: 0px; --rc: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent var(--lc), #000 var(--l), #000 calc(100% - var(--r)), transparent calc(100% - var(--rc)));
  mask-image: linear-gradient(to right, transparent var(--lc), #000 var(--l), #000 calc(100% - var(--r)), transparent calc(100% - var(--rc))); }
.tabgo { position: absolute; top: 50%; z-index: 1; width: 28px; height: 28px; margin-top: -14px; padding: 0; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--rule); background: rgba(var(--bgc), .82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: var(--dim); cursor: pointer; transition: color .2s, border-color .2s, box-shadow .2s; }
.tabgo.prev { left: 4px; } .tabgo.next { right: 4px; }
.tabgo svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tabgo:hover, .tabgo:focus-visible { outline: none; color: var(--accent); border-color: rgba(var(--glow), .8); box-shadow: 0 0 14px rgba(var(--glow), .28); }
.tabgo::before { content: ''; position: absolute; inset: -4px; border-radius: 50%; } /* a little more to hit than to see */
@media (pointer: coarse) { .tabgo::before { inset: -9px; } }                          /* and 46px across under a finger */
.tabs button:hover, .seg button:hover { color: var(--ink); }
.tabs button[aria-selected="true"], .seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.tabs i, .group h3 i { font-style: normal; font-family: var(--mono); font-size: 10.5px; padding: 2px 6px; border-radius: 99px; background: rgba(var(--glow), .18); color: var(--accent); }
.tabs button[aria-selected="true"] i { background: rgba(3, 24, 46, .14); color: var(--on-ink); }

.tabpanel { padding: 4px 26px 0; }
.group { padding-top: 26px; }
.group h3 { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 14px; font-weight: 500; font-size: 17px; letter-spacing: -.015em; color: var(--ink); }
.fold { display: flex; align-items: center; gap: 10px; margin-left: -4px; padding: 3px 8px 3px 4px; border: 0; border-radius: 8px; background: none; font: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; transition: color .2s, background .2s; }
.fold:hover { background: rgba(213, 225, 240, .08); }
.fold:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.caret { width: 12px; height: 12px; margin-right: -4px; fill: none; stroke: var(--faint); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s cubic-bezier(.16,.8,.2,1); }
.group.folded .caret { transform: rotate(-90deg); }
.group.folded .gbody { display: none; }
.group.folded h3 { margin-bottom: 0; }
.empty { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--rule); font-size: 14.5px; color: var(--faint); }

/* ---------- the position chip ----------
   One line per position or leg, in the inputs and in the results: quantity, symbol, expiration,
   strike, C or P, price, in fixed columns so a list lines up. It is drawn in the app's own
   language: a thin outline with rules between the cells and no solid fills. Only the quantity
   cell is tinted, so the eye lands on the signed number first. */
.pos {
  display: inline-grid; grid-template-columns: 64px 62px 118px 60px 32px 88px; height: 32px; flex: none;
  font: 13px var(--mono); font-variant-numeric: tabular-nums; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 8px; background: rgba(var(--bgc), .38); overflow: hidden;
}
.pos.stk { grid-template-columns: 64px 62px 210px 88px; }
/* a deliverable of a non-standard root: how much, of what; cash is an amount and has no symbol */
.pos.dlv { grid-template-columns: 78px 62px 92px; }
.pos.dlv.cash { grid-template-columns: 140px 92px; }
.pos > * { display: flex; align-items: center; justify-content: center; padding: 0 9px; white-space: nowrap; overflow: hidden; }
.pos > * + * { border-left: 1px solid var(--rule); }
:where(.pos) > button { margin: 0; border-width: 0 0 0 1px; border-style: solid; border-color: var(--rule); border-radius: 0; background: none; font: inherit; color: inherit; cursor: text; transition: background .18s, box-shadow .18s, color .18s; }
:where(.pos) > button:first-child { border-left: 0; }
:where(.pos) > button[data-f="type"], :where(.pos) > button[data-nf="type"] { cursor: pointer; }
.c-q { justify-content: flex-end !important; font-weight: 500; background: rgba(var(--glow), .18); color: #cfe6fa; box-shadow: inset -1px 0 0 rgba(var(--glow), .45); }
.c-s { font: 500 13px 'Inter Tight', sans-serif; letter-spacing: .03em; }
.c-e { color: var(--dim); }
.c-cp { color: var(--accent); }
.c-sh { justify-content: flex-start !important; color: var(--dim); font: 13px 'Inter Tight', sans-serif; }
.c-p { justify-content: flex-end !important; color: var(--dim); }
/* In the inputs every cell of a chip can be changed in place: it lights up under the pointer,
   and a click lays a field (or the Call / Put / Stock menu) over it. */
.pos.ed > button:hover, .pos.ed > button:focus-visible, .pos.ed > button[aria-expanded="true"] { outline: none; color: var(--ink); background: rgba(var(--glow), .2); box-shadow: inset 0 0 0 1px rgba(var(--glow), .85), inset 0 0 14px rgba(var(--glow), .28); }
.prow { position: relative; }
.pane input.cell-in.cell-in { position: absolute; z-index: 3; margin: 0; padding: 0 8px; border-radius: 7px; border: 1px solid var(--accent); background: #071a33; color: var(--ink);
  font: 13px var(--mono); font-variant-numeric: tabular-nums; text-align: center; box-shadow: 0 0 0 3px rgba(var(--glow), .22), 0 0 22px rgba(var(--glow), .35); }
.pane input.cell-in.cell-in.f-q, .pane input.cell-in.cell-in.f-p { text-align: right; }
.pane input.cell-in.cell-in.f-sym { font: 500 13px 'Inter Tight', sans-serif; letter-spacing: .03em; text-transform: uppercase; }
.pane input.cell-in.cell-in.f-exp { padding: 0 4px 0 8px; text-align: left; color-scheme: dark; }
.pane input.cell-in.cell-in.bad { border-color: var(--neg); box-shadow: 0 0 0 3px rgba(var(--negc), .22); }
.cell-menu { position: absolute; z-index: 4; display: grid; gap: 2px; min-width: 104px; padding: 5px; border-radius: 11px; border: 1px solid rgba(var(--glow), .55); background: #071a33; box-shadow: 0 14px 34px rgba(0, 0, 0, .5), 0 0 22px rgba(var(--glow), .22); }
.cell-menu button { display: flex; align-items: center; gap: 9px; padding: 7px 12px 7px 9px; border: 0; border-radius: 7px; background: none; font: 14px 'Inter Tight', sans-serif; color: var(--dim); text-align: left; cursor: pointer; }
.cell-menu button::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.cell-menu button[aria-checked="true"] { color: var(--ink); }
.cell-menu button[aria-checked="true"]::before { background: var(--accent); }
.cell-menu button:hover, .cell-menu button:focus-visible { outline: none; color: var(--ink); background: rgba(var(--glow), .2); }
.pos .ds { display: none; }
.pos .at { white-space: pre; }
.prow { display: flex; align-items: center; gap: 8px; }
.prow .occ { margin-left: 6px; }
.prow + .prow { margin-top: 6px; }
.chips { padding: 4px 0 12px; }
.occ { font: 11.5px var(--mono); color: var(--faint); white-space: nowrap; }

.tools { display: flex; align-items: center; gap: 2px; }
.icon { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--faint); cursor: pointer; transition: color .2s, background .2s; }
.icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.icon:hover { color: var(--ink); background: rgba(213, 225, 240, .1); }
.icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
/* "+ Add ..." is a small outlined pill, the same language as the tabs and the Contact button, so it reads as a control and not as a heading */
.add { margin-top: 12px; padding: 6px 14px 6px 12px; border-radius: 99px; border: 1px solid var(--rule); background: rgba(var(--bgc), .35); font: 500 13px 'Inter Tight', sans-serif; color: var(--dim); cursor: pointer; transition: color .25s, border-color .25s, box-shadow .25s; }
/* cash: a single amount beside its heading, the heading text lined up with the foldable ones above */
.group.cash h3 label { padding-left: 18px; }
.pane .group.cash h3 input { width: 148px; padding: 5px 11px; font-size: 13.5px; text-align: right; letter-spacing: 0; }
/* in a heading, right after the count */
h3 > .add { flex: none; margin: 0; padding: 4px 12px 4px 10px; font-size: 12.5px; letter-spacing: 0; white-space: nowrap; }
.fold { flex: none; white-space: nowrap; }
.add:hover, .add:focus-visible { outline: none; color: var(--ink); border-color: rgba(var(--glow), .8); box-shadow: 0 0 20px rgba(var(--glow), .28); }

/* an order: working orders are dashed, a new order is dotted and lit */
.order { border-radius: 12px; padding: 14px 16px 2px; }
.order + .order { margin-top: 8px; }
.order.working { border: 1px dashed rgba(213, 225, 240, .42); background: rgba(var(--bgc), .3); }
/* a non-standard root: its symbol, its multiplier, and what one contract delivers */
.order.nsroot { border: 1px solid var(--rule); background: rgba(var(--bgc), .3); }
.order.nsroot h4 { font-size: 16px; letter-spacing: .03em; }
.order.nsroot .chips { padding-bottom: 10px; }
.order.nsroot > .add { margin: 0 0 14px; }
.nsd, .nsm { font-size: 13.5px; color: var(--dim); }
.nsm { display: inline-flex; align-items: baseline; gap: 4px; margin-left: auto; } /* the multiplier sits at the far end of the line, by the remove icon */
.order.nsroot header .tools { margin-left: 2px; }
.nsm .nsf { font-family: var(--mono); font-size: 13px; color: var(--ink); }
.nsf { margin: 0 -6px; padding: 3px 6px; border: 0; border-radius: 6px; background: none; font: inherit; color: inherit; cursor: text; transition: background .18s, box-shadow .18s, color .18s; }
.nsm .nsf { margin: 0; }
.nsf:hover, .nsf:focus-visible { outline: none; color: var(--ink); background: rgba(var(--glow), .2); box-shadow: inset 0 0 0 1px rgba(var(--glow), .85), inset 0 0 14px rgba(var(--glow), .28); }
.order.newo { border: 1.5px dotted rgba(var(--glow), .9); background: rgba(var(--glow), .07); box-shadow: 0 0 26px rgba(var(--glow), .12); }
.order header { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.order h4 { margin: 0; font-weight: 500; font-size: 15px; letter-spacing: -.005em; }
.order .credit { font-family: var(--mono); font-size: 12.5px; color: var(--dim); }
/* a net amount carries its sign and a colour: a soft green for a credit, a soft red for a debit */
.amt { font-weight: 500; font-variant-numeric: tabular-nums; }
.amt.cr, .credit.ed button.amt.cr { color: var(--pos); }
.amt.db, .credit.ed button.amt.db { color: var(--neg); }
/* the net amount can be changed where it sits: the words flip credit and debit, the number opens a field */
.order header { position: relative; }
.credit.ed { display: inline-flex; align-items: baseline; gap: 2px; margin-left: -6px; }
.credit.ed button { padding: 3px 6px; border: 0; border-radius: 6px; background: none; font: inherit; color: inherit; cursor: pointer; transition: background .18s, box-shadow .18s, color .18s; }
.credit.ed button[data-f] { cursor: text; }
.credit.ed button:hover, .credit.ed button:focus-visible { outline: none; color: var(--ink); background: rgba(var(--glow), .2); box-shadow: inset 0 0 0 1px rgba(var(--glow), .85), inset 0 0 14px rgba(var(--glow), .28); }
.pane input.cell-in.cell-in.f-credit { font-size: 12.5px; text-align: right; }
.chip { margin-left: auto; font-style: normal; font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); padding: 3px 8px; border: 1px solid var(--rule); border-radius: 99px; }
.chip.hot { color: var(--accent); border-color: rgba(var(--glow), .7); box-shadow: 0 0 14px rgba(var(--glow), .25); }


.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-top: 1px solid var(--rule); font-size: 15.5px; }
.kv dt { color: var(--dim); } .kv dd { font-family: var(--mono); font-size: 14px; }
/* JSON colours, from the page's own palette: keys in the accent, strings a paler blue, numbers
   in the brightest ink because they are what you came to read, the rest quiet. */
.json .j-k { color: var(--accent); }
.json .j-s { color: var(--tag2); }
.json .j-n { color: var(--ink); }
.json .j-b { color: var(--tag3); font-style: italic; }
.json .j-p { color: var(--faint); }
.json { margin: 22px 0 0; padding: 18px; border-radius: 12px; border: 1px solid var(--rule); background: rgba(var(--bgc), .5); font: 12.5px/1.6 var(--mono); color: var(--dim); overflow: auto; max-height: 460px; white-space: pre; color-scheme: dark; scrollbar-width: thin; scrollbar-color: rgba(213, 225, 240, .28) transparent; }
/* The copy button on a JSON box (json-box.js). It sits on the frame, not in the text, so it stays in the
   corner while the JSON scrolls under it. */
.jbox { position: relative; margin: 22px 0 0; }
.jbox > .json { margin: 0; }
.jbox:has(> pre.json:empty) .jcopy { display: none; }
.jcopy [hidden] { display: none; }
.jcopy { position: absolute; top: 9px; right: 14px; display: flex; align-items: center; gap: 8px; }
.jcopy .icon, .jcopy span { border: 1px solid var(--rule); background: rgba(var(--bgc), .82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.jcopy .icon { color: var(--dim); transition: color .2s, border-color .25s, box-shadow .25s; }
.jcopy .icon:hover, .jcopy .icon:focus-visible { outline: none; color: var(--ink); background: rgba(var(--bgc), .82); border-color: rgba(var(--glow), .8); box-shadow: 0 0 20px rgba(var(--glow), .28); }
.jcopy span { padding: 5px 10px; border-radius: 8px; font: 500 12px 'Inter Tight', sans-serif; color: var(--ink); white-space: nowrap; }
.jcopy span:empty, .jcopy .i-done, .jcopy.ok .i-copy { display: none; }
.jcopy.ok .i-done { display: block; }
.jcopy.ok .icon { color: var(--accent); }
.jcopy.no span { color: var(--neg); border-color: rgba(var(--negc), .5); }
.jcopy.no .icon { color: var(--neg); }
/* Editing a JSON box. The buttons move out of the corner into a row above the editor, so they
   never sit on the text being typed; what went wrong, or what the inputs could not take as
   written, is said underneath. */
.jbox.editing { display: flex; flex-direction: column; }
.jbox.editing .jcopy { position: static; order: -1; justify-content: flex-end; margin-bottom: 10px; }
.jbtn { padding: 5px 13px; border-radius: 99px; border: 1px solid var(--rule); background: rgba(var(--bgc), .82); font: 500 12.5px 'Inter Tight', sans-serif; color: var(--dim); cursor: pointer; white-space: nowrap; transition: color .25s, border-color .25s, box-shadow .25s; }
.jbtn.j-save { color: var(--ink); border-color: rgba(var(--glow), .7); }
.jbtn:hover, .jbtn:focus-visible { outline: none; color: var(--ink); border-color: rgba(var(--glow), .8); box-shadow: 0 0 20px rgba(var(--glow), .28); }
textarea.jedit { display: block; width: 100%; box-sizing: border-box; min-height: 200px; max-height: none; resize: vertical; color: var(--ink); tab-size: 2; outline: none; }
textarea.jedit:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--glow), .2); }
.jerr, .jnote { margin: 12px 0 0; padding: 12px 15px; border-radius: 10px; border: 1px solid var(--rule); font-size: 14px; line-height: 1.5; color: var(--dim); overflow-wrap: anywhere; }
.jerr { border-color: rgba(var(--negc), .55); background: rgba(var(--negc), .06); }
.jerr b { font-weight: 500; color: var(--neg); }
.jbox.editing .jerr { order: -1; margin: 0 0 10px; } /* above the editor, where it is seen without scrolling */
.jnote b { font-weight: 500; color: var(--ink); }
.jnote ul { margin: 8px 0 0; padding-left: 18px; }
.jnote li + li { margin-top: 6px; }
.jnote code { font: 12.5px var(--mono); color: var(--tag2); }

/* ---------- editors ---------- */
.order header .tools { margin-left: auto; }
.editor { margin: 8px 0; padding: 18px 18px 16px; border-radius: 12px; border: 1px solid rgba(var(--glow), .7); background: rgba(var(--glow), .06); box-shadow: 0 0 30px rgba(var(--glow), .1); }
.editor h4 { margin: 0 0 14px; font-weight: 500; font-size: 15px; letter-spacing: -.005em; }
.fl { display: block; margin-bottom: 6px; font-size: 12.5px; color: var(--dim); }
.f { display: block; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.pane input:not([type="checkbox"]), .pane select {
  width: 100%; min-width: 0; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--rule); background: rgba(var(--bgc), .6);
  color: var(--ink); font: 14px var(--mono); transition: border-color .2s, box-shadow .2s; color-scheme: dark;
}
.pane input:focus, .pane select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--glow), .2); }
.pane input:disabled, .pane select:disabled { opacity: .3; }
/* a two-way toggle, the same height as a text field */
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: 8px; border: 1px solid var(--rule); background: rgba(var(--bgc), .6); }
.pick button { font: 500 13px 'Inter Tight', sans-serif; color: var(--dim); background: none; border: 0; border-radius: 6px; padding: 7px 4px; cursor: pointer; transition: color .2s, background .2s; }
.pick button:hover:not(:disabled) { color: var(--ink); }
.pick button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.pick button:disabled { opacity: .3; cursor: default; }
.pick button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.legs-edit { margin-top: 14px; }
.leg-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; padding: 12px; border: 1px solid var(--rule); border-radius: 10px; background: rgba(var(--bgc), .3); }
.leg-row + .leg-row { margin-top: 8px; }
.leg-row .fl { font-size: 11.5px; margin-bottom: 5px; }
.leg-top { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; margin-bottom: -2px; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.leg-row.bad input:not(:disabled), .leg-row.bad select:not(:disabled), .pane .editor input.bad { border-color: rgba(var(--negc), .8); }
.x { width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--faint); font-size: 18px; line-height: 1; cursor: pointer; transition: color .2s, background .2s; }
.x:hover { color: var(--ink); background: rgba(213, 225, 240, .12); }
.hint { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--faint); }
.eactions { display: flex; align-items: center; gap: 16px; margin-top: 16px; }
.btn.sm { padding: 9px 16px; font-size: 14px; cursor: pointer; }
.ghost { font: 500 14px 'Inter Tight', sans-serif; color: var(--dim); background: none; border: 0; padding: 0; cursor: pointer; }
.ghost:hover { color: var(--ink); }


.trow { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 0; border-top: 1px solid var(--rule); font-size: 15.5px; cursor: pointer; }
.trow small { display: block; margin-top: 3px; font-size: 13px; color: var(--faint); }
/* what belongs to the toggle above it (the spread level, under Spreads): indented behind a guide
   line, with no rule between the two */
.tsub { margin: -3px 0 14px 3px; padding: 2px 0 2px 15px; border-left: 1px solid rgba(var(--glow), .5); }
.tsub .exm { max-width: 340px; }
/* The level names are long for a phone. Where one does not fit it wraps; it is never cut short. */
.tsub .exm > button { padding-top: 7px; padding-bottom: 7px; border-radius: 22px; line-height: 1.3; }
.tsub .exm > button span, .tsub .exm li span { white-space: normal; }
.tsub .exm li { padding-top: 6px; padding-bottom: 6px; line-height: 1.3; }
/* A pane clips what it holds. While a menu inside it is open it stops clipping downward, so the list
   can run past the pane's lower edge as the examples list runs over the panes. It still clips
   sideways and keeps its width (a grid item that does not clip grows to fit its contents). Where a
   browser cannot do this, the list opens above its button instead (example-menu.js). */
.pane:has(.exm > button[aria-expanded="true"]) { overflow-x: clip; overflow-y: visible; min-width: 0; }
.switch { position: relative; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch span { display: block; position: relative; width: 36px; height: 21px; border-radius: 99px; background: rgba(213, 225, 240, .18); transition: background .3s; }
.switch span::after { content: ''; position: absolute; left: 3px; top: 3px; width: 15px; height: 15px; border-radius: 50%; background: var(--ink); transition: transform .3s cubic-bezier(.2,.7,.1,1); }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(15px); }
.switch input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ---------- results ---------- */
/* The headline figure leads the pane without shouting: about twice the size of the figures under it. */
.headline { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 22px 26px 20px; border-bottom: 1px solid var(--rule); }
.lab { display: block; margin-bottom: 8px; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.num { display: block; font-size: clamp(30px, 3vw, 40px); font-weight: 500; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
/* Figures in the result. When a new response comes back from the engine every one dissolves, and
   when the Maintenance / Initial switch is used the ones that follow it do:
   its characters drift apart and blur out while small specks swarm away, then the figure for the
   other basis gathers back out of them. About three quarters of a second, end to end. */
.fv { position: relative; }
.ledger b.fv, .pre-row b.fv { display: inline-block; }
.dz { display: inline-block; white-space: nowrap; }
.dz.out { position: absolute; top: 0; right: 0; pointer-events: none; }
.num .dz.out { right: auto; left: 0; }
.cw { position: relative; display: inline-block; }
.ch { display: inline-block; }
.dz.out .ch { animation: dz-out .3s cubic-bezier(.5, 0, .9, .4) var(--d) both; }
.dz.in .ch { animation: dz-in .44s cubic-bezier(.1, .7, .2, 1) calc(.26s + var(--d)) both; }
.cw i { position: absolute; left: 50%; top: 50%; width: clamp(1.5px, .06em, 3px); height: clamp(1.5px, .06em, 3px); margin: -1px 0 0 -1px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 6px rgba(var(--glow), .95); opacity: 0; animation: dz-speck .76s ease-in-out var(--d) both; }
@keyframes dz-out { to { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(.3); filter: blur(4px); } }
@keyframes dz-in {
  from { opacity: 0; transform: translate(var(--dx), var(--dy)) rotate(var(--r)) scale(.3); filter: blur(4px); color: var(--accent); }
  65% { color: var(--accent); }
  to { opacity: 1; transform: none; filter: none; }
}
@keyframes dz-speck {
  0% { opacity: 0; transform: none; }
  18% { opacity: 1; }
  45%, 55% { opacity: 1; transform: translate(var(--px), var(--py)); }
  88% { opacity: .9; }
  100% { opacity: 0; transform: none; }
}
/* with reduced motion nothing moves: the figure glows for a moment */
.bv.go { animation: basis-glow .6s ease-out both; }
@keyframes basis-glow { 0%, 40% { color: var(--accent); text-shadow: 0 0 20px rgba(var(--glow), .8); } 100% { } }
.mini { display: flex; gap: 28px; }
.mini dt { font-size: 12.5px; color: var(--faint); margin-bottom: 4px; }
.mini dd { font-family: var(--mono); font-size: 16px; font-variant-numeric: tabular-nums; }
/* the same pair, smaller, beside an underlying or a strategy */
.mini.sm { gap: 24px; text-align: right; }
.mini.sm dt { font-size: 12px; margin-bottom: 2px; }
.mini.sm dd { font-size: 15px; color: var(--ink); }
.mini.sm dd.up { color: var(--accent); }
/* an effect that adds excess is lit; one that uses excess stays plain */
.up { color: var(--accent); text-shadow: 0 0 22px rgba(var(--glow), .45); }

.live { margin-left: 12px; color: var(--faint); letter-spacing: .1em; }
.hside { display: flex; flex-direction: column; align-items: flex-end; gap: 14px; }
.warn { margin: 26px; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--rule); font-size: 15px; line-height: 1.5; color: var(--dim); }
/* an error from the engine, in its own words */
.warn.no { border-color: rgba(var(--negc), .55); background: rgba(var(--negc), .06); }
.warn code { display: block; margin: 10px 0; font: 12.5px/1.5 var(--mono); color: var(--neg); overflow-wrap: anywhere; }
.sub { margin: 22px 0 10px; font-weight: 500; font-size: 15px; color: var(--dim); }
.order.out header h4 { font-family: var(--mono); font-weight: 400; font-size: 13.5px; color: var(--dim); }
.strat + .strat, .strat + .empty { margin-top: 8px; }
.strat.bad { border-color: rgba(var(--negc), .55); background: rgba(var(--negc), .06); }
.strat.bad .chip { color: var(--neg); border-color: rgba(var(--negc), .6); box-shadow: 0 0 14px rgba(var(--negc), .18); }
.strat h3 .chip { margin-left: 12px; vertical-align: middle; }
#res-json { padding-bottom: 0; }
.under { padding: 6px 26px 0; }
/* The account's own figures (the headline, the ledger, the new order's check) sit on a faintly lit
   band. A rule across the pane and a small label then open the breakdown by underlying. */
.headline, .acct { background: rgba(var(--glow), .05); }
.acct { padding-bottom: 24px; }
.byul { padding-top: 26px; border-top: 1px solid var(--rule); }
.byul > .lab { margin-bottom: 0; }
.byul .ul { margin-top: 14px; }
.uly + .uly { margin-top: 28px; padding-top: 12px; border-top: 1px solid var(--rule); }
.ledger li { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--rule); font-size: 16px; }
.ledger span em { margin-left: 10px; font-style: normal; font-size: 13px; color: var(--faint); }
.ledger b { font: 500 16px var(--mono); font-variant-numeric: tabular-nums; }
.ledger li:last-child { border-bottom: 0; }

.pre { margin-top: 10px; padding: 16px 18px; border-radius: 12px; border: 1.5px dotted rgba(var(--glow), .9); background: rgba(var(--glow), .07); }
.pre header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.pre .lab { margin: 0; color: var(--dim); }
.verdict { font-style: normal; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; padding: 5px 11px; border-radius: 99px; }
.pre.ok .verdict { background: var(--accent); color: var(--on-ink); box-shadow: 0 0 18px rgba(var(--glow), .5); }
.pre.no { border-color: rgba(var(--negc), .75); background: rgba(var(--negc), .07); }
.pre.no .verdict { background: var(--neg); color: var(--on-ink); box-shadow: 0 0 18px rgba(var(--negc), .4); }
.pre.no p { padding-left: 12px; border-left: 2px solid rgba(var(--negc), .6); }
.pre-row { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; font-size: 16px; }
.pre-row b { font: 500 20px var(--mono); font-variant-numeric: tabular-nums; }
.pre p { margin-top: 8px; font-size: 14.5px; color: var(--dim); }

.why { margin: 18px 0 4px; padding-left: 14px; border-left: 2px solid rgba(var(--glow), .6); font-size: 15px; line-height: 1.5; color: var(--dim); }
.ul { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin: 24px 0 12px; font-size: 15px; color: var(--dim); }
.ul p { display: flex; align-items: baseline; gap: 10px; }
.ul b { font-size: 19px; font-weight: 500; color: var(--ink); letter-spacing: -.01em; }
.strat { border: 1px solid var(--rule); border-radius: 12px; background: rgba(var(--bgc), .38); padding: 16px 18px 4px; }
@media (max-width: 1320px) { #result .occ { display: none; } }
.strat header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 10px; }
.strat h3 { font-weight: 500; font-size: 20px; letter-spacing: -.02em; }
/* A long strategy name takes the header's first line to itself; its figures then keep to the right. */
.strat header .mini { margin-left: auto; }

.fine { font-size: 13px; color: var(--faint); max-width: 62em; }

@media (max-width: 1000px) { .work { grid-template-columns: 1fr; } }
@media (max-width: 820px) {
  .dsec { padding-top: 104px; }
  .pane-head { padding: 16px 18px; } .tabpanel, .under { padding-left: 18px; padding-right: 18px; } .headline { padding: 22px 18px 18px; }
  .pos, .pos.stk { display: grid; flex: 1 1 0; min-width: 0; font-size: 11.5px; }
  .pos { grid-template-columns: 1.1fr 1.15fr 2.4fr 1.1fr .7fr 1.7fr; }
  .pos.stk { grid-template-columns: 1.1fr 1.15fr 4.2fr 1.7fr; }
  .pos > * { padding: 0 5px; }
  .pos > .c-e { padding: 0 2px; }
  .c-s, .c-sh { font-size: 11.5px; }
  .prow { gap: 4px; }
  .icon { width: 28px; }
  .occ { display: none; }
  .leg-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pos.dlv { grid-template-columns: 1.3fr 1.15fr 1.5fr; }
  .pos.dlv.cash { grid-template-columns: 2.45fr 1.5fr; }
  .hside { align-items: flex-start; }
}
@media (max-width: 480px) {
  /* the examples button and its list take the width of the panes, under the label */
  .examples { flex-direction: column; align-items: stretch; gap: 9px; }
  .exm { flex: none; } .exm > button { min-height: 44px; } .exm > ul { width: 100%; max-width: none; }
  .nsd .wide { display: none; } /* so the root, its multiplier and the remove icon stay on one line */
  .group h3 { gap: 8px; font-size: 16px; } .fold { gap: 8px; padding-right: 4px; } h3 > .add { padding: 3px 9px 3px 8px; font-size: 12px; }
  .pos .dl { display: none; } .pos .ds { display: inline; }
  /* On a phone a chip drops the @ before its price, and the strike takes the room, so a four-digit
     strike and a four-digit price both show whole. */
  .pos .at { display: none; }
  .pos { grid-template-columns: 1.1fr 1.25fr 1.75fr 1.3fr .55fr 1.7fr; }
  .pos > .c-k { padding: 0 2px; } .pos > .c-cp { padding: 0 3px; } .pos > .c-p { padding: 0 4px 0 0; }
}
