/* The calculator drawn as its formula: the public /tools pages since 28 Nov 2026 (draft C, Igor «c лучше», «Да, с Copy»;
   docs/product/design/calculators-2026-11-28/). Scoped to body.calc-formula over the leaf workspace's styles; the
   article, FAQ and related calculators keep their text and take the site's type. The fields are the site's own, never
   browser defaults (Igor «чтобы не было такого как стрелка упирается»). */
body.calc-formula { --cf-ink: #1d1d22; --cf-grey: #6b6b75; --cf-faint: #8a8a94; --cf-line: #ececf1; --cf-edge: #d6d6de; --cf-chip: #f1f1f5; --cf-red: #c4342d; --cf-green: #449a6b; --cf-accent: var(--lr-accent, #443ab8); }

/* The page head: the H1 and the intro verbatim, Embed quiet on the right. */
body.calc-formula.tool-leaf-workspace .page-header { margin-bottom: 0; padding-right: 220px; }
body.calc-formula.tool-leaf-workspace .leaf-breadcrumb { margin-bottom: 20px; }
body.calc-formula.tool-leaf-workspace h1 { color: var(--cf-ink); font-size: 44px; font-weight: 600; line-height: 48px; letter-spacing: -0.03em; }
/* The intro is SEO-locked text: its lines are balanced so no lone word hangs on the last one (Igor 28 Nov «перенос
   глупый» on Risk Reward's "…worth / taking."). */
body.calc-formula.tool-leaf-workspace .page-intro { max-width: 760px; margin-top: 12px; color: var(--cf-grey); font-size: 18px; line-height: 27px; text-wrap: balance; }
body.calc-formula.tool-leaf-workspace .leaf-header-action { bottom: 4px; min-height: 40px; padding: 8px 14px; border-color: #e3e3ea; border-radius: 8px; color: var(--cf-ink); font-size: 14px; font-weight: 500; }
body.calc-formula.tool-leaf-workspace .leaf-header-action :where(i, svg) { width: 16px; height: 16px; flex-basis: 16px; }

/* The one frame: the formula. */
body.calc-formula .cf-sum { margin-top: 32px; padding: 28px 28px 24px; border: 1px solid #e3e3ea; border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgb(20 16 60 / .04), 0 24px 48px -36px rgb(20 16 60 / .25); }
body.calc-formula .cf-terms { display: grid; grid-template-columns: minmax(0, 1.25fr) 28px minmax(0, .82fr) 28px minmax(0, .82fr) 28px minmax(0, 1.4fr) 36px minmax(0, 1.15fr); align-items: start; gap: 0 10px; }
body.calc-formula .cf-term > label, body.calc-formula .cf-fx > label { display: block; margin: 0 0 8px; color: var(--cf-ink); font-size: 14px; font-weight: 500; line-height: 20px; }
body.calc-formula .cf-field { display: flex; align-items: center; height: 52px; margin: 0; border: 1px solid var(--cf-edge); border-radius: 8px; background: #fff; transition: border-color .15s, box-shadow .15s; }
body.calc-formula .cf-field:hover { border-color: #c4c4ce; }
body.calc-formula .cf-field:focus-within { border-color: var(--cf-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cf-accent) 16%, transparent); }
body.calc-formula .cf-field input, body.calc-formula .cf-field select { width: 100%; min-width: 0; height: 100%; padding: 0 8px 0 14px; border: 0; background-color: transparent; color: var(--cf-ink); font-size: 20px; font-weight: 500; font-variant-numeric: tabular-nums; outline: none; box-shadow: none; }
body.calc-formula .cf-field input:focus-visible, body.calc-formula .cf-field select:focus-visible { outline: none; }
body.calc-formula .cf-field input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
body.calc-formula .cf-field input[type="number"]::-webkit-inner-spin-button, body.calc-formula .cf-field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
body.calc-formula .cf-field select, body.calc-formula .cf-mini-select { -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6b75' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; cursor: pointer; }
body.calc-formula .cf-field select { padding-right: 44px; background-position: right 14px center; background-size: 18px; font-size: 15px; text-overflow: ellipsis; }
body.calc-formula .cf-unit { flex: none; margin-right: 8px; padding: 4px 8px; border-radius: 6px; background: var(--cf-chip); color: var(--cf-grey); font-size: 13px; font-weight: 500; line-height: 18px; }
body.calc-formula .cf-field-narrow { width: 180px; }
body.calc-formula .cf-op { display: grid; place-items: center; width: 28px; height: 28px; margin-top: 40px; border-radius: 50%; background: var(--cf-chip); color: var(--cf-grey); font-size: 16px; font-weight: 500; line-height: 1; }
body.calc-formula .cf-op-eq { width: 36px; height: 36px; margin-top: 36px; background: var(--cf-accent); color: #fff; font-size: 18px; }
body.calc-formula .cf-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: 8px 0 0; color: var(--cf-grey); font-size: 13px; line-height: 18px; }
body.calc-formula .cf-sub label { margin: 0; white-space: nowrap; color: var(--cf-grey); font-size: 13px; font-weight: 400; }
body.calc-formula .cf-mini-select { padding: 3px 26px 3px 8px; border: 1px solid #e3e3ea; border-radius: 6px; background-color: #fff; background-position: right 6px center; background-size: 14px; color: var(--cf-ink); font-size: 13px; font-weight: 500; line-height: 18px; }
body.calc-formula .cf-hint { margin: 8px 0 0; color: var(--cf-faint); font-size: 13px; line-height: 18px; }
body.calc-formula .cf-presets { display: flex; gap: 6px; margin: 8px 0 0; }
body.calc-formula .cf-presets button { padding: 3px 10px; border: 1px solid #e3e3ea; border-radius: 999px; background: #fff; color: var(--cf-grey); font-size: 13px; font-weight: 500; line-height: 18px; cursor: pointer; }
body.calc-formula .cf-presets button:hover { border-color: #cfcfd8; color: var(--cf-ink); }
body.calc-formula .cf-presets button[aria-pressed="true"] { border-color: color-mix(in srgb, var(--cf-accent) 40%, #e3e3ea); background: #f3f2fc; color: var(--cf-accent); }
body.calc-formula .cf-error { margin: 8px 0 0; color: var(--cf-red); font-size: 13px; line-height: 18px; }
body.calc-formula .cf-error[hidden] { display: none; }
body.calc-formula .cf-term:has(input[aria-invalid="true"]) .cf-field, body.calc-formula .cf-fx:has(input[aria-invalid="true"]) .cf-field { border-color: var(--cf-red); box-shadow: 0 0 0 3px rgb(196 52 45 / .12); }

body.calc-formula .cf-answer { display: flex; flex-direction: column; min-width: 0; padding-left: 4px; }
body.calc-formula .cf-answer-label { color: var(--cf-ink); font-size: 14px; font-weight: 500; line-height: 20px; }
body.calc-formula .cf-answer-row { display: flex; align-items: center; gap: 12px; }
body.calc-formula .cf-answer strong { margin: 2px 0 0; white-space: nowrap; color: var(--cf-ink); font-size: 56px; font-weight: 600; line-height: 60px; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-answer strong.is-tick { animation: cf-tick .32s ease; }
body.calc-formula .cf-answer strong.is-fit-1 { font-size: 44px; line-height: 60px; letter-spacing: -0.03em; }
body.calc-formula .cf-answer strong.is-fit-2 { font-size: 36px; }
/* A price as the answer (Fibonacci's level, the pivot: six figures to four places) at the next step down, the fields'
   height, not over them (Igor 28 Nov «не большие?» on 1.1007 at 56). */
body.calc-formula .cf-answer[data-size="price"] strong { font-size: 44px; line-height: 60px; letter-spacing: -0.03em; }
/* No answer yet (a field is wrong or empty): a quiet dash, not a 56 px bar. */
body.calc-formula .cf-answer strong.is-empty { color: var(--cf-faint); font-size: 32px; line-height: 60px; }
body.calc-formula .cf-sum:has([aria-invalid="true"]) .rr-verdict { display: none; }
@keyframes cf-tick { 0% { color: var(--cf-accent); } 100% { color: var(--cf-ink); } }
body.calc-formula .cf-answer-unit { color: var(--cf-grey); font-size: 14px; line-height: 20px; }
body.calc-formula .cf-copy { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: 1px solid #e3e3ea; border-radius: 8px; background: #fff; color: var(--cf-ink); font-size: 13px; font-weight: 500; cursor: pointer; }
body.calc-formula .cf-copy:hover { border-color: #cfcfd8; }
body.calc-formula .cf-copy :where(i, svg) { width: 14px; height: 14px; flex-basis: 14px; color: var(--cf-grey); }

body.calc-formula .cf-fx { display: grid; grid-template-columns: max-content 180px minmax(0, 1fr); align-items: center; gap: 4px 16px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--cf-line); }
body.calc-formula .cf-fx > label { margin: 0; }
/* An exchange rate typed in a sub-line (Margin's «1 EUR = [1.0850] USD»): the mini select's size, a number field. */
body.calc-formula .cf-fx > #marginFxGroup { grid-column: 2 / -1; }
body.calc-formula .cf-fx > #marginFxGroup[hidden] { display: none; }
body.calc-formula.tool-leaf-workspace .cf-sub .cf-mini-input { width: 84px; height: auto; min-height: 0; margin: 0; padding: 3px 8px; border: 1px solid #e3e3ea; border-radius: 6px; background: #fff; box-shadow: none; color: var(--cf-ink); font-size: 13px; font-weight: 500; line-height: 18px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
body.calc-formula .cf-sub .cf-mini-input::-webkit-inner-spin-button, body.calc-formula .cf-sub .cf-mini-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
body.calc-formula .cf-sub .cf-mini-input:focus { border-color: var(--cf-accent); outline: none; }
body.calc-formula .cf-answer-unit.is-loss, body.calc-formula .cf-means dd.is-loss { color: var(--cf-red); }
body.calc-formula .cf-fx[hidden] { display: none; }
body.calc-formula .cf-fx .cf-hint { margin: 0; }
body.calc-formula .cf-fx .cf-error { grid-column: 1 / -1; }

body.calc-formula .cf-lines { display: grid; gap: 10px; margin: 24px 0 0; padding: 20px 0 0; border-top: 1px solid var(--cf-line); list-style: none; }
body.calc-formula .cf-lines li { display: grid; grid-template-columns: 24px 120px minmax(0, 1fr); align-items: center; gap: 12px; color: var(--cf-grey); font-size: 15px; line-height: 22px; }
body.calc-formula .cf-line-op { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--cf-chip); color: var(--cf-grey); font-size: 13px; line-height: 1; }
/* A line's figure is the line's size, whatever class its controller gives it (Kelly's .kelly-value is a hero size). */
body.calc-formula .cf-lines b { margin: 0; color: var(--cf-ink); font-size: inherit; font-weight: 600; line-height: inherit; letter-spacing: normal; text-align: left; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-lines li:last-child b { color: var(--cf-accent); }
body.calc-formula .cf-lines i { color: var(--cf-faint); font-style: normal; }
body.calc-formula .cf-lines.is-empty { opacity: .5; }
body.calc-formula .cf-note { margin: 16px 0 0; color: var(--cf-faint); font-size: 12px; line-height: 16px; }

/* Sums of two and three terms (Pip; Margin and Risk Reward), and a term with no operator before it (the prices of a
   trade are not multiplied). */
body.calc-formula .cf-terms[data-terms="2"] { grid-template-columns: minmax(0, 1.2fr) 28px minmax(0, 1fr) 36px minmax(0, 1.1fr); }
body.calc-formula .cf-terms[data-terms="3"] { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr) 36px minmax(0, 1.1fr); }
body.calc-formula .cf-terms[data-terms="3"][data-wide="2"] { grid-template-columns: minmax(0, .85fr) 28px minmax(0, 1.3fr) 28px minmax(0, .85fr) 36px minmax(0, 1.1fr); }
body.calc-formula .cf-terms[data-terms="4"] { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, .85fr) 28px minmax(0, 1.25fr) 36px minmax(0, 1.15fr); }
/* Four prices of one kind (Pivot Point's high, low, close and open) take one width each. */
@media (min-width: 1321px) { body.calc-formula .cf-terms[data-terms="4"][data-even] { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr) 36px minmax(0, 1fr); } }
/* Four fields and a money answer (Forex Profit, Crypto Profit, Liquidation): the fields share one row and the answer takes
   its own under them, at full size (Igor 28 Nov «перестраивай сетку калькулятора если надо», on $45,250.00 running out
   of the frame beside four fields). */
body.calc-formula .cf-terms[data-answer="below"] { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr); row-gap: 20px; }
body.calc-formula .cf-terms[data-answer="below"] > .cf-op-eq { display: none; }
body.calc-formula .cf-terms[data-answer="below"] > .cf-answer { grid-column: 1 / -1; padding: 16px 0 0; border-top: 1px solid var(--cf-line); }
body.calc-formula .cf-terms > .cf-op.is-blank { visibility: hidden; }
/* A profit or loss in its sign's colour; the coin switch of Crypto Profit and the side switch of Liquidation are the same
   segmented control as Risk Reward's. */
body.calc-formula .cf-answer strong.is-gain { color: var(--cf-green); }
body.calc-formula .cf-answer strong.is-loss { color: var(--cf-red); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .crypto-btn { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 32px; min-height: 0; margin: 0; padding: 0 14px; border: 0; border-radius: 6px; background: none; box-shadow: none; color: var(--cf-grey); font-size: 14px; font-weight: 500; line-height: 20px; cursor: pointer; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .crypto-btn:hover { color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .crypto-btn.active { background: #fff; box-shadow: 0 1px 2px rgb(20 16 60 / .08), 0 0 0 1px rgb(20 16 60 / .05); color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .crypto-btn :where(i, svg) { width: 16px; height: 16px; flex-basis: 16px; }
body.calc-formula .cf-line-op.is-start { visibility: hidden; }

/* Long or short: Journal's segmented control, above the sum. */
body.calc-formula .cf-dir { display: inline-flex; gap: 2px; margin: 0 0 20px; padding: 3px; border-radius: 8px; background: var(--cf-chip); }
/* Specific enough to win over the public buttons' pill (public-workspace.css rounds every .trade-type-btn to 999 px;
   Igor 28 Nov «рамки»: a pill key in a square track). */
body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .trade-type-btn { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 32px; min-height: 0; margin: 0; padding: 0 14px; border: 0; border-radius: 6px; background: none; box-shadow: none; color: var(--cf-grey); font-size: 14px; font-weight: 500; line-height: 20px; cursor: pointer; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .trade-type-btn:hover { color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .trade-type-btn.active { background: #fff; box-shadow: 0 1px 2px rgb(20 16 60 / .08), 0 0 0 1px rgb(20 16 60 / .05); color: var(--cf-ink); }
body.calc-formula .cf-dir .trade-type-btn :where(i, svg) { width: 16px; height: 16px; flex-basis: 16px; }
body.calc-formula .cf-dir .trade-type-btn.long.active :where(i, svg) { color: var(--cf-green); }
body.calc-formula .cf-dir .trade-type-btn.short.active :where(i, svg) { color: var(--cf-red); }
body.calc-formula .cf-answer .rr-verdict { margin: 8px 0 0; padding: 0; border: 0; background: none; color: var(--cf-red); font-size: 13px; line-height: 18px; }
body.calc-formula .cf-answer .rr-verdict[hidden] { display: none; }

/* Stock Average (28 Nov): the purchases are the sum. Each row reads price × shares = cost, the empty last row waits for
   the next buy; the assets are keys of the segmented control, and the average with its receipt sits on the right. */
body.calc-formula .cf-sum[data-layout="purchases"] { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; row-gap: 24px; }
body.calc-formula .cf-avg-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; margin: 0 0 16px; }
body.calc-formula .cf-avg-head .cf-sub { margin: 0; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-avg-assets { display: inline-flex; flex-wrap: wrap; gap: 2px; margin: 0; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-avg-assets .asset-tab { display: inline-flex; align-items: center; gap: 4px; height: 32px; min-height: 0; margin: 0; padding: 0 6px 0 14px; border: 0; border-radius: 6px; background: none; box-shadow: none; color: var(--cf-grey); font-size: 14px; font-weight: 500; line-height: 20px; cursor: pointer; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-avg-assets .asset-tab:hover { color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-avg-assets .asset-tab.active { background: #fff; box-shadow: 0 1px 2px rgb(20 16 60 / .08), 0 0 0 1px rgb(20 16 60 / .05); color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-avg-assets .asset-tab-remove { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; border-radius: 4px; color: var(--cf-faint); font-size: 16px; line-height: 1; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-avg-assets .asset-tab-remove:hover { background: var(--cf-chip); color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-avg-assets .asset-tab-add { display: inline-grid; place-items: center; width: 32px; height: 32px; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--cf-grey); cursor: pointer; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-avg-assets .asset-tab-add:hover { color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-avg-assets .asset-tab-add :where(i, svg) { width: 16px; height: 16px; }

body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries { width: 100%; margin: 0; border: 0; border-collapse: collapse; table-layout: fixed; background: none; font-variant-numeric: tabular-nums; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries th { padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--cf-line); background: none; color: var(--cf-grey); font-size: 13px; font-weight: 500; line-height: 18px; letter-spacing: normal; text-align: left; text-transform: none; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td { padding: 8px 0 0; border: 0; background: none; color: var(--cf-ink); font-size: 15px; line-height: 22px; vertical-align: middle; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries :is(th, td):nth-child(1) { width: 32px; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td:nth-child(1) { color: var(--cf-faint); font-size: 13px; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries :is(th, td):nth-child(4) { width: 160px; text-align: right; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td:nth-child(4) { font-weight: 600; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries :is(th, td):nth-child(5) { width: 44px; text-align: right; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries :is(td:nth-child(2), td:nth-child(3)) { padding-right: 12px; white-space: nowrap; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries :is(td:nth-child(2), td:nth-child(3))::after { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-left: 12px; border-radius: 50%; background: var(--cf-chip); color: var(--cf-grey); font-size: 14px; font-weight: 500; line-height: 1; vertical-align: middle; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td:nth-child(2)::after { content: "×"; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td:nth-child(3)::after { content: "="; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries input { width: calc(100% - 36px); height: 44px; min-height: 0; margin: 0; padding: 0 12px; border: 1px solid var(--cf-edge); border-radius: 8px; background: #fff; box-shadow: none; color: var(--cf-ink); font-size: 17px; font-weight: 500; font-variant-numeric: tabular-nums; vertical-align: middle; -moz-appearance: textfield; appearance: textfield; transition: border-color .15s, box-shadow .15s; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries input::-webkit-inner-spin-button, body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries input::placeholder { color: #b4b4bd; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries input:hover { border-color: #c4c4ce; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries input:focus { border-color: var(--cf-accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--cf-accent) 16%, transparent); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries .remove-row-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; min-height: 0; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--cf-faint); cursor: pointer; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries .remove-row-btn:hover { background: var(--cf-chip); color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries .remove-row-btn :where(i, svg) { width: 14px; height: 14px; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-add { display: inline-flex; align-items: center; gap: 6px; min-height: 0; margin: 12px 0 0; padding: 6px 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: var(--cf-accent); font-size: 14px; font-weight: 500; line-height: 20px; cursor: pointer; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-add:hover { text-decoration: underline; text-underline-offset: 3px; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-add :where(i, svg) { width: 16px; height: 16px; }
body.calc-formula .cf-sum[data-layout="purchases"] .cf-note { margin: 12px 0 0; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td.is-blank { color: var(--cf-faint); font-weight: 400; }
body.calc-formula .cf-sum[data-layout="purchases"] .tool-local-status { margin: 0 0 12px; }

/* Currency Converter (28 Nov): the source currency is the amount's unit, a select in the field; the swap key stands where
   the operator does; the popular pairs are keys under the frame, the pair in the sum marked. */
body.calc-formula .cf-field select.cf-unit-select { flex: none; width: auto; height: 32px; margin-right: 8px; padding: 0 28px 0 10px; border-radius: 6px; background-color: var(--cf-chip); background-position: right 8px center; background-size: 14px; color: var(--cf-ink); font-size: 14px; font-weight: 600; }
body.calc-formula.tool-leaf-workspace .cf-terms .cf-op-swap { display: grid; place-items: center; width: 28px; height: 28px; min-width: 0; min-height: 0; margin-top: 40px; padding: 0; border: 0; border-radius: 50%; background: var(--cf-chip); box-shadow: none; color: var(--cf-ink); cursor: pointer; transition: background-color .15s, transform .2s; }
body.calc-formula.tool-leaf-workspace .cf-terms .cf-op-swap:hover { background: #e4e4ec; }
body.calc-formula.tool-leaf-workspace .cf-terms .cf-op-swap:active { transform: rotate(180deg); }
body.calc-formula.tool-leaf-workspace .cf-terms .cf-op-swap :where(i, svg) { width: 14px; height: 14px; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-presets .quick-btn { min-height: 0; margin: 0; padding: 3px 10px; border: 1px solid #e3e3ea; border-radius: 999px; background: #fff; box-shadow: none; color: var(--cf-grey); font-size: 13px; font-weight: 500; line-height: 18px; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-presets .quick-btn:hover { border-color: #cfcfd8; color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-presets .quick-btn[aria-pressed="true"] { border-color: color-mix(in srgb, var(--cf-accent) 40%, #e3e3ea); background: #f3f2fc; color: var(--cf-accent); }
body.calc-formula .cf-pairs { margin-top: 48px; }
body.calc-formula .cf-pairs h2 { margin: 0; color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; letter-spacing: -0.01em; }
body.calc-formula.tool-leaf-workspace .cf-pairs .pairs-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin: 16px 0 0; }
body.calc-formula.tool-leaf-workspace .cf-pairs .pairs-grid .pair-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 0; margin: 0; padding: 12px 14px; border: 1px solid #e3e3ea; border-radius: 12px; background: #fff; box-shadow: none; color: var(--cf-ink); text-align: left; cursor: pointer; transition: border-color .15s; }
body.calc-formula.tool-leaf-workspace .cf-pairs .pairs-grid .pair-btn:hover { border-color: #cfcfd8; }
body.calc-formula.tool-leaf-workspace .cf-pairs .pairs-grid .pair-btn.is-on { border-color: color-mix(in srgb, var(--cf-accent) 45%, #e3e3ea); background: #f7f6fd; }
body.calc-formula .cf-pairs .pair-name { color: var(--cf-grey); font-size: 13px; font-weight: 500; line-height: 18px; }
body.calc-formula .cf-pairs .pair-rate { color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-pairs .pair-btn.is-on .pair-name { color: var(--cf-accent); }

/* Exchange Fees (28 Nov): every exchange on the same trade, lowest first, one row each: the name (its partner link) and
   rate, a bar of its fee against the dearest, the fee. The cards and the old bar chart in one list; the lowest in green,
   the rest grey (Igor 28 Nov «а почему цвет разный?»: a second colour read as a second kind). */
body.calc-formula .cf-fees { margin-top: 48px; }
body.calc-formula .cf-fees h2 { margin: 0; color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; letter-spacing: -0.01em; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-cards { display: block; margin: 16px 0 0; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card { position: relative; display: grid; grid-template-columns: minmax(0, 240px) minmax(0, 1fr) 112px 96px; align-items: center; gap: 0 24px; min-height: 0; margin: 0; padding: 14px 0; border: 0; border-top: 1px solid var(--cf-line); border-radius: 0; background: none; box-shadow: none; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card::after { content: ""; grid-column: 2; grid-row: 1; height: 8px; border-radius: 4px; background: linear-gradient(to right, #c4c4ce calc(var(--cf-share, 0) * 100%), var(--cf-chip) 0); }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card.is-lowest::after { background: linear-gradient(to right, var(--cf-green) calc(var(--cf-share, 0) * 100%), var(--cf-chip) 0); }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-top { display: flex; grid-column: 1; grid-row: 1; align-items: center; gap: 12px; min-width: 0; margin: 0; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-logo { display: grid; flex: none; place-items: center; width: 28px; height: 28px; margin: 0; padding: 0; border: 0; border-radius: 6px; background: none; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-logo img { width: 24px; height: 24px; border-radius: 6px; object-fit: contain; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-logo.is-wide img { width: 28px; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-name { font-size: 15px; font-weight: 600; line-height: 22px; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-name a { color: var(--cf-ink); text-decoration: none; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-name a:hover { color: var(--cf-accent); }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-rate { color: var(--cf-grey); font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-amount { grid-column: 3; grid-row: 1; margin: 0; color: var(--cf-ink); font-size: 17px; font-weight: 600; line-height: 24px; text-align: right; font-variant-numeric: tabular-nums; }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card.is-lowest .fee-card-amount { color: var(--cf-green); }
body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-badge { position: static; grid-column: 4; grid-row: 1; justify-self: start; margin: 0; padding: 2px 8px; border: 0; border-radius: 999px; background: color-mix(in srgb, var(--cf-green) 12%, #fff); color: var(--cf-green); font-size: 12px; font-weight: 500; line-height: 18px; }

/* Funding Rates (28 Nov): the frame holds the market now (the highest, the lowest, the average year) and how a year is
   counted; every market follows flat, its search and sort in its own head. Rates in their sign's colour. */
body.calc-formula .cf-fr-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
body.calc-formula.tool-leaf-workspace .cf-funding .fr-updated { display: inline-flex; align-items: center; gap: 8px; color: var(--cf-grey); font-size: 13px; line-height: 18px; }
body.calc-formula.tool-leaf-workspace .cf-funding .fr-updated .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cf-green); }
body.calc-formula.tool-leaf-workspace .cf-funding .cf-fr-refresh { display: inline-flex; align-items: center; gap: 6px; height: 32px; min-height: 0; margin: 0; padding: 0 12px; border: 1px solid #e3e3ea; border-radius: 8px; background: #fff; box-shadow: none; color: var(--cf-ink); font-size: 13px; font-weight: 500; cursor: pointer; }
body.calc-formula.tool-leaf-workspace .cf-funding .cf-fr-refresh:hover { border-color: #cfcfd8; }
body.calc-formula.tool-leaf-workspace .cf-funding .cf-fr-refresh :where(i, svg) { width: 14px; height: 14px; color: var(--cf-grey); }
body.calc-formula.tool-leaf-workspace .cf-funding .cf-fr-refresh.loading :where(i, svg) { animation: cf-spin 1s linear infinite; }
@keyframes cf-spin { to { transform: rotate(360deg); } }
body.calc-formula .cf-fr-status { margin: 12px 0 0; color: var(--cf-grey); font-size: 13px; line-height: 18px; }
body.calc-formula .cf-fr-status[hidden] { display: none; }
body.calc-formula .cf-fr-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; margin: 20px 0 0; }
body.calc-formula .cf-fr-facts > div { display: flex; flex-direction: column; min-width: 0; }
body.calc-formula .cf-fr-facts dt { color: var(--cf-ink); font-size: 14px; font-weight: 500; line-height: 20px; }
body.calc-formula .cf-fr-facts dd { margin: 0; }
body.calc-formula .cf-fr-facts strong { display: block; margin: 2px 0 0; white-space: nowrap; color: var(--cf-ink); font-size: 44px; font-weight: 600; line-height: 52px; letter-spacing: -0.03em; font-variant-numeric: normal; }
body.calc-formula .cf-fr-facts strong.positive { color: var(--cf-green); }
body.calc-formula .cf-fr-facts strong.negative { color: var(--cf-red); }
body.calc-formula .cf-fr-facts .cf-fr-meta { color: var(--cf-grey); font-size: 14px; line-height: 20px; }
body.calc-formula .cf-funding .cf-note { margin: 20px 0 0; padding: 16px 0 0; border-top: 1px solid var(--cf-line); }
body.calc-formula .cf-fr-markets { margin-top: 48px; }
body.calc-formula .cf-fr-markets-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px; }
body.calc-formula .cf-fr-markets h2 { margin: 0; color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; letter-spacing: -0.01em; }
body.calc-formula .cf-fr-controls { display: flex; align-items: center; gap: 8px; }
body.calc-formula .cf-fr-search { display: flex; align-items: center; gap: 6px; height: 36px; margin: 0; padding: 0 10px; border: 1px solid #e3e3ea; border-radius: 8px; background: #fff; }
body.calc-formula .cf-fr-search:focus-within { border-color: var(--cf-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cf-accent) 16%, transparent); }
body.calc-formula .cf-fr-search :where(i, svg) { flex: none; width: 14px; height: 14px; color: var(--cf-grey); }
body.calc-formula.tool-leaf-workspace .cf-fr-search input { width: 160px; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; color: var(--cf-ink); font-size: 14px; outline: none; }
body.calc-formula.tool-leaf-workspace .cf-fr-controls select.cf-mini-select { width: auto; height: 36px; min-height: 0; margin: 0; padding: 0 30px 0 10px; border: 1px solid #e3e3ea; border-radius: 8px; box-shadow: none; font-size: 14px; line-height: 20px; }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table { width: 100%; margin: 16px 0 0; border: 0; border-collapse: collapse; background: none; font-variant-numeric: tabular-nums; }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table th { padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--cf-line); background: none; color: var(--cf-grey); font-size: 13px; font-weight: 500; line-height: 18px; letter-spacing: normal; text-align: right; text-transform: none; }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table th a { color: var(--cf-grey); text-decoration: none; }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table th a:hover { color: var(--cf-accent); }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table td { padding: 10px 0; border: 0; border-bottom: 1px solid var(--cf-line); background: none; color: var(--cf-ink); font-size: 15px; line-height: 22px; text-align: right; }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table :is(th, td):first-child { text-align: left; }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table td:first-child { font-weight: 600; }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table tr:last-child td { border-bottom: 0; }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table .positive { color: var(--cf-green); }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table .negative { color: var(--cf-red); }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table .na { color: var(--cf-faint); }
body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table :is(.fr-empty, .fr-loading) { padding: 28px 0; color: var(--cf-grey); text-align: center; }

/* Fibonacci and Pivot Point (28 Nov): the trend, the level set and the method are keys of the same segmented control;
   every level in a flat table beside its map; the golden level and the pivot in the accent, support green, resistance red. */
body.calc-formula.tool-leaf-workspace .tool-local-workbench .cf-dir :is(.trend-btn, .results-tab, .method-tab) { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 32px; min-height: 0; margin: 0; padding: 0 14px; border: 0; border-radius: 6px; background: none; box-shadow: none; color: var(--cf-grey); font-size: 14px; font-weight: 500; line-height: 20px; cursor: pointer; }
body.calc-formula.tool-leaf-workspace .tool-local-workbench .cf-dir :is(.trend-btn, .results-tab, .method-tab):hover { color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .tool-local-workbench .cf-dir :is(.trend-btn, .results-tab, .method-tab).active { background: #fff; box-shadow: 0 1px 2px rgb(20 16 60 / .08), 0 0 0 1px rgb(20 16 60 / .05); color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .tool-local-workbench .cf-dir .trend-btn :where(i, svg) { width: 16px; height: 16px; flex-basis: 16px; }
body.calc-formula .cf-dir .trend-btn.active[data-trend="uptrend"] :where(i, svg) { color: var(--cf-green); }
body.calc-formula .cf-dir .trend-btn.active[data-trend="downtrend"] :where(i, svg) { color: var(--cf-red); }
body.calc-formula .cf-levels .cf-curve-head { align-items: center; }
body.calc-formula .cf-levels .cf-dir { margin: 0; }
body.calc-formula .cf-levels h2 { margin: 0; color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; letter-spacing: -0.01em; }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table { width: 100%; margin: 16px 0 0; border: 0; border-collapse: collapse; background: none; font-variant-numeric: tabular-nums; }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table th { padding: 0 0 8px; border: 0; border-bottom: 1px solid var(--cf-line); background: none; color: var(--cf-grey); font-size: 13px; font-weight: 500; line-height: 18px; letter-spacing: normal; text-align: left; text-transform: none; }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table td { padding: 9px 0; border: 0; border-bottom: 1px solid var(--cf-line); background: none; color: var(--cf-ink); font-size: 15px; line-height: 22px; }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table tr:last-child td { border-bottom: 0; }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table :is(th, td):nth-child(2), body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table :is(th, td):nth-child(3) { text-align: right; }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table :is(th, td):nth-child(4) { width: 110px; padding-left: 24px; }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table .level-name { font-weight: 600; }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table .level-distance { color: var(--cf-grey); }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table :is(.golden, .level-name.pivot) { color: var(--cf-accent); }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table tr:has(:is(.golden, .level-name.pivot)) td { background: #f7f6fd; }
body.calc-formula.tool-leaf-workspace .cf-levels .level-type { display: inline; padding: 0; border: 0; border-radius: 0; background: none; color: var(--cf-grey); font-size: 13px; text-transform: capitalize; }
body.calc-formula.tool-leaf-workspace .cf-levels .level-type.support { color: var(--cf-green); }
body.calc-formula.tool-leaf-workspace .cf-levels .level-type.resistance { color: var(--cf-red); }
body.calc-formula.tool-leaf-workspace .cf-levels .level-type:is(.target, .pivot) { color: var(--cf-accent); }
body.calc-formula.tool-leaf-workspace .cf-levels .levels-empty-row td { padding: 24px 0; color: var(--cf-grey); text-align: center; }
/* The level's bar: from --cf-a to --cf-b of its track; the pivot's track has its centre marked. */
body.calc-formula .cf-levels { margin-top: 48px; }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table :is(th, td):nth-child(5) { width: 30%; padding-left: 32px; text-align: left; }
body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table td.cf-lv-bar::before { content: ""; display: block; height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--cf-chip) calc(var(--cf-a, 0) * 100%), var(--cf-lv, #c4c4ce) calc(var(--cf-a, 0) * 100%), var(--cf-lv, #c4c4ce) calc(var(--cf-b, 0) * 100%), var(--cf-chip) calc(var(--cf-b, 0) * 100%)); }
body.calc-formula .cf-levels td.cf-lv-bar[data-kind="support"] { --cf-lv: var(--cf-green); }
body.calc-formula .cf-levels td.cf-lv-bar[data-kind="resistance"] { --cf-lv: var(--cf-red); }
body.calc-formula .cf-levels td.cf-lv-bar[data-kind="golden"] { --cf-lv: var(--cf-accent); }
body.calc-formula.tool-leaf-workspace .cf-levels #levelsBody td.cf-lv-bar::before { background: linear-gradient(to right, transparent calc(50% - 1px), #b9b5e6 calc(50% - 1px), #b9b5e6 calc(50% + 1px), transparent calc(50% + 1px)), linear-gradient(to right, var(--cf-chip) calc(var(--cf-a, 0) * 100%), var(--cf-lv, #c4c4ce) calc(var(--cf-a, 0) * 100%), var(--cf-lv, #c4c4ce) calc(var(--cf-b, 0) * 100%), var(--cf-chip) calc(var(--cf-b, 0) * 100%)); }
body.calc-formula.tool-leaf-workspace .cf-levels #levelsBody td.cf-lv-bar[data-kind="pivot"]::before { background: radial-gradient(circle at 50% 50%, var(--cf-accent) 4px, transparent 4.5px), var(--cf-chip); height: 10px; border-radius: 5px; }

/* Prop Firm (28 Nov, Igor «Проп B»): one question the visitor asks, the answer as a sentence, the firm's three limits as
   bars; the averages in one line to open; the other firms one row each, their partner link when they clear. */
body.calc-formula .cf-prop-grid { display: grid; grid-template-columns: minmax(0, 1fr) 1px minmax(0, 1fr); gap: 0 40px; align-items: start; }
body.calc-formula .cf-prop-sep { align-self: stretch; background: var(--cf-line); }
body.calc-formula .cf-prop-ask { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 0; color: var(--cf-grey); font-size: 15px; line-height: 24px; }
body.calc-formula .cf-prop-end { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
body.calc-formula .cf-prop-ask .cf-mini-select { height: 32px; padding: 0 28px 0 10px; border-radius: 8px; color: var(--cf-ink); font-size: 15px; font-weight: 600; }
body.calc-formula .cf-prop .cf-answer { margin: 14px 0 0; padding: 0; border: 0; }
body.calc-formula .cf-prop .cf-answer strong { white-space: normal; font-size: 44px; line-height: 52px; letter-spacing: -0.03em; }
body.calc-formula .cf-prop .cf-answer strong.is-empty { color: var(--cf-ink); }
body.calc-formula .cf-prop-why { display: block; margin: 6px 0 0; color: var(--cf-grey); font-size: 16px; line-height: 24px; text-wrap: pretty; }
body.calc-formula .cf-prop-avg { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; margin: 20px 0 0; padding: 16px 0 0; border-top: 1px solid var(--cf-line); color: var(--cf-grey); font-size: 14px; line-height: 20px; }
body.calc-formula .cf-prop-avg b { color: var(--cf-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
body.calc-formula.tool-leaf-workspace .cf-prop .cf-prop-edit { min-height: 0; margin: 0; padding: 0; border: 0; background: none; box-shadow: none; color: var(--cf-accent); font-size: 14px; font-weight: 500; cursor: pointer; }
body.calc-formula.tool-leaf-workspace .cf-prop .cf-prop-edit:hover { text-decoration: underline; text-underline-offset: 3px; }
body.calc-formula .cf-prop .cf-prop-inputs { margin: 16px 0 0; }
body.calc-formula .cf-prop .cf-prop-inputs[hidden] { display: none; }
body.calc-formula .cf-prop .cf-prop-inputs[data-terms="4"] { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr) 24px minmax(0, 1fr); }
body.calc-formula .cf-prop .cf-prop-inputs .cf-field { height: 44px; }
body.calc-formula .cf-prop .cf-prop-inputs .cf-field input { font-size: 17px; }
body.calc-formula .cf-prop .cf-prop-inputs .cf-op { width: 24px; height: 24px; margin-top: 38px; font-size: 14px; }
body.calc-formula .cf-prop-next, body.calc-formula .cf-prop-q > .firm-cta { display: inline-flex; align-items: center; gap: 6px; margin: 16px 16px 0 0; color: var(--cf-accent); font-size: 15px; font-weight: 500; text-decoration: none; }
body.calc-formula .cf-prop-next:hover, body.calc-formula .cf-prop-q > .firm-cta:hover { text-decoration: underline; text-underline-offset: 3px; }
body.calc-formula .cf-prop-next :where(i, svg) { width: 16px; height: 16px; }
body.calc-formula .cf-prop-q > .firm-cta { color: var(--cf-green); }
body.calc-formula .cf-prop-bars { display: grid; gap: 22px; padding-top: 6px; }
body.calc-formula .cf-prop-meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; column-gap: 12px; row-gap: 6px; }
body.calc-formula .cf-prop-meter > span { grid-column: 1; color: var(--cf-ink); font-size: 14px; line-height: 20px; }
body.calc-formula .cf-prop-meter > i { grid-column: 1; grid-row: 2; height: 12px; border-radius: 6px; background: linear-gradient(to right, var(--cf-m, var(--cf-green)) calc(var(--s, 0) * 100%), var(--cf-chip) 0); }
body.calc-formula .cf-prop-meter.is-target { --cf-m: var(--cf-accent); }
body.calc-formula .cf-prop-meter.is-hot { --cf-m: var(--cf-red); }
body.calc-formula .cf-prop-meter > em { grid-column: 2; grid-row: 2; color: var(--cf-ink); font-size: 15px; font-style: normal; font-weight: 600; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-prop .cf-note { margin: 20px 0 0; }
body.calc-formula .cf-prop.is-stale .cf-prop-bars, body.calc-formula .cf-prop-others.is-stale .cf-prop-rows { opacity: .35; }
body.calc-formula :is(.cf-prop, .cf-prop-others).is-stale .firm-cta { display: none; }
body.calc-formula .cf-prop-others { margin-top: 48px; }
body.calc-formula .cf-prop-others h2 { margin: 0; color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; letter-spacing: -0.01em; }
body.calc-formula .cf-prop-rows { margin: 16px 0 0; }
body.calc-formula .cf-prop-row { display: grid; grid-template-columns: 200px repeat(3, minmax(0, 1fr)) 170px; align-items: center; gap: 0 28px; padding: 14px 0; border-top: 1px solid var(--cf-line); }
body.calc-formula .cf-prop-row .cf-prop-meter { grid-template-rows: auto 8px; }
body.calc-formula .cf-prop-row .cf-prop-meter > span { color: var(--cf-grey); font-size: 12px; line-height: 16px; }
body.calc-formula .cf-prop-row .cf-prop-meter > i { height: 8px; border-radius: 4px; }
body.calc-formula .cf-prop-row .cf-prop-meter > em { font-size: 13px; }
body.calc-formula .cf-prop-name b { display: block; color: var(--cf-ink); font-size: 15px; font-weight: 600; line-height: 22px; }
body.calc-formula .cf-prop-name small { color: var(--cf-faint); font-size: 12px; line-height: 16px; }
body.calc-formula .cf-prop-verdict { justify-self: start; padding: 3px 10px; border-radius: 999px; background: var(--cf-chip); color: var(--cf-grey); font-size: 13px; font-weight: 500; line-height: 18px; }
body.calc-formula .cf-prop-row.is-pass .cf-prop-verdict { background: color-mix(in srgb, var(--cf-green) 12%, #fff); color: var(--cf-green); }
body.calc-formula .cf-prop-row.is-marginal .cf-prop-verdict { background: #f3f2fc; color: var(--cf-accent); }
body.calc-formula .cf-prop-row > .firm-cta { grid-column: 1 / -1; justify-self: end; margin-top: 6px; color: var(--cf-green); font-size: 14px; font-weight: 500; text-decoration: none; }

/* Remove Worst Trades (28 Nov, Igor «худшие B»): one line to drop a file over the example; what the worst trades cost, red;
   the year drawn twice, every trade (ink) and without the worst (green), the worst marked where they fell; the list and
   what else moves under it. */
body.calc-formula.tool-leaf-workspace .cf-worst .cf-worst-drop { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 24px; padding: 12px 16px; border: 1px dashed #cfcfd8; border-radius: 10px; background: none; color: #4b4f60; font-size: 14px; line-height: 20px; text-align: left; cursor: pointer; }
body.calc-formula.tool-leaf-workspace .cf-worst .cf-worst-drop.dragover { border-color: var(--cf-accent); background: #f7f6fd; }
body.calc-formula .cf-worst-drop b { color: var(--cf-ink); }
body.calc-formula .cf-worst-drop-btn { flex: none; padding: 8px 14px; border-radius: 8px; background: var(--cf-accent); color: #fff; font-size: 14px; font-weight: 500; }
body.calc-formula.tool-leaf-workspace .cf-worst.is-example .mapping-section { display: none; }
body.calc-formula.tool-leaf-workspace .cf-worst .mapping-section { margin: 0 0 24px; }
body.calc-formula.tool-leaf-workspace .cf-worst .file-info { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--cf-ink); font-size: 14px; }
body.calc-formula.tool-leaf-workspace .cf-worst .preview-table { margin: 12px 0 0; overflow-x: auto; font-size: 13px; }
body.calc-formula.tool-leaf-workspace .cf-worst .preview-table table { border-collapse: collapse; }
body.calc-formula.tool-leaf-workspace .cf-worst .preview-table :is(th, td) { padding: 4px 12px 4px 0; border-bottom: 1px solid var(--cf-line); color: var(--cf-grey); text-align: left; white-space: nowrap; }
body.calc-formula .cf-worst-map { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 16px 0 0; }
body.calc-formula .cf-worst-map .cf-sub { margin: 0; }
body.calc-formula.tool-leaf-workspace .cf-worst .cf-worst-go { display: inline-flex; align-items: center; gap: 8px; min-height: 0; margin: 16px 0 0; padding: 10px 16px; border: 0; border-radius: 8px; background: var(--cf-accent); color: #fff; font-size: 14px; font-weight: 500; cursor: pointer; }
body.calc-formula .cf-worst-go :where(i, svg) { width: 16px; height: 16px; }
body.calc-formula.tool-leaf-workspace .cf-worst .results-section { margin: 0; }
body.calc-formula .cf-worst-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px; }
body.calc-formula .cf-worst .cf-answer { padding: 0; border: 0; }
body.calc-formula .cf-worst .cf-answer strong { color: var(--cf-red); }
body.calc-formula .cf-worst .cf-answer strong.is-empty { color: var(--cf-faint); }
body.calc-formula .cf-worst-count { display: inline-flex; align-items: center; gap: 14px; }
body.calc-formula .cf-worst-count b { color: var(--cf-ink); font-variant-numeric: tabular-nums; }
body.calc-formula.tool-leaf-workspace .cf-worst .cf-worst-slider { width: 120px; height: 20px; margin: 0; padding: 0; border: 0; background: none; accent-color: var(--cf-accent); }
body.calc-formula .cf-worst .cf-answer-unit { color: var(--cf-ink); font-size: 16px; font-weight: 500; line-height: 24px; }
body.calc-formula .cf-worst-side { display: grid; gap: 4px; margin: 0; color: var(--cf-grey); font-size: 15px; line-height: 22px; text-align: right; }
body.calc-formula .cf-worst-side > div { display: flex; justify-content: flex-end; gap: 8px; }
body.calc-formula .cf-worst-side dd { margin: 0; color: var(--cf-ink); font-weight: 600; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-worst-side dd.is-gain { color: var(--cf-green); }
body.calc-formula .cf-worst-key { display: flex; flex-wrap: wrap; gap: 6px 20px; margin: 20px 0 8px; color: var(--cf-grey); font-size: 13px; line-height: 18px; }
body.calc-formula .cf-worst-key i { display: inline-block; width: 14px; height: 2px; margin-right: 6px; vertical-align: middle; background: var(--cf-ink); }
body.calc-formula .cf-worst-key i.is-without { background: var(--cf-green); }
body.calc-formula .cf-worst-key i.is-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cf-red); }
body.calc-formula .cf-worst-plot { position: relative; padding-bottom: 24px; }
body.calc-formula .cf-worst-chart { display: block; width: 100%; height: 240px; overflow: visible; }
body.calc-formula .cf-worst-line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
body.calc-formula .cf-worst-line.is-all { stroke: var(--cf-ink); }
body.calc-formula .cf-worst-line.is-without { stroke: var(--cf-green); }
body.calc-formula .cf-worst-zero { stroke: var(--cf-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
body.calc-formula .cf-worst-dot { stroke: var(--cf-red); stroke-width: 9; stroke-linecap: round; vector-effect: non-scaling-stroke; }
body.calc-formula .cf-worst-months { position: absolute; right: 0; bottom: 0; left: 0; height: 18px; }
body.calc-formula .cf-worst-months em { position: absolute; top: 0; color: var(--cf-faint); font-size: 12px; font-style: normal; line-height: 18px; }
body.calc-formula.tool-leaf-workspace .cf-worst .removed-trades { margin: 20px 0 0; }
body.calc-formula.tool-leaf-workspace .cf-worst .removed-trades-title { display: none; }
body.calc-formula.tool-leaf-workspace .cf-worst .removed-trade-item { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 0; border: 0; border-top: 1px solid var(--cf-line); font-size: 14px; }
body.calc-formula.tool-leaf-workspace .cf-worst .removed-trade-info { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-worst .removed-trade-rank { color: var(--cf-faint); font-size: 12px; }
body.calc-formula.tool-leaf-workspace .cf-worst .removed-trade-pnl { color: var(--cf-red); font-weight: 600; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-worst-said { color: #4b4f60; font-size: 13px; }
body.calc-formula .cf-worst-compare { margin: 28px 0 0; padding: 20px 0 0; border-top: 1px solid var(--cf-line); }
body.calc-formula .cf-worst-compare h2 { margin: 0; color: var(--cf-ink); font-size: 16px; font-weight: 600; line-height: 24px; }
body.calc-formula .cf-worst-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 40px; margin: 8px 0 0; }
body.calc-formula.tool-leaf-workspace .cf-worst .comparison-card { margin: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
body.calc-formula.tool-leaf-workspace .cf-worst .comparison-card-label { display: flex; align-items: center; gap: 6px; margin: 0 0 4px; color: var(--cf-grey); font-size: 13px; font-weight: 500; }
body.calc-formula.tool-leaf-workspace .cf-worst .comparison-card-label :where(i, svg) { display: none; }
body.calc-formula.tool-leaf-workspace .cf-worst .stat-row { padding: 7px 0; border-top: 1px solid var(--cf-line); font-size: 14px; }
body.calc-formula.tool-leaf-workspace .cf-worst .stat-value { font-weight: 600; font-variant-numeric: tabular-nums; }
body.calc-formula.tool-leaf-workspace .cf-worst .stat-value.positive { color: var(--cf-green); }
body.calc-formula.tool-leaf-workspace .cf-worst .stat-value.negative { color: var(--cf-red); }
body.calc-formula .cf-worst .cf-note { margin: 16px 0 0; }

/* What it means, and the what-if: flat. */
body.calc-formula .cf-what { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; margin-top: 48px; }
body.calc-formula .cf-what h2 { margin: 0; color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; letter-spacing: -0.01em; }
body.calc-formula .cf-means dl { margin: 16px 0 0; }
body.calc-formula .cf-means dl > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 16px; padding: 14px 0; border-top: 1px solid var(--cf-line); }
/* Rows are divided by a line above each; the section's own hairline closes the list (Igor 28 Nov «отступ между секциями
   норм?»: a list's bottom line and the next section's line ran parallel with a gap between them). */
body.calc-formula .cf-means dl > div:last-child { border-bottom: 0; }
body.calc-formula .cf-means dt { color: var(--cf-ink); font-size: 15px; font-weight: 500; line-height: 22px; }
body.calc-formula .cf-means dd { grid-row: span 2; align-self: center; margin: 0; color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; text-align: right; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-means dd.is-loss { color: var(--cf-red); }
/* A row whose value is words (Lot Size's equivalents) reads at the text's size, not a figure's. */
body.calc-formula .cf-means dd.is-text { font-size: 15px; font-weight: 500; }
/* The two halves start on one line: the leaf's chart blocks bring their own top margin, not here. */
body.calc-formula .cf-what > * { margin-top: 0; }
body.calc-formula .cf-means small { color: var(--cf-faint); font-size: 13px; line-height: 18px; }
body.calc-formula .cf-curve-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
body.calc-formula .cf-curve-now { color: var(--cf-grey); font-size: 14px; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-curve-now strong { color: var(--cf-accent); font-weight: 600; }
body.calc-formula .cf-curve-line { margin: 4px 0 0; color: var(--cf-grey); font-size: 15px; line-height: 22px; }
body.calc-formula .cf-chart { display: block; width: 100%; height: auto; margin-top: 12px; overflow: visible; }
/* Only a curve you can drag (Lot Size's) takes the drag cursor and keeps the finger from scrolling the page. */
body.calc-formula .cf-chart[data-cf-drag] { touch-action: none; cursor: ew-resize; }
body.calc-formula .cf-chart :is(.lot-size-chart-line, .position-chart-line) { fill: none; stroke: var(--cf-accent); stroke-width: 2.5; stroke-linecap: round; }
body.calc-formula .cf-chart :is(.lot-size-chart-grid, .position-chart-grid) :where(line, path) { stroke: var(--cf-line); }
body.calc-formula .cf-chart :is(.lot-size-chart-axis, .position-chart-axis) text { fill: var(--cf-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-chart :is(.lot-size-chart-marker, .position-chart-marker) { fill: #fff; stroke: var(--cf-accent); stroke-width: 3; }
body.calc-formula .cf-chart :is(.lot-size-chart-marker-line, .position-chart-marker-line) { stroke: #b9b5e6; stroke-dasharray: 3 4; }
body.calc-formula .cf-chart.is-dragging { cursor: grabbing; }

/* Crypto Profit's curve and Liquidation's buffer, in the page's palette (the controllers draw the geometry). */
body.calc-formula .cf-crypto-chart, body.calc-formula .cf-liq-svg { display: block; width: 100%; height: auto; margin-top: 12px; overflow: visible; cursor: default; touch-action: auto; }
body.calc-formula .crypto-chart-grid { stroke: var(--cf-line); }
body.calc-formula .crypto-chart-axis { stroke: #dcdce4; }
body.calc-formula .crypto-chart-zero { stroke: #b4b4bd; stroke-dasharray: 3 4; }
body.calc-formula .crypto-chart-breakeven { stroke: #b9b5e6; stroke-dasharray: 3 4; }
body.calc-formula .crypto-chart-path { fill: none; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
body.calc-formula .crypto-chart-path.profit { stroke: var(--cf-green); }
body.calc-formula .crypto-chart-path.loss { stroke: var(--cf-red); }
body.calc-formula .crypto-chart-point { fill: #fff; stroke: var(--cf-green); stroke-width: 3; }
body.calc-formula .crypto-chart-point.loss { stroke: var(--cf-red); }
body.calc-formula .crypto-chart-label { fill: var(--cf-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
body.calc-formula .crypto-chart-label-end { text-anchor: end; }
body.calc-formula .crypto-chart-label-current { fill: var(--cf-ink); font-weight: 600; text-anchor: middle; }
body.calc-formula .liquidation-chart-axis { stroke: var(--cf-chip); stroke-width: 8; stroke-linecap: round; }
body.calc-formula .liquidation-chart-danger { stroke: var(--cf-red); stroke-width: 8; stroke-linecap: round; }
body.calc-formula .liquidation-chart-safe { stroke: var(--cf-green); stroke-width: 8; stroke-linecap: round; }
body.calc-formula .liquidation-chart-point { fill: #fff; stroke-width: 3; }
body.calc-formula .liquidation-chart-point.danger { stroke: var(--cf-red); }
body.calc-formula .liquidation-chart-point.entry { stroke: var(--cf-ink); }
body.calc-formula .liquidation-chart-label { fill: var(--cf-ink); font-size: 14px; font-weight: 600; text-anchor: middle; font-variant-numeric: tabular-nums; }
body.calc-formula .liquidation-chart-caption { fill: var(--cf-grey); font-size: 12px; text-anchor: middle; }
body.calc-formula :is(.cf-meter, .cf-means) .risk-indicator { display: flex; align-items: flex-start; gap: 8px; margin: 16px 0 0; padding: 0; border: 0; border-radius: 0; background: none; color: var(--cf-ink); font-size: 14px; line-height: 20px; }
body.calc-formula :is(.cf-meter, .cf-means) .risk-indicator :where(i, svg) { flex: none; width: 18px; height: 18px; margin-top: 1px; color: #a26f12; }
body.calc-formula :is(.cf-meter, .cf-means) .risk-indicator.risk-high :where(i, svg) { color: var(--cf-red); }
body.calc-formula :is(.cf-meter, .cf-means) .risk-indicator.risk-low :where(i, svg) { color: var(--cf-green); }
/* Crypto Profit's net line takes its sign's colour (the controller names it profit or loss). */
body.calc-formula .cf-lines li:last-child b.is-gain { color: var(--cf-green); }
body.calc-formula .cf-lines li:last-child b.is-loss { color: var(--cf-red); }
body.calc-formula .cf-lines li:last-child b.summary-value.profit { color: var(--cf-green); }
body.calc-formula .cf-lines li:last-child b.summary-value.loss { color: var(--cf-red); }

/* The article in its older markup (.info-section: Crypto Profit, Liquidation, the converter, the fee comparison) reads as
   the others: the same section step, type and lists; its small cards are a flat row, not frames. */
body.calc-formula.tool-leaf-workspace .info-section { margin-top: 64px; padding: 40px 0 0; border: 0; border-top: 1px solid #e3e5ec; border-radius: 0; background: none; box-shadow: none; }
body.calc-formula.tool-leaf-workspace .info-section > h2 { display: block; margin: 0 0 16px; color: var(--cf-ink); font-size: 32px; font-weight: 600; line-height: 40px; letter-spacing: -0.025em; }
body.calc-formula.tool-leaf-workspace .info-section > h2 :where(i, svg) { display: none; }
body.calc-formula.tool-leaf-workspace .info-section :where(h3, h4) { margin: 32px 0 12px; color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; }
body.calc-formula.tool-leaf-workspace .info-section :where(p, li) { color: #4b4f60; font-size: 16px; line-height: 26px; text-wrap: pretty; }
body.calc-formula.tool-leaf-workspace .info-section .crypto-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 24px; margin: 16px 0 0; }
body.calc-formula.tool-leaf-workspace .info-section .crypto-card { display: flex; align-items: flex-start; gap: 12px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
body.calc-formula.tool-leaf-workspace .info-section .crypto-card-icon { flex: none; width: auto; height: auto; padding: 0; border: 0; background: none; color: var(--cf-ink); font-size: 20px; line-height: 24px; }
body.calc-formula.tool-leaf-workspace .info-section .crypto-card-info h4 { margin: 0; font-size: 15px; font-weight: 500; line-height: 22px; }
body.calc-formula.tool-leaf-workspace .info-section .crypto-card-info p { margin: 2px 0 0; color: var(--cf-grey); font-size: 14px; line-height: 20px; }
body.calc-formula.tool-leaf-workspace .info-section .tips-list { margin: 12px 0 0; padding: 0; list-style: none; }
body.calc-formula.tool-leaf-workspace .info-section .tips-list li { display: flex; align-items: flex-start; gap: 10px; padding: 6px 0; }
body.calc-formula.tool-leaf-workspace .info-section .tips-list li :where(i, svg) { flex: none; width: 16px; height: 16px; margin-top: 5px; color: var(--cf-green); }
body.calc-formula.tool-leaf-workspace .info-section > :last-child { margin-bottom: 0; }

/* Compound's growth and Drawdown's recovery map, in the page's palette (the controllers draw the geometry). */
body.calc-formula .compound-chart-grid, body.calc-formula .drawdown-chart-grid { stroke: var(--cf-line); }
body.calc-formula .compound-chart-axis, body.calc-formula .drawdown-chart-axis { stroke: #dcdce4; }
body.calc-formula .compound-chart-fill { fill: color-mix(in srgb, var(--cf-accent) 8%, transparent); }
body.calc-formula .compound-chart-line, body.calc-formula .drawdown-chart-recovery { fill: none; stroke: var(--cf-accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
body.calc-formula .drawdown-chart-drop { fill: none; stroke: var(--cf-red); stroke-width: 2.5; stroke-linecap: round; }
body.calc-formula .compound-chart-point, body.calc-formula .drawdown-chart-point { fill: #fff; stroke: var(--cf-accent); stroke-width: 3; }
body.calc-formula .drawdown-chart-point.current { stroke: var(--cf-red); }
body.calc-formula .compound-chart-label, body.calc-formula .drawdown-chart-label { fill: var(--cf-faint); font-size: 12px; font-variant-numeric: tabular-nums; }
body.calc-formula .compound-chart-label-end { text-anchor: end; }
body.calc-formula .compound-chart-label-current, body.calc-formula .drawdown-chart-value { fill: var(--cf-ink); font-size: 13px; font-weight: 600; text-anchor: middle; font-variant-numeric: tabular-nums; }
/* The end balance's label sits left of its point, not over it. */
body.calc-formula .compound-chart-label-current { text-anchor: end; transform: translate(-14px, -2px); }
body.calc-formula .drawdown-chart-label { text-anchor: middle; }
body.calc-formula .drawdown-chart-chip { font-size: 13px; font-weight: 600; text-anchor: middle; }
body.calc-formula .drawdown-chart-chip.loss { fill: var(--cf-red); }
body.calc-formula .drawdown-chart-chip.gain { fill: var(--cf-green); }
/* Drawdown's answer takes the controller's tone: amber from a 20% drawdown, red from 40%. */
body.calc-formula .cf-answer .recovery-value.safe { color: var(--cf-green); }
body.calc-formula .cf-answer .recovery-value.warn { color: #a26f12; }
body.calc-formula .cf-answer .recovery-value.danger { color: var(--cf-red); }
body.calc-formula .cf-means dd.is-text-loss { color: var(--cf-red); }

/* Break-even: the mode switch and the currency on one row; each mode its two fields, = and its answer with what the
   answer means under it; only the chosen mode shows (the controller marks it active). */
body.calc-formula .cf-head-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 20px; }
body.calc-formula .cf-head-row .cf-dir { margin: 0; }
body.calc-formula .cf-head-row .cf-sub { margin: 0; }
body.calc-formula .cf-mode { display: grid; grid-template-columns: minmax(0, 2fr) 36px minmax(0, 1.15fr); align-items: start; gap: 0 10px; }
body.calc-formula .cf-mode:has(> .break-even-inputs:not(.active)) { display: none; }
/* Over the leaf's own mode rule (a column with a 20 px gap): the two fields side by side with their sign. */
body.calc-formula.tool-leaf-workspace .cf-sum .cf-mode-terms.break-even-inputs { display: grid; flex-direction: initial; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr); align-items: start; gap: 0 10px; }
body.calc-formula .cf-mode > .cf-op-eq { margin-top: 36px; }
body.calc-formula .cf-mode .cf-answer { padding-left: 4px; }
body.calc-formula .cf-mode .be-value.positive, body.calc-formula .cf-mode .be-value.good { color: var(--cf-green); }
/* What the answer means, as a row under the whole mode (three facts side by side), so the fields' column has no hole
   under it beside a tall answer. */
body.calc-formula.tool-leaf-workspace .cf-sum .cf-mode > .tab-content.active { display: contents; }
body.calc-formula .cf-mode > .tab-content > .cf-answer { grid-column: 3; grid-row: 1; }
body.calc-formula .cf-facts { display: grid; grid-column: 1 / -1; grid-row: 2; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 40px; margin: 24px 0 0; padding: 16px 0 0; border-top: 1px solid var(--cf-line); }
body.calc-formula .cf-facts > div { display: flex; flex-direction: column; gap: 2px; }
body.calc-formula .cf-facts dt { color: var(--cf-grey); font-size: 13px; line-height: 18px; }
body.calc-formula .cf-facts dd { margin: 0; color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-op.is-blank { visibility: hidden; }
body.calc-formula .cf-facts dd.positive-value { color: var(--cf-green); }
body.calc-formula .cf-facts dd.negative-value { color: var(--cf-red); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .tab-btn { display: inline-flex; flex: none; align-items: center; gap: 6px; height: 32px; min-height: 0; margin: 0; padding: 0 14px; border: 0; border-radius: 6px; background: none; box-shadow: none; color: var(--cf-grey); font-size: 14px; font-weight: 500; line-height: 20px; cursor: pointer; }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .tab-btn:hover { color: var(--cf-ink); }
body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .tab-btn.active { background: #fff; box-shadow: 0 1px 2px rgb(20 16 60 / .08), 0 0 0 1px rgb(20 16 60 / .05); color: var(--cf-ink); }

/* Kelly: the share on its scale (0, 25%, 50%+), the controller's verdict on the edge under it. */
body.calc-formula .kelly-meter-track { fill: var(--cf-chip); }
body.calc-formula .kelly-meter-fill.positive { fill: var(--cf-green); }
body.calc-formula .kelly-meter-fill.aggressive { fill: #c08a2b; }
body.calc-formula .kelly-meter-fill.negative { fill: var(--cf-red); }
body.calc-formula .kelly-meter-marker { stroke: var(--cf-ink); stroke-width: 2; }
body.calc-formula .cf-kelly-zones { display: flex; justify-content: space-between; margin-top: 8px; color: var(--cf-faint); font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-meter .edge-indicator { display: flex; align-items: flex-start; gap: 8px; margin: 20px 0 0; padding: 0; border: 0; border-radius: 0; background: none; color: var(--cf-ink); font-size: 14px; line-height: 20px; }
body.calc-formula .cf-meter .edge-indicator :where(i, svg) { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--cf-green); }
body.calc-formula .cf-meter .edge-indicator.negative :where(i, svg) { color: var(--cf-red); }
body.calc-formula .cf-lines b.kelly-value.negative { color: var(--cf-red); }

/* Two lists side by side (Pip: a move, and a pip at each lot size). */
body.calc-formula .cf-what.is-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
/* Halves of one width when the list is short (Position Size: three rows and the risk level); the curve, narrower, is
   lower, so both halves end together and no hole is left under the list (Igor 28 Nov «не пусто под ним к линии?»). */
body.calc-formula .cf-what.is-even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* Margin used: one bar on the zones it is judged by (safe under 30%, caution to 70%, danger above), the labels at the
   zones' own starts, the controller's verdict under it as a line, not a box. */
body.calc-formula :where(.cf-meter-svg, .cf-rr-svg) { display: block; width: 100%; height: auto; margin-top: 16px; overflow: visible; }
body.calc-formula :where(.meter-track, .rr-bar-track) { fill: var(--cf-chip); }
body.calc-formula .meter-fill.safe, body.calc-formula .rr-bar-reward { fill: var(--cf-green); }
body.calc-formula .meter-fill.warning { fill: #c08a2b; }
body.calc-formula .meter-fill.danger, body.calc-formula .rr-bar-risk { fill: var(--cf-red); }
body.calc-formula .cf-meter-zones { display: grid; grid-template-columns: 30fr 40fr 30fr; margin-top: 8px; color: var(--cf-faint); font-size: 12px; line-height: 16px; }
body.calc-formula .cf-meter-zones span + span { padding-left: 8px; border-left: 1px solid var(--cf-line); }
body.calc-formula .cf-meter .margin-warning { display: flex; align-items: flex-start; gap: 8px; margin: 20px 0 0; padding: 0; border: 0; border-radius: 0; background: none; color: var(--cf-ink); font-size: 14px; line-height: 20px; }
body.calc-formula .cf-meter .margin-warning :where(i, svg) { flex: none; width: 18px; height: 18px; margin-top: 1px; }
body.calc-formula .cf-meter .margin-warning.safe :where(i, svg) { color: var(--cf-green); }
body.calc-formula .cf-meter .margin-warning.warning :where(i, svg) { color: #a26f12; }
body.calc-formula .cf-meter .margin-warning.danger :where(i, svg) { color: var(--cf-red); }
body.calc-formula .cf-meter .margin-warning.empty { color: var(--cf-grey); }
body.calc-formula .cf-meter .margin-warning.empty :where(i, svg) { color: var(--cf-faint); }

/* Risk and reward to scale: the entry's price over its mark, the stop and the target at the ends in their colours. */
body.calc-formula .cf-rr-at { position: relative; height: 20px; margin-top: 16px; }
body.calc-formula .cf-rr-at span { position: absolute; top: 0; left: 25%; transform: translateX(-50%); color: var(--cf-ink); font-size: 13px; font-weight: 500; line-height: 20px; white-space: nowrap; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-rr-svg { margin-top: 4px; }
body.calc-formula .rr-bar-entry { stroke: var(--cf-ink); stroke-width: 2; stroke-dasharray: none; }
body.calc-formula .cf-rr-labels { display: flex; justify-content: space-between; gap: 16px; margin-top: 8px; font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
body.calc-formula .cf-rr-labels #labelStop { color: var(--cf-red); }
body.calc-formula .cf-rr-labels #labelTarget { color: var(--cf-green); }

/* The sell block (tools/includes/calc-sell.php) is styled in calc-sell.css, loaded after this file. */

/* The article, the FAQ and the related calculators: same text, the site's type. */
body.calc-formula.tool-leaf-workspace :where(.content-section, .faq-section, .related-tools) { margin-top: 64px; padding-top: 40px; border-top: 1px solid #e3e5ec; }
body.calc-formula.tool-leaf-workspace :where(.content-section, .faq-section, .related-tools) > h2 { margin-bottom: 16px; color: var(--cf-ink); font-size: 32px; font-weight: 600; line-height: 40px; letter-spacing: -0.025em; }
body.calc-formula.tool-leaf-workspace .content-section :where(h3, h4) { margin: 32px 0 12px; color: var(--cf-ink); font-size: 20px; font-weight: 600; line-height: 28px; }
body.calc-formula.tool-leaf-workspace .content-section :where(p, li) { color: #4b4f60; font-size: 16px; line-height: 26px; }
/* Margin's worked example: text, not a second filled box under the formula's (a frame beside a frame). */
body.calc-formula.tool-leaf-workspace .content-section .example-box { margin: 24px 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; }
body.calc-formula.tool-leaf-workspace .content-section .example-box h4 :where(i, svg) { display: none; }
body.calc-formula.tool-leaf-workspace .formula-box { margin: 24px 0; padding: 18px 22px; border: 1px solid #e3e3ea; border-radius: 12px; background: #fafafc; }
body.calc-formula.tool-leaf-workspace .content-section table { width: 100%; margin: 24px 0 0; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
body.calc-formula.tool-leaf-workspace .content-section :where(th, td) { padding: 12px 12px 12px 0; border-bottom: 1px solid var(--cf-line); text-align: left; }
body.calc-formula.tool-leaf-workspace .content-section th { color: var(--cf-grey); font-size: 13px; font-weight: 500; }
/* The table's last row has no line of its own (Igor 28 Nov «над ним пустоты много»: the table's bottom line, its margin
   and the next section's hairline stacked into a hole); the next block keeps its distance from the table. */
body.calc-formula.tool-leaf-workspace .content-section tbody tr:last-child :where(th, td) { border-bottom: 0; }
body.calc-formula.tool-leaf-workspace .content-section table + :where(p, h3, h4, ul, ol, div) { margin-top: 24px; }
body.calc-formula.tool-leaf-workspace .content-section > :last-child { margin-bottom: 0; }
/* No line ends on a lone word (Igor 28 Nov «переносы такие бывают странные»). */
body.calc-formula :where(.content-section p, .content-section li, .faq-answer, .cf-side small, .cf-hint, .cf-sell-caption, .cf-means small, .cf-curve-line) { text-wrap: pretty; }
body.calc-formula.tool-leaf-workspace .faq-item { border-bottom: 1px solid var(--cf-line); }
body.calc-formula.tool-leaf-workspace .faq-item:first-of-type { border-top: 1px solid var(--cf-line); }
body.calc-formula.tool-leaf-workspace .faq-question { padding: 18px 0; color: var(--cf-ink); font-size: 16px; font-weight: 500; }
body.calc-formula.tool-leaf-workspace .faq-question :where(i, svg) { width: 18px; height: 18px; flex-basis: 18px; color: var(--cf-faint); transition: transform .2s; }
body.calc-formula.tool-leaf-workspace .faq-answer { color: #4b4f60; font-size: 15px; line-height: 24px; }
body.calc-formula.tool-leaf-workspace .tools-grid { gap: 0 32px; }
body.calc-formula.tool-leaf-workspace .tool-link { padding: 16px 0; border: 0; border-top: 1px solid var(--cf-line); border-radius: 0; text-decoration: none; }
body.calc-formula.tool-leaf-workspace .tool-link:hover .tool-link-text h3 { color: var(--cf-accent); }
body.calc-formula.tool-leaf-workspace .tool-link-text h3 { font-size: 16px; font-weight: 500; }
body.calc-formula.tool-leaf-workspace .tool-link-text p { color: var(--cf-grey); font-size: 14px; }
/* The reading column and its sidebar (Igor 28 Nov «чего дыра между ними такая?»): the text fills its column, so the
   hairlines, the paragraphs, the table and the FAQ end on one edge, and the sidebar takes the rest of the row up to the
   page's right edge; no capped text inside a wider column. */
body.calc-formula .cf-read { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 32%); gap: 80px; align-items: start; }
body.calc-formula .cf-read-main { min-width: 0; }
/* Every section starts the same way: 64 px, a hairline, 40 px; the sidebar's top meets the article's first heading. */
body.calc-formula .cf-side { position: sticky; top: 96px; margin-top: 105px; }
body.calc-formula .cf-side-box { padding: 24px; border: 1px solid #e3e3ea; border-radius: 16px; background: #fafafc; }
body.calc-formula .cf-side h2 { margin: 0 0 8px; color: var(--cf-ink); font-size: 16px; font-weight: 600; line-height: 24px; }
body.calc-formula .cf-side ul { margin: 0; padding: 0; list-style: none; }
body.calc-formula .cf-side li + li { border-top: 1px solid var(--cf-line); }
body.calc-formula .cf-side-all { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; color: var(--cf-accent); font-size: 14px; font-weight: 500; text-decoration: none; }
body.calc-formula .cf-side-all :where(i, svg) { width: 14px; height: 14px; flex-basis: 14px; }

/* Related calculators: the whole toolkit, grouped as /tools/ groups it. */
/* Columns that balance themselves (Igor 28 Nov «дырка внизу»): the groups flow top to bottom and never split, so no
   short group leaves a hole under it in a grid row. */
body.calc-formula .cf-related { column-count: 3; column-gap: 40px; margin: 8px 0 -32px; }
body.calc-formula .cf-related-group { break-inside: avoid; padding-bottom: 32px; }
/* The whole toolkit as an index: each group's name, then its tools by name (Igor 28 Nov «они тут аккуратно выглядят или
   как свалка?»: 22 tools with a sentence each read as a wall; the sidebar carries the sentences for the tool's own group). */
body.calc-formula .cf-related-group h3 { margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px solid var(--cf-line); color: var(--cf-grey); font-size: 13px; font-weight: 500; line-height: 18px; }
body.calc-formula .cf-related-group ul { margin: 0; padding: 0; list-style: none; }
body.calc-formula .cf-related-tool { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--cf-ink); text-decoration: none; }
body.calc-formula a.cf-related-tool:hover { text-decoration: none; }
body.calc-formula a.cf-related-tool:hover b { color: var(--cf-accent); }
body.calc-formula .cf-related-tool :where(i, svg) { flex: none; width: 16px; height: 16px; color: var(--cf-accent); }
body.calc-formula .cf-related-tool > span { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
body.calc-formula .cf-related-tool b { font-size: 15px; font-weight: 400; line-height: 22px; }
body.calc-formula .cf-related-tool small { color: var(--cf-grey); font-size: 13px; line-height: 19px; }
body.calc-formula .cf-related-tool.is-here { color: var(--cf-grey); }
body.calc-formula .cf-related-tool.is-here :where(i, svg) { color: var(--cf-faint); }
body.calc-formula .cf-related-tool.is-here small { color: var(--cf-accent); font-weight: 500; }
/* The sidebar keeps a tool's sentence under its name. */
body.calc-formula .cf-side .cf-related-tool { align-items: flex-start; padding: 12px 0; }
body.calc-formula .cf-side .cf-related-tool :where(i, svg) { width: 18px; height: 18px; margin-top: 2px; }
body.calc-formula .cf-side .cf-related-tool > span { flex-direction: column; align-items: stretch; gap: 0; }
body.calc-formula .cf-side .cf-related-tool b { font-weight: 500; }
/* The band follows the catalogue at the page's section step: 36 px of the page's own end + 28 = 64. */
body.calc-formula .lr-final { margin-top: 28px; }

/* Embed this tool: Journal's dialog (title 24, radius 16, the quiet 40 px close without a frame). */
body.calc-formula .embed-modal { width: min(720px, 100%); padding: 24px; border: 0; border-radius: 16px; box-shadow: 0 24px 64px rgb(18 19 34 / 18%); }
body.calc-formula .embed-modal-header { margin-bottom: 8px; }
body.calc-formula .embed-modal-header h3 { color: var(--cf-ink); font-size: 24px; font-weight: 600; line-height: 32px; letter-spacing: -0.015em; }
body.calc-formula .embed-modal-close { width: 40px; height: 40px; margin: -8px -8px 0 0; border: 0; border-radius: 8px; background: none; color: var(--cf-grey); }
body.calc-formula .embed-modal-close:hover { background: var(--cf-chip); color: var(--cf-ink); }
body.calc-formula .embed-modal-close :where(i, svg) { width: 20px; height: 20px; }
body.calc-formula .embed-modal > p { color: var(--cf-grey); font-size: 14px; line-height: 22px; }
body.calc-formula .embed-code-wrap { margin-top: 20px; border: 1px solid #e3e3ea; border-radius: 12px; }
body.calc-formula .embed-code-head { padding: 8px 8px 8px 16px; border-bottom-color: var(--cf-line); background: #fafafc; color: var(--cf-grey); font-size: 13px; font-weight: 500; }
body.calc-formula .embed-copy-btn { gap: 6px; min-height: 32px; padding: 0 12px; border-color: #e3e3ea; border-radius: 8px; color: var(--cf-ink); font-size: 13px; font-weight: 500; }
body.calc-formula .embed-copy-btn :where(i, svg) { width: 14px; height: 14px; }
body.calc-formula .embed-copy-btn:hover { border-color: var(--cf-edge); background: #fafafc; }
body.calc-formula .embed-code { min-height: 104px; resize: none; white-space: pre-wrap !important; word-break: break-all; padding: 14px 16px; border-radius: 0 0 12px 12px; color: var(--cf-ink); font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 12px; line-height: 20px; }
body.calc-formula .embed-preview-label { margin: 24px 0 8px; color: var(--cf-grey); font-size: 13px; font-weight: 500; }
/* The embed brings its own frame: no second one around it. */
body.calc-formula .embed-preview { border: 0; border-radius: 0; }

/* The embed itself (an iframe on another site): the frame and its answer, light, the attribution under it; none of the
   page around it. The attribution stays visible: the embed's own guard checks it. */
html:has(body.calc-formula.embed-mode), body.calc-formula.embed-mode { min-height: 0; background: #fff; }
body.calc-formula.embed-mode > .container { max-width: none; padding: 16px; background: #fff; }
body.calc-formula.embed-mode :where(.page-header, .cf-read, .related-tools, .cf-sell, .embed-trigger, .embed-overlay) { display: none !important; }
body.calc-formula.embed-mode .cf-sum { margin-top: 0; }
body.calc-formula.embed-mode .cf-what { margin-top: 32px; }
body.calc-formula.embed-mode .powered-by { margin: 24px 0 0; padding-top: 16px; border-top: 1px solid var(--cf-line); color: var(--cf-grey); font-size: 13px; line-height: 20px; text-align: center; }
body.calc-formula.embed-mode .powered-by a { color: var(--cf-accent); font-weight: 500; text-decoration: none; }

/* Under 1320 px the answer takes its own row under the fields: beside them it had less room than a 56 px number needs
   (Igor 28 Nov, a screen between a Mac and an iPad: «0.1 / 0»). */
@media (max-width: 1320px) {
    body.calc-formula .cf-terms { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr); row-gap: 20px; }
    body.calc-formula .cf-terms > .cf-op:nth-of-type(3) { display: none; }
    body.calc-formula .cf-terms > .cf-term:nth-of-type(4) { grid-column: 1 / span 3; }
    body.calc-formula .cf-answer { grid-column: 1 / -1; padding: 16px 0 0; border-top: 1px solid var(--cf-line); }
    body.calc-formula .cf-op-eq { display: none; }
    body.calc-formula .cf-terms[data-terms="4"] { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr); }
    /* Break-even's modes stack the same way: the two fields, then the answer on its own row, then what it means. */
    body.calc-formula .cf-mode { grid-template-columns: minmax(0, 1fr); row-gap: 20px; }
    body.calc-formula .cf-mode > .cf-op-eq { display: none; }
    body.calc-formula .cf-mode > .tab-content > .cf-answer { grid-column: 1; grid-row: auto; padding-left: 0; }
    body.calc-formula .cf-facts { grid-column: 1; grid-row: auto; margin-top: 4px; }
    body.calc-formula .cf-terms[data-terms="2"] { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr); }
    body.calc-formula .cf-terms[data-terms="3"] { grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr); }
    body.calc-formula .cf-terms[data-terms="3"][data-wide="2"] { grid-template-columns: minmax(0, .8fr) 28px minmax(0, 1.4fr) 28px minmax(0, .8fr); }
}
@media (max-width: 1180px) {
    body.calc-formula .cf-what, body.calc-formula .cf-what.is-even { grid-template-columns: minmax(0, 1fr); gap: 40px; }
    body.calc-formula .cf-prop-grid { grid-template-columns: minmax(0, 1fr); gap: 28px; }
    body.calc-formula .cf-prop-sep { display: none; }
    body.calc-formula .cf-prop-row { grid-template-columns: 160px repeat(3, minmax(0, 1fr)); gap: 10px 20px; }
    body.calc-formula .cf-prop-row .cf-prop-verdict { grid-column: 1; }
    body.calc-formula .cf-what.is-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    body.calc-formula .cf-related { column-count: 2; }
    body.calc-formula.tool-leaf-workspace .cf-pairs .pairs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    /* One column: the text keeps a reading width; the sidebar's list would repeat the catalogue that follows at once. */
    body.calc-formula .cf-read { grid-template-columns: minmax(0, 1fr); gap: 0; }
    body.calc-formula .cf-read-main { max-width: 860px; }
    body.calc-formula .cf-side { display: none; }
}
@media (max-width: 600px) {
    /* The sizing curves keep their 520-wide drawing; on a phone their axis labels are set larger in its units so they
       read at about 11px on screen (Lot Size and Position Size, 28 Nov). */
    body.calc-formula .cf-chart :is(.lot-size-chart-axis, .position-chart-axis) text { font-size: 13px; }
    body.calc-formula.tool-leaf-workspace .page-header { padding-right: 0; }
    body.calc-formula.tool-leaf-workspace h1 { font-size: 32px; line-height: 40px; }
    body.calc-formula.tool-leaf-workspace .page-intro { font-size: 16px; line-height: 24px; }
    body.calc-formula .cf-sum { margin-top: 24px; padding: 20px 16px; border-radius: 12px; }
    body.calc-formula .cf-terms { grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
    body.calc-formula .cf-op { width: 24px; height: 24px; margin: 0 auto; font-size: 14px; }
    body.calc-formula .cf-terms > .cf-op:nth-of-type(3) { display: grid; }
    body.calc-formula .cf-terms > .cf-term:nth-of-type(4) { grid-column: auto; }
    body.calc-formula .cf-terms[data-terms], body.calc-formula .cf-terms[data-terms][data-wide] { grid-template-columns: minmax(0, 1fr); }
    body.calc-formula .cf-terms > .cf-op.cf-op-eq, body.calc-formula .cf-terms > .cf-op.is-blank { display: none; }
    body.calc-formula .cf-what.is-pair { grid-template-columns: minmax(0, 1fr); }
    body.calc-formula.tool-leaf-workspace .info-section .crypto-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.calc-formula .cf-dir { display: flex; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .trade-type-btn { flex: 1; justify-content: center; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .crypto-btn { flex: 1; justify-content: center; padding: 0 8px; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-dir .tab-btn { flex: 1; justify-content: center; padding: 0 8px; }
    body.calc-formula.tool-leaf-workspace .tool-local-workbench .cf-sum .cf-dir :is(.trend-btn, .method-tab) { flex: 1 1 auto; justify-content: center; min-width: 0; padding: 0 6px; }
    /* Pivot's five methods share the phone's width: smaller type, tighter keys. */
    body.calc-formula.tool-leaf-workspace .tool-local-workbench .cf-sum .cf-dir .method-tab { padding: 0 3px; font-size: 13px; letter-spacing: -0.01em; }
    body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table :is(th, td):nth-child(4) { display: none; }
    body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table :is(th, td):nth-child(5) { width: 28%; padding-left: 16px; }
    body.calc-formula .cf-levels { margin-top: 40px; }
    body.calc-formula.tool-leaf-workspace .cf-levels .cf-levels-table td { font-size: 14px; }
    body.calc-formula .cf-head-row { flex-direction: column; align-items: stretch; }
    body.calc-formula .cf-mode { grid-template-columns: minmax(0, 1fr); row-gap: 12px; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-mode-terms.break-even-inputs { grid-template-columns: minmax(0, 1fr); row-gap: 12px; }
    body.calc-formula .cf-mode > .tab-content > .cf-answer { grid-column: auto; grid-row: auto; }
    body.calc-formula .cf-facts { grid-column: auto; grid-row: auto; grid-template-columns: minmax(0, 1fr); gap: 0; margin: 12px 0 0; padding: 0; border: 0; }
    body.calc-formula .cf-facts > div { flex-direction: row; align-items: baseline; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--cf-line); }
    body.calc-formula .cf-facts dd { font-size: 15px; line-height: 22px; }
    body.calc-formula .cf-mode > .cf-op-eq, body.calc-formula .cf-mode-terms > .cf-op { display: none; }
    body.calc-formula .cf-mode .cf-answer { padding: 16px 0 0; border-top: 1px solid var(--cf-line); }
    body.calc-formula .cf-answer strong { font-size: 44px; line-height: 48px; }
    body.calc-formula .cf-fx { grid-template-columns: minmax(0, 1fr); }
    body.calc-formula .cf-field-narrow { width: 100%; }
    body.calc-formula .cf-lines li { grid-template-columns: 24px minmax(0, 1fr); }
    body.calc-formula .cf-lines li > span:last-child { grid-column: 2; }
    body.calc-formula .cf-related { column-count: 1; margin-bottom: -24px; }
    body.calc-formula .cf-related-group { padding-bottom: 24px; }
    /* Stock Average on a phone: each purchase is two lines, price × shares (and its remove key), then its cost. */
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries, body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries :is(thead, tbody) { display: block; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; align-items: center; column-gap: 8px; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries tbody tr { padding: 10px 0; border-bottom: 1px solid var(--cf-line); }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries :is(th, td), body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries :is(th, td):nth-child(n) { width: auto; padding: 0; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries thead tr { padding-bottom: 8px; border-bottom: 1px solid var(--cf-line); }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries th { border: 0; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries :is(th, td):nth-child(1), body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries th:nth-child(4) { display: none; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td:nth-child(3) { padding-right: 0; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td:nth-child(3)::after { display: none; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td:nth-child(3) input { width: 100%; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td:nth-child(4) { display: flex; grid-column: 1 / 3; grid-row: 2; justify-content: space-between; padding-top: 8px; font-size: 14px; text-align: right; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td:nth-child(4)::before { content: "Cost"; color: var(--cf-grey); font-weight: 400; }
    body.calc-formula.tool-leaf-workspace .cf-sum .cf-entries td:nth-child(5) { grid-column: 3; grid-row: 1; }
    body.calc-formula.tool-leaf-workspace .cf-pairs .pairs-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    body.calc-formula.tool-leaf-workspace .cf-terms .cf-op-swap { margin: 0 auto; }
    body.calc-formula .cf-pairs { margin-top: 40px; }
    /* Exchange Fees on a phone: the name and the fee on one line, the bar under them. */
    body.calc-formula.tool-leaf-workspace .cf-fees .fee-card { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; }
    body.calc-formula.tool-leaf-workspace .cf-fees .fee-card::after { grid-column: 1 / -1; grid-row: 2; }
    body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-amount { grid-column: 2; }
    body.calc-formula.tool-leaf-workspace .cf-fees .fee-card-badge { display: none; }
    body.calc-formula .cf-fees { margin-top: 40px; }
    body.calc-formula .cf-fees .cf-curve-now { display: none; }
    /* Funding Rates on a phone: the three facts as rows, the search takes the line, the table at the phone's size. */
    body.calc-formula .cf-fr-facts { grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 12px; }
    body.calc-formula .cf-fr-facts > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 12px; padding: 10px 0; border-top: 1px solid var(--cf-line); }
    body.calc-formula .cf-fr-facts > div:first-child { border-top: 0; }
    body.calc-formula .cf-fr-facts dd:has(strong) { grid-column: 2; grid-row: 1 / span 2; align-self: center; }
    body.calc-formula .cf-fr-facts strong { font-size: 24px; line-height: 32px; }
    body.calc-formula .cf-fr-facts .cf-fr-meta { font-size: 13px; line-height: 18px; }
    body.calc-formula .cf-fr-markets { margin-top: 40px; }
    body.calc-formula .cf-fr-controls { flex: 1 1 100%; }
    body.calc-formula .cf-fr-search { flex: 1; }
    body.calc-formula.tool-leaf-workspace .cf-fr-search input { width: 100%; }
    body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table :is(th, td) { padding-left: 6px; font-size: 12px; letter-spacing: -0.01em; }
    body.calc-formula.tool-leaf-workspace .cf-fr-markets .cf-fr-table :is(th, td):first-child { padding-left: 0; }
    /* Prop Firm on a phone: the question wraps, the answer at the phone's size, each firm's bars under its name. */
    body.calc-formula .cf-prop .cf-answer strong { font-size: 32px; line-height: 40px; }
    body.calc-formula .cf-prop .cf-prop-inputs[data-terms="4"] { grid-template-columns: minmax(0, 1fr); }
    body.calc-formula .cf-prop .cf-prop-inputs .cf-op { display: none; }
    body.calc-formula .cf-prop-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    body.calc-formula .cf-prop-row .cf-prop-verdict { grid-column: auto; }
    body.calc-formula .cf-prop-others { margin-top: 40px; }
    /* Remove Worst Trades on a phone: the drop line stacks, the totals under the answer, the picture lower, one column of stats. */
    body.calc-formula.tool-leaf-workspace .cf-worst .cf-worst-drop { flex-direction: column; align-items: stretch; text-align: left; }
    body.calc-formula .cf-worst-drop-btn { text-align: center; }
    body.calc-formula .cf-worst-head { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    body.calc-formula .cf-worst-side { text-align: left; }
    body.calc-formula .cf-worst-side > div { justify-content: space-between; }
    body.calc-formula .cf-worst-chart { height: 180px; }
    body.calc-formula .cf-worst-cards { grid-template-columns: minmax(0, 1fr); gap: 20px; }
    body.calc-formula.tool-leaf-workspace .cf-worst .cf-worst-slider { width: 90px; }
    body.calc-formula.embed-mode .cf-sum { margin-top: 0; }
    body.calc-formula.embed-mode > .container { padding: 12px; }
    /* A wide table as records: the row's first cell is its title, each other cell a line "column … value", like the
       calculated rows above it. Hairlines between records; the header row stays in the markup for readers. */
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack { display: block; border: 0; border-radius: 0; overflow: visible; }
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack thead { position: absolute; top: 0; left: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    /* Its cells sit on one spot too, so a six-column head never lays out past the screen's edge. */
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack thead th { position: absolute; top: 0; left: 0; padding: 0; }
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack tbody { display: block; border-top: 1px solid var(--cf-line); }
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack tr { display: block; padding: 14px 0; border-bottom: 1px solid var(--cf-line); }
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 2px 0; border: 0; background: none; color: var(--cf-ink); font-family: inherit; font-size: 14px; line-height: 22px; text-align: right; }
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack td::before { content: attr(data-label); flex: 0 1 auto; max-width: 55%; color: var(--cf-grey); text-align: left; }
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack td.cf-cell-title,
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack tr[data-cf-title]::before { display: block; padding: 0 0 4px; font-size: 16px; font-weight: 500; line-height: 24px; text-align: left; }
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack td.cf-cell-title::before { content: none; }
    /* A row under a cell that spans rows is titled by that cell (Position Size: "$5,000" over its 1 %, 2 %, 3 % rows). */
    body.calc-formula.tool-leaf-workspace .cf-read-main table.cf-table-stack tr[data-cf-title]::before { content: attr(data-cf-title); color: var(--cf-ink); }
    body.calc-formula.tool-leaf-workspace :where(.content-section, .faq-section, .related-tools) { margin-top: 48px; padding-top: 28px; }
    body.calc-formula.tool-leaf-workspace :where(.content-section, .faq-section, .related-tools) > h2 { font-size: 24px; line-height: 32px; }
}

/* The receipt (Igor 28 Nov «A, чек», on «некрасиво. дешево» for the answer under four fields): Forex Profit, Crypto Profit
   and Liquidation. The fields two by two on the left; on the right the answer, and under it the sum as a receipt, its
   amounts on the right edge and where each comes from under its name. Under 1181 px the frame stacks as the others. */
@media (min-width: 1181px) {
    body.calc-formula .cf-sum[data-layout="receipt"] { display: grid; grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 64px minmax(0, 1fr); grid-template-areas: "dir dir dir . ans" "t1 o1 t2 . ans" "t3 o3 t4 . lines" "note note note . lines"; align-items: start; row-gap: 20px; }
    body.calc-formula .cf-sum[data-layout="receipt"] > .cf-terms { display: contents; }
    /* Without a switch above the fields (Compound, Kelly) the grid has no empty first row to push them down. */
    body.calc-formula .cf-sum[data-layout="receipt"]:not(:has(> .cf-dir)) { grid-template-areas: "t1 o1 t2 . ans" "t3 o3 t4 . lines" "note note note . lines"; }
    body.calc-formula .cf-sum[data-layout="receipt"] > .cf-dir { grid-area: dir; justify-self: start; margin: 0; }
    body.calc-formula .cf-sum[data-layout="receipt"] .cf-term:nth-of-type(1) { grid-area: t1; }
    body.calc-formula .cf-sum[data-layout="receipt"] .cf-term:nth-of-type(2) { grid-area: t2; }
    body.calc-formula .cf-sum[data-layout="receipt"] .cf-term:nth-of-type(3) { grid-area: t3; }
    body.calc-formula .cf-sum[data-layout="receipt"] .cf-term:nth-of-type(4) { grid-area: t4; }
    body.calc-formula .cf-sum[data-layout="receipt"] .cf-terms > .cf-op { display: none; }
    body.calc-formula .cf-sum[data-layout="receipt"] .cf-terms > .cf-op-eq { display: none; }
    body.calc-formula .cf-sum[data-layout="receipt"] .cf-answer { grid-area: ans; align-self: end; padding: 0 0 4px; border: 0; }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines { grid-area: lines; gap: 0; margin: 0; padding: 8px 0 0; border-top: 1px solid var(--cf-line); }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--cf-line); font-size: 14px; }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li:last-child { border-bottom: 0; padding-top: 12px; }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines .cf-line-op { display: none; }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li > b { order: 2; white-space: nowrap; }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li > span { order: 1; color: var(--cf-ink); }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li > span::first-letter { text-transform: uppercase; }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li[data-cf-sign="minus"] > b::before { content: "−"; }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li > span i { display: block; color: var(--cf-faint); font-size: 12px; line-height: 16px; }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li:last-child > span { font-weight: 600; }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li:last-child > b { font-size: 16px; color: var(--cf-ink); }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li:last-child > b.is-gain { color: var(--cf-green); }
    body.calc-formula .cf-sum:is([data-layout="receipt"], [data-layout="purchases"]) .cf-lines li:last-child > b.is-loss { color: var(--cf-red); }
    body.calc-formula .cf-sum[data-layout="receipt"] > .cf-note { grid-area: note; margin: 0; align-self: end; }
    /* Stock Average: the purchases on the left, the average and its receipt on the right. */
    body.calc-formula .cf-sum[data-layout="purchases"] { grid-template-columns: minmax(0, 1fr) 64px minmax(0, 340px); }
    body.calc-formula .cf-sum[data-layout="purchases"] > .cf-avg-side { grid-column: 3; }
    body.calc-formula .cf-sum[data-layout="purchases"] .cf-answer { grid-column: auto; padding: 0; border: 0; }
    body.calc-formula .cf-sum[data-layout="purchases"] .cf-lines { margin-top: 20px; }
}

@media (max-width: 440px) {
    body.calc-formula .cf-chart :is(.lot-size-chart-axis, .position-chart-axis) text { font-size: 16px; }
}
