:root {
  color-scheme: light;
  --ink: #17211f;
  --muted: #66736f;
  --line: #dde7e1;
  --surface: #ffffff;
  --soft: #f5f8f5;
  --mist: #edf5f1;
  --green: #009c82;
  --green-dark: #006d5c;
  --green-strong: #005447;
  --mint: #dff2e9;
  --blue: #2d5f9a;
  --amber: #bd7a12;
  --rose: #b94b5f;
  --shadow: 0 22px 70px rgba(20, 45, 36, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(223, 242, 233, 0.65), rgba(255, 255, 255, 0) 520px),
    #fbfcfa;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

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

.hero {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
  padding: 6px 0 34px;
}

.brand-logo {
  display: block;
  width: min(170px, 46vw);
  height: auto;
  margin: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  font-size: clamp(2.25rem, 5vw, 4.1rem);
  line-height: 1;
  font-weight: 790;
}

h2 {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.1;
}

.investment-strip span,
.summary-strip span,
.package-card small {
  display: block;
  color: inherit;
  opacity: 0.72;
  font-size: 0.82rem;
}

.controls,
.packages,
.details {
  margin-top: 22px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 55px rgba(28, 55, 43, 0.06);
}

.controls,
.packages {
  padding: 28px;
}

.section-heading,
.details-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}

.quiet {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.scenario-switch {
  display: inline-flex;
  padding: 4px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 3px;
}

.scenario-button {
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.scenario-button.is-active {
  background: var(--surface);
  color: var(--green-dark);
  box-shadow: 0 6px 20px rgba(24, 57, 45, 0.1);
}

.input-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  gap: 16px;
  margin-top: 30px;
}

.field {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 0.88rem;
}

.field > span {
  display: flex;
  gap: 7px;
  align-items: center;
  min-height: 22px;
}

.field input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 14px;
  outline: none;
}

.field input:focus {
  border-color: rgba(0, 156, 130, 0.7);
  box-shadow: 0 0 0 4px rgba(0, 156, 130, 0.1);
}

.unit-field {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.unit-field:focus-within {
  border-color: rgba(0, 156, 130, 0.7);
  box-shadow: 0 0 0 4px rgba(0, 156, 130, 0.1);
}

.unit-field input {
  border: 0;
  box-shadow: none;
}

.unit-field input:focus {
  border: 0;
  box-shadow: none;
}

.unit-field span {
  padding-right: 14px;
  color: var(--muted);
  font-size: 0.86rem;
  white-space: nowrap;
}

.hint {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 1px solid #c8d7d0;
  border-radius: 50%;
  background: var(--surface);
  color: var(--green-dark);
  font-size: 0.72rem;
  font-weight: 760;
  cursor: help;
}

.tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  z-index: 5;
  width: min(320px, 80vw);
  padding: 12px 14px;
  border-radius: 8px;
  background: #17211f;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 460;
  line-height: 1.45;
  text-align: left;
  transform: translate(-50%, 6px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.hint:hover .tooltip,
.hint:focus-within .tooltip {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.tooltip-links {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.tooltip a {
  color: #b9f3e7;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.package-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.package-card {
  display: grid;
  grid-template-rows: 44px 1fr auto;
  gap: 16px;
  min-height: 250px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.package-card:hover,
.package-card.is-active {
  border-color: rgba(0, 156, 130, 0.55);
  box-shadow: 0 20px 45px rgba(28, 55, 43, 0.1);
  transform: translateY(-2px);
}

.package-card.is-active {
  background: linear-gradient(180deg, rgba(0, 156, 130, 0.08), rgba(255, 255, 255, 0.96));
}

.package-card[data-package="analysis"] .icon {
  background: #e3ecf8;
  color: var(--blue);
}

.package-card[data-package="letters"] .icon {
  background: #fff0d4;
  color: var(--amber);
}

.package-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.package-title h3 {
  margin: 0;
  font-size: 1.17rem;
  line-height: 1.25;
}

.icon {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--mint);
  color: var(--green-dark);
}

.icon svg {
  width: 19px;
  height: 19px;
}

.feature-list {
  display: grid;
  align-content: start;
  gap: 12px;
  align-self: start;
  margin: 0;
  padding: 0;
  list-style: none;
}

.feature-list li {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: #465651;
  font-size: 0.92rem;
  font-weight: 560;
  line-height: 1.35;
}

.feature-list li::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-top: 0.48em;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(0, 156, 130, 0.1);
}

.select-row {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 0;
  background: transparent;
  color: var(--green-dark);
  font-size: 0.86rem;
  font-weight: 620;
}

.package-card.is-active .select-row {
  background: transparent;
  color: var(--green);
}

.details {
  overflow: hidden;
}

.details-header {
  padding: 30px 30px 24px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--soft);
}

.summary-strip article {
  padding: 22px 24px;
  border-right: 1px solid var(--line);
}

.summary-strip article:last-child {
  border-right: 0;
}

.summary-strip strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(1.25rem, 2.6vw, 2rem);
  line-height: 1.05;
}

.summary-strip article:nth-child(-n + 3) strong {
  color: var(--green-strong);
  font-weight: 860;
}

.summary-strip article:nth-child(4) strong {
  color: var(--green-strong);
}

.breakdown-layout {
  padding: 30px;
}

.waterfall {
  display: grid;
  gap: 14px;
  align-content: start;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr) 140px;
  gap: 14px;
  align-items: center;
}

.bar-label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 650;
}

.bar-label .hint {
  justify-self: end;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--mist);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.bar-fill.cost {
  background: var(--rose);
}

.bar-value {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.bar-value.positive {
  color: var(--green-strong);
  font-weight: 720;
}

.bar-value.negative {
  color: var(--rose);
}

.investment-strip {
  border-top: 1px solid var(--line);
  background: #fff;
}

.investment-strip > div {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 24px;
  padding: 24px 30px;
}

.investment-strip strong {
  display: block;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
  line-height: 1.08;
}

.investment-strip small {
  color: var(--muted);
  font-size: 0.92rem;
}

.investment-strip small span {
  display: inline;
  opacity: 1;
}

.disclaimer {
  max-width: 720px;
  margin: 16px auto 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
  text-align: center;
  opacity: 0.82;
}

@media (max-width: 960px) {
  .input-grid,
  .package-grid,
  .summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .summary-strip article:nth-child(2) {
    border-right: 0;
  }
}

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

  .hero {
    min-height: auto;
    gap: 18px;
  }

  .section-heading,
  .details-header {
    display: grid;
  }

  .scenario-switch {
    width: 100%;
    overflow-x: auto;
  }

  .scenario-button {
    flex: 1 0 auto;
  }

  .input-grid,
  .package-grid,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-strip article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary-strip article:last-child {
    border-bottom: 0;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .bar-value {
    text-align: left;
  }
}
