/* Comped tools kit. One look for every free tool on comped.io.
   Loaded by each tool body: <link rel="stylesheet" href="/assets/tools/tools.css">
   Page colours and fonts come from the site variables (--porcelain, --surface, --forest, --money, --ink, --ink-soft,
   --hairline, --cream, --display, --body, --mono). Every rule is scoped under .calc or .at-table so nothing leaks
   into the article around the tool. */

/* ---------- frame ---------- */
.calc { --t-mint: #9BE3BD; --t-pale: #DCE9E1; --t-cream: #F5F0E6; --t-r: 10px; margin: 26px -10px 14px; font-family: var(--body); color: var(--ink); scroll-margin-top: 16px; }
@media (min-width: 860px) { .calc { margin-left: calc((100% - min(1040px, 100vw - 64px)) / 2); margin-right: calc((100% - min(1040px, 100vw - 64px)) / 2); } }
.calc *, .calc *::before, .calc *::after { box-sizing: border-box; }
.calc [hidden] { display: none !important; }
.calc .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* The sheet: inputs and answer are one object, split by a rule, not two floating cards. */
.calc .calc-grid { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--surface); border: 1px solid var(--hairline); border-radius: 16px; }
.calc .calc-col { padding: 20px 18px 12px; min-width: 0; }
.calc .calc-out { min-width: 0; border-top: 1px solid var(--hairline); }
.calc .calc-grid.one .calc-col { padding-bottom: 20px; }
.calc .calc-col + .calc-col { border-top: 1px solid var(--hairline); }
@media (min-width: 860px) {
  .calc .calc-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .calc .calc-grid.one { grid-template-columns: minmax(0, 1fr); }
  .calc .calc-col { padding: 26px 30px 16px; }
  .calc .calc-out { border-top: 0; border-left: 1px solid var(--hairline); }
  .calc .calc-out .result { border-radius: 0 15px 0 0; }
  .calc .calc-col + .calc-col { border-left: 1px solid var(--hairline); border-top: 0; }
  .calc .calc-out.is-sticky > .stick { position: sticky; top: 14px; }
}
.calc .calc-label { font-family: var(--mono); font-weight: 600; font-size: 11px; line-height: 1.3; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 4px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.calc .calc-col .calc-label ~ .calc-label, .calc .panel .calc-label ~ .calc-label { margin-top: 30px; }

/* ---------- fields ---------- */
.calc .field { display: grid; grid-template-columns: minmax(0, 1fr) 148px; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--hairline); }
.calc .field.last, .calc .field:last-child { border-bottom: 0; }
.calc .field.has-stepper { grid-template-columns: minmax(0, 1fr) 176px; }
.calc .field.wide { grid-template-columns: minmax(0, 1fr); gap: 9px; }
.calc .field label, .calc .field .f-label { font-size: 15px; color: var(--ink); font-weight: 600; line-height: 1.25; margin: 0; }
.calc .field label small, .calc .field .f-label small { display: block; font-weight: 400; font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; line-height: 1.35; }
.calc .money { position: relative; display: flex; }
.calc .money::before { content: "$"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-weight: 500; font-size: 15px; color: var(--ink-soft); pointer-events: none; z-index: 1; }
.calc .money.pct::before { content: "%"; left: auto; right: 13px; }
.calc .money.plain::before { content: none; }
.calc .money.stepper::before { left: 57px; }
.calc .money.pct.stepper::before { left: auto; right: 57px; }
.calc input[type="number"], .calc input[type="text"] { width: 100%; min-width: 0; height: 52px; margin: 0; border: 1px solid #D6D0C4; border-radius: var(--t-r); background: var(--porcelain); font-family: var(--mono); font-weight: 600; font-size: 17px; color: var(--ink); padding: 0 12px 0 28px; -moz-appearance: textfield; -webkit-appearance: none; appearance: none; transition: border-color .12s, box-shadow .12s, background .12s; }
.calc input[type="text"] { font-family: var(--body); font-size: 16px; padding: 0 13px; }
.calc .money.pct input { padding: 0 30px 0 13px; }
.calc .money.plain input { padding: 0 13px; }
.calc input[type="number"]::-webkit-outer-spin-button, .calc input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.calc input[type="number"]:hover, .calc input[type="text"]:hover { border-color: #B9B2A3; }
.calc input[type="number"]:focus, .calc input[type="text"]:focus { outline: 0; border-color: var(--forest); background: var(--surface); box-shadow: 0 0 0 3px rgba(13, 76, 60, 0.16); position: relative; z-index: 2; }
.calc button { font-family: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.calc button:focus-visible, .calc a:focus-visible, .calc summary:focus-visible, .calc input[type="range"]:focus-visible, .calc input[type="checkbox"]:focus-visible, .calc textarea:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }

/* stepper: minus, the number, plus, joined as one control */
.calc .stepper input { border-radius: 0; text-align: center; padding: 0 6px !important; }
.calc .stepper .step { flex: 0 0 48px; height: 52px; border: 1px solid #D6D0C4; background: var(--surface); color: var(--forest); font-family: var(--mono); font-weight: 600; font-size: 20px; line-height: 1; cursor: pointer; padding: 0; }
.calc .stepper .step:first-child { border-radius: var(--t-r) 0 0 var(--t-r); border-right: 0; }
.calc .stepper .step:last-child { border-radius: 0 var(--t-r) var(--t-r) 0; border-left: 0; }
.calc .stepper .step:hover { background: var(--porcelain); }
.calc .stepper .step:active { background: var(--t-pale); }
.calc .stepper.pct input { padding-right: 16px !important; }
.calc .stepper.pct::before { right: 54px; font-size: 13px; }

/* segmented control: built from a <select data-seg> or written as buttons */
.calc .seg { display: flex; gap: 3px; padding: 3px; border: 1px solid #D6D0C4; border-radius: 12px; background: var(--porcelain); }
.calc .seg button { flex: 1 1 0; min-width: 0; min-height: 48px; padding: 6px 8px; border: 0; border-radius: 9px; background: transparent; color: var(--ink); font-weight: 600; font-size: 14px; line-height: 1.2; cursor: pointer; transition: background .12s, color .12s; }
.calc .seg button small { display: block; font-family: var(--mono); font-weight: 500; font-size: 11px; letter-spacing: 0.02em; margin-top: 3px; opacity: 0.78; }
.calc .seg button:hover { background: rgba(13, 76, 60, 0.07); }
.calc .seg button[aria-checked="true"], .calc .seg button[aria-selected="true"] { background: var(--forest); color: #fff; }
.calc .seg.big { margin-bottom: 14px; background: var(--surface); }
.calc .seg.big button { min-height: 54px; font-size: 15px; }

/* chips: quick values and short pick lists */
.calc .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.calc .chips button { flex: 1 0 auto; min-width: 46px; height: 48px; padding: 0 12px; border: 1px solid #D6D0C4; border-radius: var(--t-r); background: var(--surface); color: var(--ink); font-family: var(--mono); font-weight: 600; font-size: 15px; cursor: pointer; transition: background .12s, color .12s, border-color .12s; }
.calc .chips.words button { font-family: var(--body); font-size: 14px; }
.calc .chips button:hover { border-color: var(--forest); }
.calc .chips button.on, .calc .chips button[aria-checked="true"], .calc .chips button[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: #fff; }
.calc .chips button.more { border-style: dashed; color: var(--forest); }
.calc .quick { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; padding: 10px 0 14px; border-bottom: 1px solid var(--hairline); }
.calc .quick button { min-width: 0; padding: 0; }
.calc .ch-full { font-weight: 600; font-size: 14.5px; color: var(--ink); margin: 4px 0 0; line-height: 1.35; }
.calc .ch-note { font-size: 13px; color: var(--ink-soft); line-height: 1.45; margin: 0; }

/* slider */
.calc .slider { padding: 6px 0 0; }
.calc .slider input[type="range"] { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 48px; margin: 0; background: transparent; cursor: pointer; }
.calc .slider input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(var(--forest), var(--forest)) 0 / var(--fill, 50%) 100% no-repeat, #D6D0C4; }
.calc .slider input[type="range"]::-moz-range-track { height: 6px; border-radius: 3px; background: #D6D0C4; }
.calc .slider input[type="range"]::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--forest); }
.calc .slider input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; margin-top: -12px; border-radius: 50%; background: var(--forest); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--forest); }
.calc .slider input[type="range"]::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: var(--forest); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--forest); }
.calc .slider .ends { display: flex; justify-content: space-between; font-family: var(--mono); font-weight: 500; font-size: 11.5px; color: var(--ink-soft); margin-top: -6px; }

/* checkbox row drawn as a switch */
.calc .field.check { grid-template-columns: minmax(0, 1fr) 56px; }
.calc .field.check input[type="checkbox"] { -webkit-appearance: none; appearance: none; justify-self: end; width: 56px; height: 32px; margin: 8px 0; border-radius: 16px; border: 1px solid #B9B2A3; background: var(--porcelain); position: relative; cursor: pointer; transition: background .12s, border-color .12s; }
.calc .field.check input[type="checkbox"]::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 1px solid #B9B2A3; transition: transform .12s; }
.calc .field.check input[type="checkbox"]:checked { background: var(--forest); border-color: var(--forest); }
.calc .field.check input[type="checkbox"]:checked::after { transform: translateX(24px); border-color: var(--surface); }
.calc .field.check input[type="checkbox"]:checked::before { content: ""; position: absolute; left: 11px; top: 9px; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* ---------- the answer ---------- */
.calc .result { background: var(--forest); color: var(--t-cream); padding: 24px 20px 24px; margin: 0; border: 0; border-radius: 0; box-shadow: none; position: static; top: auto; }
@media (min-width: 860px) { .calc .result { padding: 28px 30px 28px; } }
.calc .result p { color: inherit; }
.calc .r-label { font-family: var(--mono); font-weight: 600; font-size: 11px; line-height: 1.4; letter-spacing: 0.14em; text-transform: uppercase; color: var(--t-mint); margin: 0 0 8px; }
.calc .r-big { font-family: var(--display); font-weight: 800; font-size: clamp(46px, 13vw, 64px); letter-spacing: -0.03em; line-height: 1; margin: 0; color: #fff; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.calc .r-big.long { font-size: clamp(38px, 10.5vw, 56px); }
.calc .r-sub { font-size: 15px; line-height: 1.5; color: rgba(245, 240, 230, 0.86); margin: 10px 0 0; }
.calc .r-card { display: flex; gap: 14px; align-items: center; margin: 0 0 18px; padding-bottom: 18px; border-bottom: 1px solid rgba(245, 240, 230, 0.22); }
.calc .r-card .r-art { flex: 0 0 62px; width: 62px; aspect-ratio: 5 / 7; border-radius: 5px; background: rgba(245, 240, 230, 0.12) center / cover no-repeat; box-shadow: 0 0 0 1px rgba(245, 240, 230, 0.3); }
.calc .r-card .r-name { font-family: var(--display); font-weight: 800; font-size: 19px; line-height: 1.15; letter-spacing: -0.01em; color: #fff; margin: 0; }
.calc .r-card .r-set { font-size: 13px; line-height: 1.4; color: rgba(245, 240, 230, 0.8); margin: 4px 0 0; }

.calc .ledger { padding: 4px 18px 18px; }
@media (min-width: 860px) { .calc .ledger { padding: 6px 30px 22px; } }
.calc .r-lines { margin: 0; }
.calc .ledger.wide { grid-column: 1 / -1; border-top: 1px solid var(--hairline); }
.calc .ledger.wide > .r-head:first-child { margin-top: 18px; }
.calc .r-line { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 11px 0; border-bottom: 1px solid var(--hairline); font-size: 14.5px; line-height: 1.4; color: #3A463F; flex-wrap: wrap; }
.calc .r-line > span:first-child { flex: 1 1 0; min-width: 0; }
.calc .r-line .rv { font-family: var(--mono); font-weight: 600; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc .r-line.total { border-top: 2px solid var(--ink); margin-top: -1px; }
.calc .r-line.total > span:first-child, .calc .r-line.keep > span:first-child { color: var(--ink); font-weight: 600; }
.calc .r-line.total .rv, .calc .r-line.keep .rv { font-size: 17px; }
.calc .r-line.total .rv { color: var(--forest); }
.calc .r-line .lb { flex: 0 0 100%; height: 4px; border-radius: 2px; background: #ECE8DF; margin: 9px 0 -12px; overflow: hidden; }
.calc .r-line:has(.lb) { border-bottom-color: transparent; padding-bottom: 14px; }
.calc .r-line .lb i { display: block; height: 100%; width: 0; background: var(--forest); border-radius: 2px; transition: width .25s ease; }
.calc .r-head { font-family: var(--mono); font-weight: 600; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin: 22px 0 0; padding-bottom: 9px; border-bottom: 2px solid var(--ink); }
.calc .ledger > .r-head:first-child { margin-top: 16px; }
.calc .r-note { font-size: 13px; color: var(--ink-soft); margin: 14px 0 0; line-height: 1.55; }

/* three figures in a row, divided by rules */
.calc .compare { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 6px 0 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--hairline); }
.calc .cmp { padding: 14px 14px 14px; border-left: 1px solid var(--hairline); min-width: 0; }
.calc .cmp:first-child { border-left: 0; padding-left: 0; }
.calc .cmp:last-child { padding-right: 0; }
.calc .cmp .c-k { font-family: var(--mono); font-weight: 600; font-size: 10.5px; line-height: 1.45; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 8px; }
.calc .cmp .c-tax { font-family: var(--display); font-weight: 800; font-size: 25px; letter-spacing: -0.02em; line-height: 1.05; color: var(--ink); margin: 0; font-variant-numeric: tabular-nums; }
.calc .cmp .c-keep { font-size: 12.5px; color: var(--ink-soft); margin: 6px 0 0; line-height: 1.45; }
.calc .cmp .c-keep b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 560px) {
  .calc .compare { grid-template-columns: minmax(0, 1fr); }
  .calc .cmp { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; align-items: baseline; padding: 12px 0; border-left: 0; border-top: 1px solid var(--hairline); }
  .calc .cmp:first-child { border-top: 0; }
  .calc .cmp .c-k { margin: 0; grid-column: 1; }
  .calc .cmp .c-tax { grid-column: 2; grid-row: 1; font-size: 22px; text-align: right; }
  .calc .cmp .c-keep, .calc .cmp .stack { grid-column: 1 / -1; }
}

/* ---------- bars ---------- */
/* a stacked bar: where one amount goes */
.calc .stack { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: var(--porcelain); margin: 10px 0 0; }
.calc .stack i { display: block; height: 100%; width: 0; transition: width .25s ease; }
.calc .stack .s-pay { background: var(--forest); }
.calc .stack .s-fee { background: repeating-linear-gradient(135deg, #8A968F 0 1.5px, #E7E3DA 1.5px 5px); }
.calc .stack .s-cost { background: #9FB3A9; }
.calc .stack .s-profit { background: var(--money); }
.calc .result .stack { height: 16px; background: rgba(245, 240, 230, 0.14); margin-top: 20px; }
.calc .result .stack .s-pay { background: var(--t-cream); }
.calc .result .stack .s-cost { background: rgba(245, 240, 230, 0.5); }
.calc .result .stack .s-fee, .calc .result .stack .s-room { background: repeating-linear-gradient(135deg, rgba(245, 240, 230, 0.75) 0 1.5px, rgba(245, 240, 230, 0.12) 1.5px 6px); }
.calc .result .stack .s-profit { background: var(--t-mint); }
.calc .key { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 9px 0 0; padding: 0; list-style: none; font-size: 12.5px; line-height: 1.4; color: var(--ink-soft); }
.calc .key li { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 12.5px; line-height: 1.4; color: inherit; }
.calc .key b { font-family: var(--mono); font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.calc .key i { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 2px; }
.calc .result .key { color: rgba(245, 240, 230, 0.86); }
.calc .result .key b { color: #fff; }
.calc .key .s-pay { background: var(--forest); } .calc .result .key .s-pay { background: var(--t-cream); }
.calc .key .s-cost { background: #9FB3A9; } .calc .result .key .s-cost { background: rgba(245, 240, 230, 0.5); }
.calc .key .s-fee { background: repeating-linear-gradient(135deg, #8A968F 0 1.5px, #E7E3DA 1.5px 5px); }
.calc .result .key .s-fee, .calc .result .key .s-room { background: repeating-linear-gradient(135deg, rgba(245, 240, 230, 0.8) 0 1.5px, rgba(245, 240, 230, 0.14) 1.5px 5px); }
.calc .key .s-profit { background: var(--money); } .calc .result .key .s-profit { background: var(--t-mint); }

/* buy percentage: the comp split into what you pay and your room */
.calc .split { margin-top: 22px; }
.calc .split-top { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; line-height: 1.3; color: rgba(245, 240, 230, 0.86); }
.calc .split-top b { display: block; font-family: var(--mono); font-weight: 600; font-size: 16px; color: #fff; margin-top: 3px; font-variant-numeric: tabular-nums; }
.calc .split-top span:last-child { text-align: right; }
.calc .split-bar { position: relative; height: 26px; margin-top: 9px; border-radius: 4px; background: repeating-linear-gradient(135deg, rgba(245, 240, 230, 0.7) 0 1.5px, rgba(245, 240, 230, 0.1) 1.5px 7px); box-shadow: inset 0 0 0 1px rgba(245, 240, 230, 0.45); }
.calc .split-bar .pay { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px 0 0 4px; background: var(--t-cream); }
.calc .split-bar .tick { position: absolute; top: -5px; bottom: -5px; width: 0; border-left: 2px solid var(--t-mint); transform: translateX(-1px); }
.calc .split-ask { position: relative; height: 20px; margin-top: 7px; font-family: var(--mono); font-weight: 600; font-size: 11.5px; color: var(--t-mint); }
.calc .split-ask span { position: absolute; top: 0; white-space: nowrap; transform: translateX(-50%); }
.calc .split-ask span.l { transform: none; } .calc .split-ask span.r { transform: translateX(-100%); }

/* show profit: sales against break-even */
.calc .be { margin-top: 22px; }
.calc .be-bar { position: relative; height: 26px; border-radius: 4px; background: rgba(245, 240, 230, 0.12); box-shadow: inset 0 0 0 1px rgba(245, 240, 230, 0.4); }
.calc .be-bar i { position: absolute; top: 0; bottom: 0; left: 0; width: 0; }
.calc .be-bar .be-cost { background: rgba(245, 240, 230, 0.55); border-radius: 4px 0 0 4px; }
.calc .be-bar .be-over { background: var(--t-mint); }
.calc .be-bar .be-short { background: repeating-linear-gradient(135deg, rgba(245, 240, 230, 0.75) 0 1.5px, rgba(245, 240, 230, 0.1) 1.5px 6px); }
.calc .be-bar .tick { position: absolute; top: -6px; bottom: -6px; width: 0; border-left: 2px solid #fff; transform: translateX(-1px); }
.calc .be-at { position: relative; height: 36px; margin-top: 9px; font-size: 12.5px; line-height: 1.3; color: rgba(245, 240, 230, 0.86); }
.calc .be-at span { position: absolute; top: 0; white-space: nowrap; transform: translateX(-50%); text-align: center; }
.calc .be-at span.l { transform: none; text-align: left; } .calc .be-at span.r { transform: translateX(-100%); text-align: right; }
.calc .be-at b { display: block; font-family: var(--mono); font-weight: 600; font-size: 14px; color: #fff; font-variant-numeric: tabular-nums; }

/* card profit: every channel, ranked */
.calc .out-title, .calc .all-title { font-family: var(--mono); font-weight: 600; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-soft); margin: 34px 10px 0; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
@media (min-width: 860px) { .calc .out-title, .calc .all-title { margin-left: 0; margin-right: 0; } }
.calc .rank { list-style: none; margin: 0 10px; padding: 0; }
@media (min-width: 860px) { .calc .rank { margin: 0; } }
.calc .rank li { margin: 0; border-bottom: 1px solid var(--hairline); }
.calc .rank button { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; grid-template-areas: "n name val" "n bar bar"; column-gap: 8px; row-gap: 7px; align-items: baseline; width: 100%; min-height: 56px; padding: 10px 6px 12px; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: pointer; border-radius: 6px; }
.calc .rank button:hover { background: rgba(13, 76, 60, 0.05); }
.calc .rank .k-n { grid-area: n; font-family: var(--mono); font-weight: 500; font-size: 12px; color: var(--ink-soft); }
.calc .rank .k-name { grid-area: name; font-size: 14.5px; font-weight: 500; line-height: 1.3; min-width: 0; }
.calc .rank .k-tag { display: inline-block; margin-left: 8px; padding: 2px 7px; border-radius: 4px; background: var(--forest); color: #fff; font-family: var(--mono); font-weight: 600; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; vertical-align: 1px; }
.calc .rank .k-val { grid-area: val; font-family: var(--mono); font-weight: 600; font-size: 15px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.calc .rank .k-val small { font-weight: 500; font-size: 12px; color: var(--ink-soft); margin-left: 8px; display: inline-block; min-width: 46px; }
.calc .rank .k-bar { grid-area: bar; position: relative; height: 10px; border-radius: 2px; background: var(--porcelain); }
.calc .rank .k-bar i { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: #9FB3A9; transition: left .25s ease, width .25s ease; }
.calc .rank .k-bar i.neg { background: repeating-linear-gradient(135deg, #8A968F 0 1.5px, #E7E3DA 1.5px 5px); }
.calc .rank .k-bar b { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 1px solid var(--ink-soft); }
.calc .rank button[aria-pressed="true"] .k-name { font-weight: 700; }
.calc .rank button[aria-pressed="true"] .k-bar i { background: var(--forest); }
.calc .rank button[aria-pressed="true"] .k-bar i.neg { background: repeating-linear-gradient(135deg, var(--forest) 0 2px, #DCE9E1 2px 5px); }
.calc .rank button[aria-pressed="true"] .k-val { color: var(--forest); }
@media (min-width: 700px) {
  .calc .rank button { grid-template-columns: 26px minmax(0, 250px) minmax(0, 1fr) auto; grid-template-areas: "n name bar val"; align-items: center; min-height: 48px; padding: 8px 6px; column-gap: 14px; }
  .calc .rank .k-bar { height: 14px; }
}
.calc details.as-table { margin: 14px 10px 0; }
@media (min-width: 860px) { .calc details.as-table { margin: 14px 0 0; } }
.calc details.as-table summary { display: inline-flex; align-items: center; min-height: 48px; font-weight: 600; font-size: 14.5px; color: var(--forest); cursor: pointer; text-decoration: underline; text-decoration-color: var(--hairline); text-underline-offset: 3px; }
.calc .table-wrap { margin: 6px 0 0; }
.calc .data-table { border-top: 0; }
.calc .data-table tr.on td { background: var(--t-pale); font-weight: 600; }
.calc .data-table tfoot td { font-weight: 600; border-top: 2px solid var(--ink); }

/* 1099-K: the walk from Box 1a down to profit */
.calc .wf { margin: 6px 0 0; }
.calc .wf-row { padding: 11px 0 12px; margin: 0; max-width: none; border-bottom: 1px solid var(--hairline); }
.calc .wf-row.sub { display: block; font-size: inherit; line-height: inherit; color: inherit; }
.calc .wf-top { display: flex; justify-content: space-between; gap: 14px; align-items: baseline; font-size: 14.5px; line-height: 1.4; color: #3A463F; }
.calc .wf-top .rv { font-family: var(--mono); font-weight: 600; font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc .wf-bar { position: relative; height: 14px; margin-top: 7px; border-radius: 2px; background: var(--porcelain); }
.calc .wf-bar i { position: absolute; top: 0; bottom: 0; border-radius: 2px; background: repeating-linear-gradient(135deg, #7F8C85 0 1.5px, #E7E3DA 1.5px 5px); box-shadow: inset 0 0 0 1px #9AA59F; transition: left .25s ease, width .25s ease; }
.calc .wf-row.add .wf-bar i { background: #9FB3A9; box-shadow: none; }
.calc .wf-row.sub .wf-top span:first-child, .calc .wf-row.total .wf-top span:first-child { color: var(--ink); font-weight: 600; }
.calc .wf-row.sub .wf-bar i { background: var(--forest); box-shadow: none; }
.calc .wf-row.total { border-top: 2px solid var(--ink); margin-top: -1px; }
.calc .wf-row.total .wf-top .rv { font-size: 17px; color: var(--forest); }
.calc .wf-row.total .wf-bar i { background: var(--money); box-shadow: none; }
.calc .wf-where { font-size: 12.5px; color: var(--ink-soft); margin: 6px 0 0; line-height: 1.4; }

/* ---------- card rows (trade, cost basis) ---------- */
.calc .card-row { display: grid; grid-template-columns: 50px minmax(0, 1fr) minmax(0, 1fr) 48px; grid-template-areas: "art name name rm" "art value cost cost"; gap: 8px; align-items: end; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.calc .card-row.two { grid-template-areas: "art name name rm" "art value value value"; }
.calc .card-row.flat { grid-template-columns: 50px minmax(0, 1fr) 128px 48px; grid-template-areas: "art name value rm"; }
@media (max-width: 480px) { .calc .card-row.flat { grid-template-columns: 50px minmax(0, 1fr) 48px; grid-template-areas: "art name rm" "art value value"; } }
.calc.no-lookup .card-row { grid-template-columns: 0 minmax(0, 1fr) minmax(0, 1fr) 48px; column-gap: 8px; }
.calc.no-lookup .card-row .art, .calc.no-lookup .row-find { display: none; }
.calc .card-row .nm { grid-area: name; } .calc .card-row .c-v { grid-area: value; } .calc .card-row .c-c { grid-area: cost; }
.calc .cell { display: block; min-width: 0; }
.calc .cell > span { display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 4px; line-height: 1.3; }
.calc .card-row .art { grid-area: art; align-self: start; margin-top: 20px; width: 50px; aspect-ratio: 5 / 7; padding: 0; border: 1px dashed #A9B5AE; border-radius: 5px; background: var(--porcelain) center / cover no-repeat; color: var(--forest); cursor: pointer; display: grid; place-items: center; }
.calc .card-row .art svg { width: 18px; height: 18px; }
.calc .card-row .art.has { border: 1px solid var(--hairline); box-shadow: 0 6px 12px -8px rgba(20, 32, 27, 0.55); }
.calc .card-row .art.has svg { display: none; }
.calc .card-row .art:hover { border-color: var(--forest); }
.calc .rm { grid-area: rm; height: 52px; border: 1px solid #D6D0C4; border-radius: var(--t-r); background: var(--surface); color: var(--ink-soft); font-size: 22px; line-height: 1; cursor: pointer; padding: 0; }
.calc .rm:hover { color: var(--ink); border-color: #B9B2A3; }
.calc .row-look { grid-column: 1 / -1; padding: 12px; border: 1px solid var(--hairline); border-radius: 12px; background: var(--porcelain); }
.calc .row-look comped-card-lookup { margin: 0; }
.calc .row-look .ccl-input { background: var(--surface); }
.calc .row-look .look-done { margin-top: 10px; width: 100%; height: 48px; border: 1px solid var(--forest); border-radius: var(--t-r); background: var(--surface); color: var(--forest); font-weight: 600; font-size: 14.5px; cursor: pointer; }
.calc .row-btns { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin: 12px 0 8px; }
.calc.no-lookup .row-btns { grid-template-columns: minmax(0, 1fr); }
.calc .add-btn { height: 48px; padding: 0 10px; border: 1px solid #D6D0C4; border-radius: var(--t-r); background: var(--surface); color: var(--forest); font-weight: 600; font-size: 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.calc .add-btn svg { width: 16px; height: 16px; flex: none; }
.calc .add-btn:hover { border-color: var(--forest); }
.calc .add-btn.find { background: var(--forest); border-color: var(--forest); color: #fff; }

/* trade: two sides of a table and the verdict between them */
.calc .side-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin: 0 0 4px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.calc .side-head .calc-label { border: 0; padding: 0; margin: 0; color: var(--ink); font-size: 12px; }
.calc .side-head .side-total { font-family: var(--mono); font-weight: 600; font-size: 17px; color: var(--ink); font-variant-numeric: tabular-nums; }
.calc .verdict { grid-column: 1 / -1; border-top: 1px solid var(--hairline); text-align: center; }
.calc .verdict .r-big { font-size: clamp(40px, 11vw, 60px); }
.calc .verdict .r-sub { max-width: 34em; margin-left: auto; margin-right: auto; }
.calc .beam { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 0; margin: 22px auto 0; max-width: 760px; }
.calc .beam .b-side { min-width: 0; }
.calc .beam .b-cap { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; color: rgba(245, 240, 230, 0.86); margin-bottom: 7px; }
.calc .beam .b-cap b { font-family: var(--mono); font-weight: 600; font-size: 15px; color: #fff; font-variant-numeric: tabular-nums; }
.calc .beam .b-get .b-cap { flex-direction: row-reverse; padding-left: 12px; }
.calc .beam .b-give .b-cap { padding-right: 12px; }
.calc .beam .b-track { position: relative; height: 16px; background: rgba(245, 240, 230, 0.12); }
.calc .beam .b-track i { position: absolute; top: 0; bottom: 0; width: 0; background: var(--t-cream); transition: width .25s ease; }
.calc .beam .b-give .b-track { border-radius: 3px 0 0 3px; } .calc .beam .b-give .b-track i { right: 0; }
.calc .beam .b-get .b-track { border-radius: 0 3px 3px 0; } .calc .beam .b-get .b-track i { left: 0; background: var(--t-mint); }
.calc .beam .b-mid { width: 2px; height: 34px; background: #fff; align-self: start; margin-top: 17px; }
.calc .beam .b-pile { display: flex; gap: 5px; min-height: 0; margin-top: 16px; flex-wrap: wrap; }
.calc .beam .b-pile:empty { margin-top: 0; }
.calc .beam .b-give .b-pile { justify-content: flex-end; }
.calc .beam .b-pile span { width: 40px; aspect-ratio: 5 / 7; border-radius: 4px; background: rgba(245, 240, 230, 0.12) center / cover no-repeat; box-shadow: 0 0 0 1px rgba(245, 240, 230, 0.35); }
.calc .beam .b-mid + .b-side .b-pile { padding-left: 10px; } .calc .beam .b-give .b-pile { padding-right: 10px; }
.calc .ledger.pair { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: 60px; grid-column: 1 / -1; }
@media (min-width: 860px) { .calc .ledger.pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .calc .ledger.pair > .r-note, .calc .ledger.pair > .share-row { grid-column: 1 / -1; } .calc .ledger.pair .r-head { margin-top: 16px; } }

/* cost basis: list to copy */
.calc .list-out { display: block; width: calc(100% - 20px); min-height: 170px; margin: 12px 10px 0; border: 1px solid var(--hairline); border-radius: 12px; background: var(--surface); color: var(--ink); font-family: var(--mono); font-size: 14px; line-height: 1.65; padding: 14px 16px; resize: vertical; }
@media (min-width: 860px) { .calc .list-out { width: 100%; margin-left: 0; margin-right: 0; } }
.calc .calc-out + .table-wrap, .calc .calc-grid + .out-title + .table-wrap { margin-left: 10px; margin-right: 10px; }
.calc > .table-wrap { margin-left: 10px; margin-right: 10px; }
@media (min-width: 860px) { .calc > .table-wrap { margin-left: 0; margin-right: 0; } }

/* ---------- actions ---------- */
.calc .share-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 18px; }
.calc .share-row button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 16px; border: 1px solid var(--forest); border-radius: var(--t-r); background: var(--forest); color: #fff; font-weight: 600; font-size: 14.5px; line-height: 1.2; cursor: pointer; transition: background .12s, border-color .12s; }
.calc .share-row button svg { width: 16px; height: 16px; flex: none; }
.calc .share-row button:hover { background: #0A3D30; }
.calc .share-row button.quiet { background: var(--surface); color: var(--forest); border-color: #D6D0C4; }
.calc .share-row button.quiet:hover { background: var(--porcelain); border-color: var(--forest); }
.calc .share-row .copied { flex: 1 1 100%; font-size: 13.5px; line-height: 1.4; color: var(--forest); font-weight: 600; min-height: 0; }
.calc .share-row .copied:empty { display: none; }
.calc .share-row a { font-weight: 600; }
@media (max-width: 480px) { .calc .share-row button { flex: 1 1 auto; } }

/* ---------- lookup inside a tool ---------- */
.calc comped-card-lookup { margin: 0 0 20px; }
.calc .lk-empty { border-top: 1px solid var(--hairline); padding: 16px 0 0; color: var(--ink-soft); font-size: 15px; line-height: 1.55; }
.calc .lk-try { margin-top: 12px; }
.calc .lk-next { margin-top: 0; }
.calc .lk-label { margin-top: 26px; }

/* ---------- sticky answer bar on phones ---------- */
.t-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: none; align-items: center; justify-content: space-between; gap: 14px; width: 100%; min-height: 56px; padding: 9px 18px calc(9px + env(safe-area-inset-bottom, 0px)); border: 0; border-top: 1px solid rgba(245, 240, 230, 0.25); background: #0D4C3C; color: #F5F0E6; text-align: left; cursor: pointer; font-family: var(--body); transform: translateY(100%); transition: transform .18s ease; }
.t-bar.on { transform: none; }
.t-bar .tb-l { font-family: var(--mono); font-weight: 600; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: #9BE3BD; line-height: 1.35; min-width: 0; }
.t-bar .tb-v { font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; line-height: 1; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-bar:focus-visible { outline: 2px solid #fff; outline-offset: -4px; }
@media (max-width: 859px) { .t-bar { display: flex; } }

/* ---------- "Comped does this at the table" ---------- */
.article-body .at-table { display: grid; grid-template-columns: 56px minmax(0, 1fr); column-gap: 18px; row-gap: 4px; align-items: start; margin: 30px 0 12px; padding: 22px 0 22px; border: 0; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--hairline); border-radius: 0; background: none; }
.article-body .at-table::before { content: ""; grid-column: 1; grid-row: 1 / span 3; width: 56px; height: 56px; border-radius: 13px; background: #0D4C3C url("/img/app-icon-128.png") center / cover no-repeat; }
.article-body .at-table > * { grid-column: 2; }
.article-body .at-table .c-label, .article-body .at-table h2 { font-family: var(--display); font-weight: 800; font-size: 20px; line-height: 1.2; letter-spacing: -0.012em; color: var(--ink); margin: 2px 0 2px; text-transform: lowercase; }
.article-body .at-table .c-label::first-letter, .article-body .at-table h2::first-letter { text-transform: uppercase; }
.article-body .at-table p { margin: 0; font-size: 15.5px; line-height: 1.6; color: #3A463F; }
.article-body .at-table .store { display: inline-block; margin-top: 12px; justify-self: start; line-height: 0; }
.article-body .at-table .store svg { height: 46px; width: auto; display: block; }
@media (min-width: 700px) {
  .article-body .at-table { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .article-body .at-table .store { grid-column: 3; grid-row: 1 / span 3; align-self: center; margin-top: 0; }
}

/* tables in the article under a tool */
.chart-table td.num, .chart-table th.num, .line-table td.num, .all-table td.num, .all-table th.num, .basis-table td.num, .basis-table th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  .calc *, .t-bar { transition: none !important; }
}
