@font-face {
  font-family: "Martian Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  src: url("../fonts/martian-mono-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Martian Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  font-stretch: 75% 112.5%;
  src: url("../fonts/martian-mono-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("../fonts/instrument-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("../fonts/instrument-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}

/* Layout: a bank-slip control panel on the left, torn off by a perforated line from the live results on the right. */
:root {
  color-scheme: light;
  --paper: #E8EEE8; --sheet: #F7F9F5; --sheet-2: #EEF3EE;
  --ink: #14261F; --ink-2: #3F5148; --ink-3: #566860;
  --rule: #C4D0C7; --grid: #DDE5DE; --neutral: #93A69B;
  --s10: #00875A; --s10x: #1F6FC2; --s30: #B45309; --mix: #5B3FC4; --on-mix: #FFFFFF;
  --good: #0A6B48; --bad: #B3261E;
  --display: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #101915; --sheet: #17211D; --sheet-2: #1E2A25;
    --ink: #E6EEE8; --ink-2: #BAC8BF; --ink-3: #94A59B;
    --rule: #33423B; --grid: #27342E; --neutral: #5F7268;
    --s10: #1BA174; --s10x: #3E8FDB; --s30: #BE8016; --mix: #8E76EC; --on-mix: #101915;
    --good: #5FD0A4; --bad: #FF9A8F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #101915; --sheet: #17211D; --sheet-2: #1E2A25;
  --ink: #E6EEE8; --ink-2: #BAC8BF; --ink-3: #94A59B;
  --rule: #33423B; --grid: #27342E; --neutral: #5F7268;
  --s10: #1BA174; --s10x: #3E8FDB; --s30: #BE8016; --mix: #8E76EC; --on-mix: #101915;
  --good: #5FD0A4; --bad: #FF9A8F;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body {
  margin: 0;
  background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.5;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
  padding-block: 28px 56px;
}
.wrap { max-width: 1240px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
a { color: inherit; text-underline-offset: 2px; }
button, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--mix); outline-offset: 2px; }

header { display: grid; gap: 10px; }
.eyebrow { margin: 0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
h1 { margin: 0; font-family: var(--display); font-stretch: 75%; font-weight: 600; font-size: clamp(27px, 4.4vw, 44px); line-height: 1.12; letter-spacing: -.02em; text-wrap: balance; }
.lead { margin: 0; font-size: clamp(17px, 2vw, 20px); line-height: 1.45; max-width: 68ch; color: var(--ink-2); min-height: 4.4em; }
.lead strong { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }

.layout { display: grid; grid-template-columns: minmax(0, 372px) minmax(0, 1fr); gap: 0; align-items: start; }
.slip { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 16px); max-height: calc(100vh - 32px - env(safe-area-inset-top, 0px)); overflow-y: auto; background: var(--sheet); border: 1px solid var(--rule); }
.results { display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; min-width: 0; padding-left: 28px; margin-left: 28px; border-left: 2px dashed var(--rule); }

.field { padding: 12px 16px 14px; border-bottom: 1px solid var(--rule); display: grid; gap: 8px; }
.field:last-child { border-bottom: 0; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
label.cap, .cap { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
.val { display: flex; align-items: baseline; gap: 4px; }
.val input { width: 9ch; text-align: right; border: 0; border-bottom: 1px solid var(--rule); background: transparent; padding: 0 0 1px; font-family: var(--display); font-stretch: 75%; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.val span { font-family: var(--display); font-stretch: 75%; font-size: 15px; color: var(--ink-3); }
.band { background: var(--sheet-2); padding: 8px 16px; border-bottom: 1px solid var(--rule); font-size: 12px; letter-spacing: .07em; text-transform: uppercase; font-weight: 650; color: var(--ink-2); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 30px; margin: 0; background: transparent; cursor: pointer; --pct: 0%; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(to right, var(--mix) var(--pct), var(--rule) var(--pct)); }
input[type=range]::-moz-range-track { height: 4px; background: var(--rule); }
input[type=range]::-moz-range-progress { height: 4px; background: var(--mix); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 26px; margin-top: -11px; background: var(--ink); border: 2px solid var(--sheet); border-radius: 2px; }
input[type=range]::-moz-range-thumb { width: 10px; height: 22px; background: var(--ink); border: 2px solid var(--sheet); border-radius: 2px; }
.ends { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; margin-top: -6px; }

.refs { display: flex; flex-wrap: wrap; gap: 6px; }
.ref { border: 1px solid var(--rule); background: transparent; padding: 4px 8px; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.ref:hover { background: var(--sheet-2); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.check input { accent-color: var(--mix); width: 16px; height: 16px; margin: 0; }

.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--rule); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { padding: 7px 4px; text-align: center; font-size: 13.5px; cursor: pointer; border-left: 1px solid var(--rule); color: var(--ink-2); }
.seg label:first-of-type { border-left: 0; }
.seg input:checked + label { background: var(--mix); color: var(--on-mix); font-weight: 600; }
.seg input:focus-visible + label { outline: 2px solid var(--mix); outline-offset: 2px; }

.go { background: var(--mix); color: var(--on-mix); border: 0; padding: 10px 12px; font-weight: 650; font-size: 14.5px; cursor: pointer; width: 100%; }
.go:hover { filter: brightness(1.08); }
.hint { margin: 0; font-size: 13px; line-height: 1.4; color: var(--ink-3); }

h2 { margin: 0 0 12px; font-family: var(--display); font-stretch: 75%; font-size: 19px; font-weight: 600; letter-spacing: -.01em; text-wrap: balance; }
.sub { margin: -6px 0 14px; color: var(--ink-3); font-size: 14.5px; max-width: 65ch; }

.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
.compare { background: var(--sheet); border: 1px solid var(--rule); }
.compare th, .compare td { padding: 10px 12px; border-bottom: 1px solid var(--grid); text-align: right; font-size: 15px; vertical-align: baseline; }
.compare tr:last-child th, .compare tr:last-child td { border-bottom: 0; }
.compare thead th { font-size: 13px; font-weight: 650; border-bottom: 1px solid var(--rule); vertical-align: bottom; }
.compare tbody th { text-align: left; font-weight: 400; color: var(--ink-2); font-size: 14px; }
.compare td { font-family: var(--display); font-stretch: 75%; font-size: 14.5px; }
.compare .big th { color: var(--ink); font-weight: 650; }
.compare .big td { font-size: 17px; font-weight: 650; }
.key { display: inline-block; width: 16px; height: 3px; margin-right: 6px; vertical-align: middle; border-radius: 2px; }

.bars { display: grid; gap: 14px; }
.bar-row { display: grid; gap: 5px; }
.bar-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14.5px; }
.bar-head b { font-family: var(--display); font-stretch: 75%; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-head span { color: var(--ink-3); font-size: 13.5px; }
.bar { display: flex; gap: 2px; height: 20px; }
.bar i { display: block; height: 100%; min-width: 0; }
.bar i:first-child { background: var(--neutral); }
.bar i:last-child { border-radius: 0 4px 4px 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 10px; }
.legend .sw { display: inline-block; width: 11px; height: 11px; margin-right: 2px; vertical-align: -1px; }

.chart { position: relative; touch-action: pan-y; }
.chart:focus-visible { outline: 2px solid var(--mix); outline-offset: 4px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--body); font-size: 12px; fill: var(--ink-3); font-variant-numeric: tabular-nums; }
.chart text.dl { fill: var(--ink-2); font-weight: 600; }
.tip { position: absolute; top: 4px; pointer-events: none; background: var(--sheet); border: 1px solid var(--rule); padding: 7px 10px; font-size: 13px; min-width: 156px; display: grid; gap: 2px; z-index: 2; }
.tip b { font-weight: 650; font-variant-numeric: tabular-nums; }
.tip .t { color: var(--ink-3); font-size: 12px; margin-bottom: 2px; }
.tip div { display: flex; align-items: center; gap: 6px; }
.tip div span:last-child { color: var(--ink-3); margin-left: auto; padding-left: 10px; font-size: 12px; }

.plan-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; align-items: center; }
.plan-tools .seg { background: var(--sheet); }
.plan-tools .seg label { padding-inline: 12px; white-space: nowrap; }
.copy { border: 1px solid var(--rule); background: var(--sheet); padding: 7px 12px; font-size: 13.5px; cursor: pointer; }
.copy:hover { background: var(--sheet-2); }
#copyMsg { font-size: 13px; color: var(--ink-3); }
.plan-box { max-height: 520px; overflow: auto; background: var(--sheet); border: 1px solid var(--rule); }
.plan { min-width: 620px; }
.plan th, .plan td { padding: 6px 10px; text-align: right; font-size: 14px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
.plan td { font-family: var(--display); font-stretch: 75%; font-size: 13.5px; }
.plan thead th { position: sticky; top: 0; background: var(--sheet-2); font-size: 12.5px; font-weight: 650; color: var(--ink-2); border-bottom: 1px solid var(--rule); z-index: 1; }
.plan tbody th { text-align: left; font-weight: 500; }
.plan tfoot th, .plan tfoot td { position: sticky; bottom: 0; background: var(--sheet-2); font-weight: 650; border-top: 1px solid var(--rule); border-bottom: 0; }
.plan tfoot th { text-align: left; }

.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 32px; }
.notes > div { min-width: 0; }
.notes h3 { margin: 0 0 6px; font-size: 15.5px; font-weight: 650; }
.notes p, .notes ul { margin: 0 0 8px; font-size: 14.5px; color: var(--ink-2); max-width: 62ch; }
.notes ul { padding-left: 18px; }
.notes li { margin-bottom: 4px; }
.src { font-size: 13.5px; color: var(--ink-3); }
.src ul { margin: 0; padding-left: 18px; columns: 2; column-gap: 32px; }
.src li { break-inside: avoid; margin-bottom: 3px; }

.strip { display: none; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pair .field + .field { border-left: 1px solid var(--rule); }
.pair .val input { width: 3ch; }
.pair .val span { font-size: 13px; }
.diff { font-family: var(--display); font-stretch: 75%; font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
input:disabled { opacity: .55; cursor: not-allowed; }
.credit-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: var(--sheet); border: 1px solid var(--rule); border-bottom: 0; }
.credit-inputs .field { border-bottom: 0; }
.credit-inputs .field + .field { border-left: 1px solid var(--rule); }
.credit-notes { margin-top: 18px; }
.start-out { font-size: 14px; }
.status { font-family: var(--body); font-weight: 650; font-size: 14px; white-space: nowrap; }
.status.ok { color: var(--good); }
.status.no { color: var(--bad); }

@media (max-width: 960px) {
  body { padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px)); }
  .layout { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .slip { position: static; max-height: none; overflow: visible; }
  .results { padding-left: 0; margin-left: 0; border-left: 0; border-top: 2px dashed var(--rule); padding-top: 24px; }
  .lead { min-height: 0; }
  .strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px 8px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--sheet); border-top: 1px solid var(--rule);
    padding-top: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }
  .strip p { grid-column: 1 / -1; margin: 0; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; font-weight: 600; color: var(--ink-3); }
  .strip div { display: grid; min-width: 0; }
  .strip span { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
  .strip b { font-family: var(--display); font-stretch: 75%; font-size: 13.5px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
}
@media (max-width: 640px) {
  .notes { grid-template-columns: minmax(0, 1fr); }
  .credit-inputs { grid-template-columns: minmax(0, 1fr); }
  .credit-inputs .field + .field { border-left: 0; border-top: 1px solid var(--rule); }
  .compare.credit tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .src ul { columns: 1; }
  .compare, .compare thead, .compare tbody { display: block; }
  .compare tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px 6px; padding: 8px 10px; border-bottom: 1px solid var(--grid); }
  .compare tbody tr:last-child { border-bottom: 0; }
  .compare th, .compare td { padding: 0; border-bottom: 0; font-size: 13px; }
  .compare thead th { font-size: 12px; text-align: right; }
  .compare thead th:first-child { display: none; }
  .compare tbody th { grid-column: 1 / -1; font-size: 13px; }
  .compare td { font-size: 13px; }
  .compare .big td { font-size: 13.5px; }
  .compare td { white-space: nowrap; }
  .compare td.wrap-ok { white-space: normal; }
  .key { display: block; margin: 0 0 4px auto; }
  .plan-tools .seg label { padding-inline: 6px; font-size: 12.5px; }
}
