:root {
  color-scheme: light;
  --ink: #14201c;
  --muted: #64716c;
  --line: #dfe5e1;
  --paper: #f7f9f7;
  --white: #ffffff;
  --forest: #102a24;
  --forest-soft: #193b33;
  --lime: #d9f99d;
  --lime-ink: #18330d;
  --danger: #ffd5cc;
  --danger-ink: #6e2519;
  --shadow: 0 22px 60px rgba(20, 32, 28, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 82% 4%, rgba(217, 249, 157, 0.4), transparent 22rem),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

button,
input {
  font: inherit;
}

button,
input {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 112px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 13px;
  background: var(--forest);
  color: var(--lime);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand h1,
.brand p,
.intro h2,
.intro p,
.panel-heading h3,
.panel-heading p,
.formula-note p,
.result-hero p,
.result-hero strong,
.result-hero span,
.reference-status p,
.reference-status strong,
footer p {
  margin: 0;
}

.eyebrow,
.section-kicker {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.brand h1 {
  font-size: 1.05rem;
  line-height: 1.2;
}

.text-button {
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 650;
}

.text-button:hover {
  border-bottom-color: currentColor;
  color: var(--ink);
}

.text-button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(54, 110, 94, 0.25);
  outline-offset: 2px;
}

.workspace {
  padding: 58px 0 28px;
}

.intro {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  align-items: end;
  gap: 48px;
  margin-bottom: 28px;
}

.section-kicker {
  margin-bottom: 7px !important;
  color: #426158;
}

.intro h2 {
  max-width: 690px;
  font-size: clamp(2rem, 4.4vw, 3.7rem);
  font-weight: 760;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.intro > p {
  max-width: 370px;
  padding-bottom: 5px;
  color: var(--muted);
  font-size: 1rem;
}

.calculator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, 0.9fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.input-panel,
.result-panel {
  padding: clamp(26px, 4vw, 46px);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 34px;
}

.panel-heading h3 {
  font-size: 1.25rem;
  letter-spacing: -0.025em;
}

.panel-heading p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.88rem;
}

.step-number {
  display: grid;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: #456159;
  font-size: 0.72rem;
  font-weight: 800;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 25px 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field-wide {
  grid-column: 1 / -1;
}

.field > span {
  color: #33443e;
  font-size: 0.88rem;
  font-weight: 700;
}

.field em {
  margin-left: 4px;
  color: #8a9692;
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 500;
}

.field small {
  color: #7a8782;
  font-size: 0.75rem;
}

.field > input,
.money-input,
.percent-input {
  height: 56px;
  border: 1px solid #d9e0dc;
  border-radius: 12px;
  background: #fbfcfb;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field > input {
  width: 100%;
  padding: 0 16px;
  color: var(--ink);
}

.money-input,
.percent-input {
  display: flex;
  align-items: center;
  overflow: hidden;
}

.money-input:focus-within,
.percent-input:focus-within,
.field > input:focus {
  border-color: #5b8277;
  box-shadow: 0 0 0 4px rgba(60, 107, 94, 0.09);
}

.money-input > span,
.percent-input > span {
  padding-left: 16px;
  color: #6c7a75;
  font-size: 0.9rem;
  font-weight: 700;
}

.money-input input,
.percent-input input {
  min-width: 0;
  width: 100%;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
}

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

.percent-input input {
  padding: 0 6px 0 16px;
}

.percent-input > span {
  padding: 0 16px 0 4px;
}

.plain-input {
  font-weight: 700 !important;
}

.profit-field .percent-input {
  border-color: #bfd885;
  background: #f7fce9;
}

.formula-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.83rem;
}

.formula-note > span {
  color: #507268;
  font-size: 1.15rem;
}

.result-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent 35%),
    var(--forest);
  color: var(--white);
}

.panel-heading-light h3 {
  color: var(--white);
}

.panel-heading-light p {
  max-width: 290px;
  overflow: hidden;
  color: #a7b8b2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-number-light {
  border-color: #355149;
  color: var(--lime);
}

.result-hero {
  padding: 8px 0 28px;
  border-bottom: 1px solid #2d4941;
}

.result-hero p {
  color: #a7b8b2;
  font-size: 0.85rem;
  font-weight: 650;
}

.result-hero strong {
  display: block;
  margin: 3px 0;
  overflow-wrap: anywhere;
  color: var(--lime);
  font-size: clamp(2.3rem, 5.5vw, 4.35rem);
  letter-spacing: -0.06em;
  line-height: 1.05;
}

.result-hero span {
  color: #d6dfdc;
  font-size: 0.9rem;
}

.reference-status {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 23px 0 11px;
  padding: 14px 16px;
  border: 1px solid rgba(217, 249, 157, 0.18);
  border-radius: 13px;
  background: rgba(217, 249, 157, 0.09);
}

.reference-status.is-over {
  border-color: rgba(255, 213, 204, 0.24);
  background: rgba(255, 213, 204, 0.09);
}

.status-icon {
  display: grid;
  flex: 0 0 31px;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 50%;
  background: var(--lime);
  color: var(--lime-ink);
  font-size: 0.85rem;
  font-weight: 900;
}

.is-over .status-icon {
  background: var(--danger);
  color: var(--danger-ink);
}

.reference-status strong {
  display: block;
  color: #f5faf8;
  font-size: 0.88rem;
}

.reference-status p {
  color: #a7b8b2;
  font-size: 0.76rem;
}

.result-list {
  margin: 0;
}

.result-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 0;
  border-bottom: 1px solid #2d4941;
}

.result-list dt {
  color: #a7b8b2;
  font-size: 0.84rem;
}

.result-list dd {
  margin: 0;
  color: #f5faf8;
  font-size: 0.9rem;
  font-weight: 750;
  text-align: right;
}

.decision-line {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-top: auto;
  padding-top: 28px;
}

.decision-line span {
  max-width: 135px;
  color: #a7b8b2;
  font-size: 0.78rem;
}

.decision-line strong {
  color: var(--white);
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  text-align: right;
}

footer {
  display: flex;
  justify-content: flex-end;
  padding: 19px 0 40px;
}

footer p {
  max-width: 540px;
  color: #7d8985;
  font-size: 0.76rem;
  text-align: right;
}

@media (max-width: 860px) {
  .intro {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .intro > p {
    max-width: 620px;
  }

  .calculator-grid {
    grid-template-columns: 1fr;
  }

  .result-panel {
    min-height: 580px;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
  }

  .topbar {
    min-height: 88px;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .workspace {
    padding-top: 36px;
  }

  .intro h2 {
    font-size: 2.35rem;
  }

  .calculator-grid {
    border-radius: 18px;
  }

  .input-panel,
  .result-panel {
    padding: 25px 20px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .field-wide {
    grid-column: auto;
  }

  .result-hero strong {
    font-size: clamp(2.15rem, 12.5vw, 3.15rem);
  }

  .text-button {
    max-width: 78px;
    font-size: 0.77rem;
    line-height: 1.15;
    text-align: right;
  }

  .result-list > div,
  .decision-line {
    gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
