:root {
  --navy: #001740;
  --navy-soft: #092657;
  --gold: #eec643;
  --gold-dark: #cfa522;
  --white: #ffffff;
  --surface: #fbfaf6;
  --ink: #343434;
  --muted: #878787;
  --grid: #dedede;
  --line: rgba(255, 255, 255, 0.16);
  --error: #f6a7a1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f3f1eb;
  color: var(--white);
  font-family: "Inter Tight", Arial, sans-serif;
  overflow-x: hidden;
}

.calculator-shell {
  width: 100%;
  margin: 0;
  background: var(--navy);
  border: 1px solid rgba(0, 23, 64, 0.18);
  border-bottom: 6px solid var(--gold);
  box-shadow: 0 28px 70px rgba(0, 23, 64, 0.22);
}

.brand-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  background: var(--white);
  color: var(--navy);
  border-top: 10px solid var(--navy);
  border-right: 1px solid rgba(0, 23, 64, 0.16);
  border-bottom: 1px solid rgba(0, 23, 64, 0.16);
  border-left: 1px solid rgba(0, 23, 64, 0.16);
}

.brand-header > div:not(.language-toggle) {
  flex: 1;
  min-width: 0;
}

.brand-header img {
  width: 100px;
  height: 100px;
  background: var(--navy);
  object-fit: contain;
  box-shadow: 0 14px 30px rgba(0, 23, 64, 0.18);
}

.brand-header p,
.brand-header h1 {
  margin: 0;
}

.language-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(0, 23, 64, 0.08);
  border: 1px solid rgba(0, 23, 64, 0.14);
  border-radius: 999px;
}

.language-button {
  min-width: 48px;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--navy);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: none;
}

.language-button.is-active {
  background: var(--navy);
  color: var(--white);
}

.brand-header p {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand-header h1 {
  color: var(--navy);
  font-size: clamp(2rem, 10vw, 3.35rem);
  font-weight: 700;
  line-height: 1;
  overflow-wrap: anywhere;
}

.step-title {
  margin: 0;
  padding: 16px 22px;
  background: var(--gold);
  color: var(--navy);
  border-top: 1px solid rgba(0, 23, 64, 0.18);
  border-right: 1px solid rgba(0, 23, 64, 0.18);
  border-bottom: 1px solid rgba(0, 23, 64, 0.22);
  border-left: 1px solid rgba(0, 23, 64, 0.18);
  font-size: clamp(1.35rem, 2.45vw, 1.9rem);
  font-weight: 700;
  line-height: 1.18;
  overflow-wrap: anywhere;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: center;
  justify-items: center;
  min-height: 0;
  padding: 26px 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0));
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  border-left: 1px solid rgba(255, 255, 255, 0.18);
}

.field-row.bordered {
  border-top: 1px solid var(--line);
}

.field-copy label {
  display: block;
  margin-bottom: 12px;
  color: var(--white);
  font-size: clamp(1.35rem, 2.35vw, 1.75rem);
  font-weight: 600;
  line-height: 1.1;
}

.field-copy label span {
  color: var(--gold);
}

.field-copy p {
  max-width: 760px;
  margin: 0;
  color: var(--white);
  font-size: clamp(1.25rem, 2.4vw, 1.7rem);
  font-weight: 500;
  line-height: 1.18;
}

.field-error {
  display: none;
  grid-column: 1 / -1;
  width: 100%;
  max-width: 520px;
  margin: -8px 0 0;
  color: var(--error);
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
}

.field-row.has-error .field-error {
  display: block;
}

input,
select,
button {
  font: inherit;
}

.money-input,
.plain-input,
.select-input {
  width: 100%;
  max-width: 520px;
  height: 64px;
  border: 1px solid rgba(0, 23, 64, 0.26);
  background: var(--white);
  color: #060606;
  font-size: clamp(1.22rem, 5.2vw, 1.45rem);
  font-weight: 500;
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(0, 23, 64, 0.06), 0 12px 28px rgba(0, 23, 64, 0.12);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.money-input {
  display: flex;
  align-items: center;
  padding: 0 22px;
}

.money-input span {
  flex: 0 0 auto;
}

.money-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: inherit;
  background: transparent;
  font-weight: inherit;
  font-size: inherit;
}

.money-input:focus-within,
.plain-input:focus,
.select-input:focus {
  border-color: var(--gold);
  box-shadow: inset 0 0 0 1px rgba(238, 198, 67, 0.55), 0 16px 34px rgba(0, 23, 64, 0.18);
  outline: none;
  transform: translateY(-1px);
}

.field-row.has-error .money-input,
.field-row.has-error .plain-input {
  border-color: var(--error);
  box-shadow: inset 0 0 0 1px rgba(246, 167, 161, 0.55), 0 12px 28px rgba(0, 23, 64, 0.12);
}

.plain-input,
.select-input {
  padding: 0 24px;
}

.select-input {
  appearance: auto;
}

.form-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 26px 22px;
  border-top: 1px solid var(--line);
}

.button {
  flex: 0 1 180px;
  min-width: 0;
  min-height: 58px;
  border: 0;
  border-radius: 10px;
  color: var(--white);
  cursor: pointer;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 0 16px 34px rgba(0, 23, 64, 0.18);
  transition: box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

.button:hover,
.button:focus-visible {
  box-shadow: 0 20px 44px rgba(0, 23, 64, 0.24);
  outline: none;
  transform: translateY(-1px);
}

.calculate-button {
  padding: 0 28px;
  background: var(--gold);
  color: var(--navy);
}

.calculate-button:hover,
.calculate-button:focus-visible {
  background: #f3cf55;
}

.reset-button {
  padding: 0 26px;
  background: var(--white);
  color: var(--navy);
}

.results-panel {
  padding: 28px 18px 34px;
  background: var(--navy);
  border-top: 8px solid var(--gold);
}

.is-hidden {
  display: none;
}

.results-header {
  text-align: center;
  border-bottom: 2px solid rgba(255, 255, 255, 0.5);
  padding-bottom: 38px;
}

.results-header h1 {
  margin: 0 0 18px;
  font-size: clamp(2.5rem, 5vw, 3.9rem);
  font-weight: 700;
  line-height: 1.1;
}

.results-header p {
  margin: 0;
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  font-weight: 600;
  line-height: 1.25;
}

.results-header strong {
  display: inline-block;
  margin: 0 6px;
  padding: 0 14px 4px;
  background: var(--gold);
  color: var(--navy);
  font-size: clamp(1.4rem, 7vw, 1.08em);
  max-width: 100%;
  overflow-wrap: anywhere;
  vertical-align: middle;
}

.chart-card {
  position: relative;
  background: var(--surface);
  color: var(--ink);
  margin-top: 40px;
  padding: 12px 10px 24px;
  border-top: 8px solid var(--gold);
  box-shadow: 0 22px 52px rgba(0, 23, 64, 0.22);
}

.chart-card h2 {
  margin: 0 0 6px;
  text-align: center;
  color: var(--navy);
  font-size: clamp(1.85rem, 3vw, 2.55rem);
  font-weight: 700;
}

canvas {
  display: block;
  width: 100%;
  max-height: 610px;
  touch-action: none;
}

.chart-tooltip {
  position: absolute;
  z-index: 2;
  max-width: 220px;
  padding: 10px 12px;
  background: var(--navy);
  color: var(--white);
  box-shadow: 0 8px 22px rgba(0, 23, 64, 0.24);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.25;
  pointer-events: none;
}

.chart-tooltip strong {
  display: block;
  color: var(--gold);
  font-size: 1rem;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 42px;
  flex-wrap: wrap;
  color: var(--ink);
  font-size: clamp(1.1rem, 2vw, 1.65rem);
  font-weight: 600;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.future-marker,
.contribution-marker {
  position: relative;
  width: 32px;
  height: 3px;
  background: var(--gold);
}

.future-marker::after {
  content: "";
  position: absolute;
  left: 12px;
  top: -6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--gold);
}

.contribution-marker {
  background: var(--navy);
}

.contribution-marker::after {
  content: "";
  position: absolute;
  left: 12px;
  top: -6px;
  width: 13px;
  height: 13px;
  background: var(--navy);
  transform: rotate(45deg);
}

.table-button {
  display: block;
  margin: 40px auto 0;
  padding: 0 30px;
  background: var(--gold);
  color: var(--navy);
}

.table-wrap {
  margin-top: 28px;
  overflow-x: auto;
  background: var(--white);
  box-shadow: 0 18px 42px rgba(0, 23, 64, 0.18);
}

table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ink);
  font-size: 1.15rem;
}

th,
td {
  padding: 16px 18px;
  border-bottom: 1px solid var(--grid);
  text-align: right;
}

th:first-child,
td:first-child {
  text-align: left;
}

@media (max-width: 760px) {
  .calculator-shell {
    max-width: 100vw;
  }

  .brand-header {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 18px 14px 22px;
  }

  .brand-header img {
    width: 92px;
    height: 92px;
  }

  .brand-header p {
    font-size: clamp(0.8rem, 3.6vw, 1rem);
  }

  .brand-header h1 {
    font-size: clamp(1.7rem, 7.1vw, 2.45rem);
    max-width: 100%;
  }

  .language-toggle {
    justify-self: end;
    align-self: center;
  }

  .language-button {
    min-width: 42px;
    min-height: 32px;
    font-size: 0.82rem;
  }

  .step-title {
    padding: 15px 20px;
    font-size: clamp(1.2rem, 6.4vw, 1.55rem);
  }
}

@media (max-width: 420px) {
  .brand-header {
    grid-template-columns: 72px minmax(0, 1fr) auto;
    gap: 10px;
    padding: 16px 12px 20px;
  }

  .brand-header img {
    width: 72px;
    height: 72px;
  }

  .brand-header h1 {
    font-size: clamp(1.45rem, 6.7vw, 2rem);
  }

  .language-toggle {
    gap: 2px;
    padding: 3px;
  }

  .language-button {
    min-width: 36px;
    min-height: 30px;
    font-size: 0.74rem;
  }

  .field-row {
    padding-right: 18px;
    padding-left: 18px;
  }
}

@media (min-width: 761px) {
  .calculator-shell {
    width: min(1340px, calc(100% - 28px));
    margin: 24px auto;
    border: 1px solid rgba(0, 23, 64, 0.18);
  }

  .brand-header {
    gap: 32px;
    padding: 48px 44px 52px;
  }

  .brand-header img {
    width: 136px;
    height: 136px;
  }

  .brand-header p {
    font-size: clamp(1.35rem, 2.5vw, 2rem);
  }

  .brand-header h1 {
    font-size: clamp(2.9rem, 5.6vw, 4.4rem);
  }

  .field-row {
    grid-template-columns: 1fr;
    min-height: 136px;
    gap: 20px;
    padding: 30px 40px;
  }

  .field-error {
    justify-self: center;
  }

  .money-input,
  .plain-input,
  .select-input {
    max-width: 520px;
    height: 64px;
  }

  .form-actions {
    justify-content: center;
    gap: 28px;
    padding: 40px;
  }

  .button {
    flex: 0 0 auto;
    min-width: 190px;
    font-size: 1.45rem;
  }

  .results-panel {
    padding: 38px 40px 40px;
  }

  .chart-card {
    padding: 12px 20px 34px;
  }

}
