:root {
  --ink: #17221c;
  --muted: #607068;
  --line: #dce5df;
  --paper: #f5f8f5;
  --card: #ffffff;
  --green: #126b43;
  --green-dark: #0b4a2e;
  --green-soft: #e8f4ed;
  --lime: #c8ee75;
  --red: #a33d32;
  --shadow: 0 18px 55px rgba(25, 50, 37, 0.09);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

button, input { font: inherit; }

.site-header,
footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.site-header { height: 76px; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: var(--ink);
  color: var(--lime);
  font-size: 16px;
}

.header-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.tool-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 18px auto 0;
  padding: 38px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 95% 5%, rgba(200, 238, 117, .34), transparent 27%),
    var(--card);
  box-shadow: var(--shadow);
}

.title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(36px, 5vw, 58px);
  line-height: 1.06;
  letter-spacing: -.055em;
}

.copy-button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  border-radius: 12px;
  background: var(--ink);
  color: white;
  cursor: pointer;
  font-weight: 750;
}

.copy-button:disabled { cursor: not-allowed; opacity: .38; }
.copy-button:not(:disabled):hover { background: var(--green-dark); }
.copy-button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid rgba(18, 107, 67, .25); outline-offset: 2px; }

.calculator-grid {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  gap: 20px;
}

.calculator-card {
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
}

.card-heading {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}

.step-number {
  display: grid;
  flex: 0 0 36px;
  height: 36px;
  place-items: center;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 850;
}

.card-heading h2 {
  margin: -3px 0 0;
  font-size: 21px;
  line-height: 1.35;
  letter-spacing: -.025em;
}

.card-heading p { margin: 1px 0 0; color: var(--muted); font-size: 14px; }

.field-grid { display: grid; gap: 14px; }
.two-columns { grid-template-columns: 1fr 1fr; }
.cost-fields { grid-template-columns: repeat(6, 1fr); }
.cost-fields .field:first-child { grid-column: span 2; }
.cost-fields .field:not(:first-child) { grid-column: span 1; }

.field { min-width: 0; }
.field > span:first-child { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 750; }
.field small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.35; }

.input-wrap {
  display: flex;
  height: 48px;
  align-items: center;
  overflow: hidden;
  border: 1px solid #cad6ce;
  border-radius: 11px;
  background: white;
  transition: border-color .15s, box-shadow .15s;
}

.input-wrap:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(18, 107, 67, .1); }
.prefix { padding-left: 12px; color: var(--muted); font-weight: 700; }
input { width: 100%; min-width: 0; height: 100%; padding: 0 10px 0 5px; border: 0; outline: 0; background: transparent; color: var(--ink); font-weight: 700; }
input::placeholder { color: #a2aea7; font-weight: 500; }

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 20px;
}

.result {
  min-width: 0;
  min-height: 130px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #f8faf8;
}

.result-primary { border-color: #b7d8c4; background: var(--green-soft); }
.result-label { display: block; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.result strong { display: block; overflow-wrap: anywhere; margin: 7px 0 4px; font-size: clamp(27px, 3.4vw, 40px); line-height: 1; letter-spacing: -.04em; }
.result > span:last-child { display: block; color: var(--muted); font-size: 11px; line-height: 1.35; }

.math-panel {
  margin-top: 12px;
  padding: 13px 15px;
  overflow: hidden;
  border: 1px dashed #bfcac3;
  border-radius: 13px;
  background: #fbfcfb;
}

.math-label { margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.math-panel code { display: block; overflow-wrap: anywhere; color: var(--ink); font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; line-height: 1.5; white-space: normal; }
.math-stack code + code { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--line); }
.validation-message { min-height: 20px; margin: 7px 0 -7px; color: var(--red); font-size: 12px; font-weight: 700; }

.content { width: min(760px, calc(100% - 40px)); margin: 90px auto; }
.content section + section { margin-top: 70px; }
.content h2 { margin-bottom: 14px; font-size: clamp(27px, 4vw, 38px); line-height: 1.15; letter-spacing: -.04em; }
.content p { color: #48564f; }
.formula-block { margin: 24px 0; padding: 23px; border-left: 4px solid var(--green); border-radius: 0 14px 14px 0; background: white; font-family: "SFMono-Regular", Consolas, monospace; font-size: clamp(17px, 3vw, 22px); font-weight: 750; }
.formula-list { margin: 24px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: white; }
.formula-list div { display: flex; justify-content: space-between; gap: 20px; padding: 17px 20px; }
.formula-list div + div { border-top: 1px solid var(--line); }
.formula-list span { font-weight: 800; }
.formula-list code { color: var(--green-dark); text-align: right; }
.steps { margin: 25px 0 0; padding: 0; list-style: none; }
.steps li { display: flex; gap: 15px; align-items: flex-start; }
.steps li + li { margin-top: 15px; }
.steps li > span { display: grid; flex: 0 0 30px; height: 30px; place-items: center; border-radius: 50%; background: var(--ink); color: var(--lime); font-size: 12px; font-weight: 800; }
.steps p { margin: 1px 0 0; }

details { border-top: 1px solid var(--line); }
details:last-child { border-bottom: 1px solid var(--line); }
summary { padding: 18px 2px; cursor: pointer; font-weight: 780; }
details p { padding: 0 25px 18px 2px; margin: 0; }

footer { padding: 34px 0 44px; border-top: 1px solid var(--line); }
footer p { margin: 0; color: var(--muted); font-size: 13px; }
.footer-brand { font-size: 16px; }
.footer-brand .brand-mark { width: 30px; height: 30px; border-radius: 8px; font-size: 13px; }

@media (max-width: 900px) {
  .tool-shell { padding: 28px; }
  .calculator-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .site-header, footer, .tool-shell, .content { width: min(100% - 24px, 1180px); }
  .site-header { height: 64px; }
  .header-label { display: none; }
  .tool-shell { margin-top: 8px; padding: 19px; border-radius: 20px; }
  .title-row { align-items: stretch; flex-direction: column; gap: 15px; margin-bottom: 20px; }
  h1 { font-size: 39px; }
  .copy-button { width: 100%; }
  .calculator-card { padding: 17px; border-radius: 16px; }
  .two-columns, .result-grid { grid-template-columns: 1fr; }
  .cost-fields { grid-template-columns: 1fr 1fr; }
  .cost-fields .field:first-child, .cost-fields .field:not(:first-child) { grid-column: span 1; }
  .cost-fields .field:last-child { grid-column: 1 / -1; }
  .result { min-height: 112px; }
  .result strong { font-size: 34px; }
  .content { margin-top: 65px; margin-bottom: 65px; }
  .content section + section { margin-top: 52px; }
  .formula-list div { flex-direction: column; gap: 5px; }
  .formula-list code { text-align: left; }
  footer { align-items: flex-start; flex-direction: column; gap: 14px; }
}

@media (max-width: 380px) {
  .cost-fields { grid-template-columns: 1fr; }
}
