:root {
  color-scheme: light;
  --bg: #f5f7f2;
  --surface: #ffffff;
  --surface-soft: #f8faf7;
  --surface-muted: #eef3ef;
  --text: #16201a;
  --muted: #5a665f;
  --line: #d8ded8;
  --accent: #146c43;
  --accent-dark: #0d5633;
  --accent-soft: #e4f2ea;
  --warning: #b42318;
  --warning-bg: #fff1f0;
  --focus: #1d7a55;
  --shadow: 0 18px 48px rgba(22, 32, 26, 0.08);
  --shadow-soft: 0 10px 24px rgba(22, 32, 26, 0.05);
  --radius-lg: 18px;
  --radius-md: 12px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(20, 108, 67, 0.07), transparent 28%),
    radial-gradient(circle at top right, rgba(20, 108, 67, 0.04), transparent 24%),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

input::placeholder {
  color: #7e8b84;
}

button,
input,
a {
  transition: color 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.page-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px);
}

.header-inner {
  min-height: 64px;
  display: flex;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 700;
  text-decoration: none;
}

.brand::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: linear-gradient(135deg, #1d7a55, #146c43);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}

.hero {
  padding: 52px 0 40px;
}

.hero-grid {
  display: grid;
  gap: 22px;
}

.hero-copy {
  max-width: 760px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin-bottom: 14px;
  padding: 6px 12px;
  border: 1px solid rgba(20, 108, 67, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--accent-dark);
  box-shadow: var(--shadow-soft);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

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

h1 {
  margin-bottom: 12px;
  font-size: clamp(2.2rem, 4.8vw, 4rem);
  line-height: 0.98;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.hero-subtitle {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.12rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.calculator-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: start;
  gap: 22px;
  width: 100%;
  max-width: 100%;
  padding: 24px;
  overflow: hidden;
  border: 1px solid rgba(20, 108, 67, 0.1);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 247, 0.98));
  box-shadow: var(--shadow);
}

.calculator-inputs,
.calculator-results {
  min-width: 0;
}

.calculator-results {
  display: grid;
  align-content: start;
  gap: 18px;
}

.calculator-inputs h2,
.steps-panel h2 {
  margin-bottom: 18px;
  font-size: 1.12rem;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.field {
  margin-bottom: 17px;
}

label,
legend {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

fieldset {
  padding: 0;
  border: 0;
  margin: 0;
}

.money-input,
.percent-input {
  display: flex;
  min-height: 48px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.92);
  color: var(--muted);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.money-input:focus-within,
.percent-input:focus-within {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(29, 122, 85, 0.14);
}

.money-input span,
.percent-input span {
  flex: 0 0 auto;
  padding: 0 14px;
  font-weight: 700;
}

input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  outline: 0;
}

.money-input input {
  padding: 12px 14px 12px 0;
}

.percent-input input {
  padding: 12px 0 12px 14px;
}

.field-error {
  min-height: 21px;
  margin: 6px 0 0;
  color: var(--warning);
  font-size: 0.88rem;
}

.is-invalid .money-input,
.is-invalid .percent-input {
  border-color: var(--warning);
  background: var(--warning-bg);
}

.quick-discounts {
  margin: 3px 0 20px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 38px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(238, 243, 239, 0.85);
  color: var(--text);
  font-weight: 700;
}

.chip:hover,
.chip:focus-visible {
  border-color: var(--accent);
  background: #f0f6f2;
  outline: 0;
}

.chip.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: 0 6px 14px rgba(20, 108, 67, 0.12);
}

.primary-button {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #1b7a50, var(--accent));
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 14px 24px rgba(20, 108, 67, 0.2);
}

.primary-button:hover,
.primary-button:focus-visible {
  background: linear-gradient(180deg, #156a44, var(--accent-dark));
  outline: 0;
  box-shadow: 0 0 0 3px rgba(29, 122, 85, 0.18);
  transform: translateY(-1px);
}

.result-summary {
  max-width: 100%;
  min-height: 134px;
  padding: 18px;
  border: 1px solid rgba(20, 108, 67, 0.1);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #ffffff, #f7fbf8);
  box-shadow: var(--shadow-soft);
}

.empty-state {
  display: grid;
  min-height: 96px;
  place-items: center;
  gap: 8px;
  padding: 8px;
  color: var(--muted);
  text-align: center;
}

.empty-state p {
  max-width: 28rem;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.empty-state small {
  display: block;
  max-width: 22rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.result-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.metric {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(20, 108, 67, 0.1);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.metric:first-child {
  background: linear-gradient(180deg, rgba(228, 242, 234, 0.9), #ffffff);
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 1.9rem;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.steps-panel {
  max-width: 100%;
  min-height: 224px;
  padding: 18px;
  border: 1px solid rgba(20, 108, 67, 0.1);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #f3f7f4, #eef3ef);
}

.steps-list {
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.steps-list li + li {
  margin-top: 10px;
}

.content-stack {
  display: grid;
  gap: 28px;
  padding-bottom: 56px;
}

.info-section,
.faq-section,
.related-section {
  border-top: 1px solid var(--line);
  padding-top: 28px;
}

.info-section h2,
.faq-section h2,
.related-section h2 {
  margin-bottom: 12px;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
}

.info-section p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.formula-box {
  display: inline-block;
  max-width: 100%;
  margin-top: 14px;
  padding: 13px 15px;
  border: 1px solid rgba(20, 108, 67, 0.12);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, #f8fcf9, #ffffff);
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
  overflow-wrap: anywhere;
}

.faq-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.faq-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.faq-card h3 {
  margin-bottom: 8px;
  font-size: 1rem;
  line-height: 1.3;
}

.faq-card p {
  margin-bottom: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

code {
  color: var(--text);
  font-family: "Courier New", Courier, monospace;
}

.related-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.related-list li {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.related-list span {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.related-list em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
}

.site-footer {
  padding: 22px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  backdrop-filter: blur(8px);
}

.site-footer p {
  margin-bottom: 0;
}

@media (max-width: 780px) {
  .page-shell {
    width: min(1040px, calc(100% - 24px));
  }

  .hero {
    padding-top: 32px;
  }

  .calculator-panel {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 18px 16px;
  }

  .result-summary,
  .steps-panel {
    padding: 16px;
  }

  .result-values,
  .faq-list,
  .related-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 15px;
  }

  .page-shell {
    width: min(1040px, calc(100% - 20px));
  }

  .hero {
    padding: 24px 0 28px;
  }

  h1 {
    font-size: 1.82rem;
    line-height: 1.05;
  }

  .hero-kicker {
    margin-bottom: 12px;
  }

  .calculator-panel {
    gap: 16px;
    margin-inline: 0;
    padding: 14px;
  }

  .calculator-inputs h2,
  .steps-panel h2 {
    font-size: 1.04rem;
  }

  .chip-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
    gap: 7px;
  }

  .chip {
    min-width: 0;
    padding-inline: 8px;
  }

  .result-values {
    grid-template-columns: 1fr;
  }

  .metric strong {
    font-size: 1.45rem;
  }
}

@media (max-width: 440px) {
  .related-list li {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}
