.by-tool {
  --tool-ink: #142e27;
  --tool-green: #164e39;
  --tool-muted: #43594f;
  --tool-line: #cbd9d1;
  --tool-soft: #edf4ef;
  margin: 0 auto;
  color: var(--tool-ink);
  scroll-margin-top: 6rem;
}
.by-tool [hidden] { display: none !important; }
.by-tool-intro { max-width: 48rem; margin-bottom: 1.75rem; }
.by-tool-intro h2 { margin: 0 0 .65rem; }
.by-tool-intro p { color: var(--tool-muted); margin: 0; }
.by-budget-shell, .by-example-shell {
  background: #fff;
  border: 1px solid var(--tool-line);
  border-radius: 1rem;
  overflow: clip;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
}
.by-budget-inputs, .by-budget-result, .by-example-terms, .by-example-choices {
  padding: clamp(1.25rem, 3.2vw, 2.5rem);
  min-width: 0;
}
.by-budget-inputs label, .by-scenarios legend {
  display: block; font-weight: 650; color: var(--tool-ink); font-size: 1rem;
}
.by-money-input {
  margin: .5rem 0 1.6rem;
  display: flex;
  align-items: center;
  padding: 0 .9rem;
  gap: .5rem;
  border: 1px solid #8b9e93;
  border-radius: .45rem;
  background: #fff;
  max-width: 21rem;
}
.by-money-input span { color: var(--tool-muted); font-size: 1.15rem; }
.by-money-input:focus-within { outline: 2px solid var(--tool-green); outline-offset: 2px; }
.by-money-input input {
  border: 0; padding: .8rem 0; width: 100%; min-width: 0; font: inherit; font-weight: 650;
  color: var(--tool-ink); background: transparent; line-height: 1.35;
}
.by-money-input input:focus-visible { outline: 0; }
.by-error { color: #86251f; font-size: .91rem; margin: -1rem 0 1rem; }
.by-rate-label, .by-scale { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.by-rate-label b { color: var(--tool-green); }
.by-budget-inputs input[type="range"] { margin: .45rem 0 0; width: 100%; height: 2rem; accent-color: var(--tool-green); cursor: pointer; }
.by-budget-inputs input[type="range"]:focus-visible { outline: 2px solid var(--tool-green); outline-offset: 2px; }
.by-scale { color: var(--tool-muted); font-size: .8125rem; }
.by-fine, .by-outcome-note, .by-budget-result small {
  font-size: .9rem; line-height: 1.55; color: var(--tool-muted);
}
.by-fine { margin: 1.4rem 0 0; }
.by-budget-result { background: var(--tool-green); color: #fff; }
.by-figure-label { font-size: 1rem; font-weight: 600; }
.by-budget-result .by-big-figure {
  font-size: clamp(2.6rem, 5vw, 4.75rem); letter-spacing: -.05em; line-height: 1.1; font-weight: 650;
  color: #fff; margin: .5rem 0 1.2rem; overflow-wrap: anywhere;
}
.by-budget-result small { display: block; color: #e0ede5; margin: 1rem 0 0; }
.by-math-list { margin: 0; width: 100%; }
.by-math-list > div {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .9rem; padding: .7rem 0; border-top: 1px solid var(--tool-line); text-align: start;
}
.by-math-list dt { font-size: .94rem; }
.by-math-list dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; overflow-wrap: anywhere; }
.by-budget-result .by-math-list > div { border-color: rgba(255,255,255,.32); }
.by-example-shell { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); }
.by-example-terms { background: var(--tool-soft); }
.by-example-terms h3, .by-example-choices h3 { margin: 0 0 1rem; font-size: 1.4rem; }
.by-scenarios { border: 0; padding: 0; margin: 0; min-width: 0; }
.by-scenarios legend { padding: 0; margin: 0 0 .6rem; }
.by-scenario-switch { display: flex; gap: .35rem; flex-wrap: wrap; }
.by-scenario-switch label { position: relative; cursor: pointer; }
.by-scenario-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; top: 50%; left: 50%; }
.by-scenario-switch span {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: .35rem .73rem;
  border: 1px solid #9eafa4; border-radius: 100px; font-size: .875rem; font-weight: 600;
  background: #fff; color: var(--tool-green);
}
.by-scenario-switch input:checked + span { color: #fff; background: var(--tool-green); border-color: var(--tool-green); }
.by-scenario-switch input:focus-visible + span { outline: 3px solid #4278bd; outline-offset: 2px; }
.by-outcome-math { margin: 1.25rem 0 0; }
.by-outcome-math .by-net { border-color: #768b7f; font-weight: 650; }
.by-net dd { font-size: 1.45rem; color: var(--tool-green); }
.by-outcome-note { margin: .5rem 0 0; }
@media (max-width: 700px) {
  .by-budget-shell, .by-example-shell { grid-template-columns: minmax(0,1fr); }
}

@media (forced-colors: active) {
  .by-scenario-switch input:checked + span { border: 3px solid Highlight; }
  .by-scenario-switch input:focus-visible + span { outline-color: Highlight; }
}
@media (max-width: 380px) {
  .by-example-shell noscript .by-math-list > div { display: block; }
  .by-example-shell noscript dd { margin-top: .25rem; text-align: start; }
}
@media print {
  .by-budget-result, .by-budget-result .by-big-figure, .by-budget-result small {
    color: #172b21; background: #fff;
  }
  .by-budget-result .by-math-list > div { border-color: #9baba1; }
  .by-scenario-switch input:checked + span { border: 2px solid #142e27; color: #142e27; background: #fff; }
}
.by-table{grid-column:1/-1;padding:1rem clamp(1.1rem,3vw,2.5rem);border-top:1px solid var(--tool-line);min-width:0;background:#fafcf8}
.by-table summary{cursor:pointer;font-weight:650;color:var(--tool-green)}
.by-table table{border-collapse:collapse;width:100%;margin:.75rem 0;text-align:left;font-size:.95rem}
.by-table caption{text-align:left;color:var(--tool-muted);padding-bottom:.5rem;font-size:.9rem}
.by-table td,.by-table th{border-top:1px solid var(--tool-line);padding:.55rem .4rem;vertical-align:top;line-height:1.4;overflow-wrap:anywhere}
.by-table td{font-variant-numeric:tabular-nums}
@media(max-width:560px){.by-table[open]{overflow-x:auto}.by-table table{min-width:32rem}.by-table th:first-child{position:sticky;left:0;background:#fafcf8}}
