:root {
  --ink: #16243a;
  --ink-soft: #53637a;
  --navy: #152940;
  --navy-2: #1d3854;
  --paper: #ffffff;
  --canvas: #f3f6f8;
  --line: #d9e1e7;
  --line-soft: #e9eef2;
  --emerald: #087c64;
  --emerald-soft: #e8f6f1;
  --purple: #6653b8;
  --purple-soft: #f0edfb;
  --amber: #a65f08;
  --amber-soft: #fff4df;
  --red: #b43d3d;
  --red-soft: #fff0f0;
  --shadow: 0 18px 45px rgba(20, 40, 63, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% -8%, rgba(102, 83, 184, 0.12), transparent 27rem),
    var(--canvas);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  min-height: 94px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px clamp(20px, 3.4vw, 56px);
  background: linear-gradient(126deg, var(--navy), #203d59 65%, #2b3f62);
  color: #fff;
  box-shadow: 0 5px 18px rgba(22, 36, 58, 0.18);
}

.app-header h1,
.panel-heading h2,
.results-heading h2,
.table-toolbar h3,
.option-card h3 {
  margin: 0;
}

.app-header h1 {
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  letter-spacing: -0.035em;
}

.eyebrow,
.section-kicker {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  color: #a9cbd6;
}

.section-kicker {
  color: var(--purple);
}

.pricing-stamp {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #e5eef4;
  font-size: 0.8rem;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4fe1b5;
  box-shadow: 0 0 0 4px rgba(79, 225, 181, 0.13);
}

.pricing-stamp.is-stale .status-dot {
  background: #ffc460;
  box-shadow: 0 0 0 4px rgba(255, 196, 96, 0.15);
}

.workspace {
  width: min(1720px, 100%);
  margin: 0 auto;
  padding: 24px clamp(16px, 2.4vw, 36px) 40px;
  display: grid;
  grid-template-columns: minmax(310px, 370px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.input-panel,
.results-panel {
  border: 1px solid rgba(217, 225, 231, 0.9);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.input-panel {
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  scrollbar-width: thin;
}

.results-panel {
  min-width: 0;
  padding: clamp(18px, 2vw, 28px);
}

.panel-heading,
.results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.panel-heading {
  padding: 22px 22px 16px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-heading h2,
.results-heading h2 {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}

.text-button {
  appearance: none;
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 0.82rem;
  font-weight: 750;
}

form {
  padding-bottom: 20px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 18px 22px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
}

legend {
  width: 100%;
  margin-bottom: 12px;
  padding: 0;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 6px;
  min-width: 0;
  margin-bottom: 13px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 700;
}

label:last-child {
  margin-bottom: 0;
}

input[type="date"],
input[type="number"],
select,
.money-input,
.percent-input {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 1px solid #cbd5dd;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input[type="date"],
input[type="number"],
select {
  padding: 9px 11px;
  outline: none;
}

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

.money-input {
  grid-template-columns: auto minmax(0, 1fr);
}

.percent-input {
  grid-template-columns: minmax(0, 1fr) auto;
}

.money-input > span,
.percent-input > span {
  padding: 0 10px;
  color: #7a8999;
  font-weight: 750;
}

.money-input input,
.percent-input input {
  min-height: 40px;
  padding: 9px 2px;
  border: 0;
  border-radius: 0;
  outline: none;
}

input:focus,
select:focus,
.money-input:focus-within,
.percent-input:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(102, 83, 184, 0.12);
}

input[readonly] {
  background: #f5f8fa;
  color: #546375;
}

.money-input:has(input[readonly]) {
  background: #f5f8fa;
}

.field-grid {
  display: grid;
  gap: 10px;
}

.field-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  margin: 2px 0 12px;
  color: var(--ink);
  font-weight: 650;
  cursor: pointer;
}

.check-row.compact {
  margin-top: -2px;
}

.check-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--purple);
}

.field-note {
  margin: -3px 0 0;
  color: #748294;
  font-size: 0.72rem;
  line-height: 1.45;
}

.calculated-output {
  display: grid;
  gap: 3px;
  margin: 2px 0 11px;
  padding: 11px 12px;
  border: 1px solid rgba(102, 83, 184, 0.2);
  border-radius: 9px;
  background: var(--purple-soft);
}

.calculated-output span,
.calculated-output small {
  color: #71679b;
  font-size: 0.69rem;
  font-weight: 700;
}

.calculated-output strong {
  color: var(--purple);
  font-size: 1rem;
}

.is-hidden {
  display: none !important;
}

.assumptions {
  border-bottom: 1px solid var(--line-soft);
}

.assumptions summary {
  padding: 15px 22px;
  color: var(--purple);
  font-size: 0.79rem;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.assumption-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 10px;
  padding: 2px 22px 12px;
}

.assumptions > .field-note {
  padding: 0 22px 17px;
}

.form-actions {
  padding: 18px 22px 0;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 9px 15px;
  border-radius: 9px;
  font-weight: 800;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.primary-button {
  width: 100%;
  border: 1px solid var(--navy);
  background: var(--navy);
  color: #fff;
  box-shadow: 0 8px 18px rgba(21, 41, 64, 0.18);
}

.secondary-button {
  border: 1px solid #cbd5dd;
  background: #fff;
  color: var(--ink);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(21, 41, 64, 0.13);
}

.results-heading {
  margin-bottom: 18px;
}

.program-switch {
  display: inline-flex;
  gap: 4px;
  margin: -2px 0 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f7f9fb;
}

.program-switch button {
  min-height: 36px;
  padding: 7px 13px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #68778a;
  font-size: 0.78rem;
  font-weight: 800;
}

.program-switch button.is-active {
  background: #fff;
  color: var(--purple);
  box-shadow: 0 2px 8px rgba(21, 41, 64, 0.1);
}

.validation-message {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid #f0c57d;
  border-radius: 10px;
  background: var(--amber-soft);
  color: #7b4805;
  font-size: 0.82rem;
  line-height: 1.45;
}

.validation-message.is-error {
  border-color: #efb2b2;
  background: var(--red-soft);
  color: #8c2f2f;
}

.snapshot-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfd;
}

.snapshot-strip > div {
  min-width: 0;
  padding: 13px 15px;
  border-right: 1px solid var(--line);
}

.snapshot-strip > div:last-child {
  border-right: 0;
}

.snapshot-strip span,
.snapshot-strip strong {
  display: block;
}

.snapshot-strip span {
  margin-bottom: 4px;
  overflow: hidden;
  color: #728094;
  font-size: 0.69rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.snapshot-strip strong {
  font-size: 0.98rem;
}

.option-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.option-card {
  position: relative;
  min-width: 0;
  min-height: 162px;
  padding: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.option-card::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  right: -34px;
  bottom: -44px;
  border-radius: 50%;
  background: rgba(102, 83, 184, 0.06);
}

.feature-card {
  border-color: rgba(8, 124, 100, 0.38);
  background: linear-gradient(145deg, #fff, #f1faf7);
}

.benefit-card.is-qualified {
  border-color: rgba(8, 124, 100, 0.42);
  background: var(--emerald-soft);
}

.benefit-card.is-caution {
  border-color: #f0c57d;
  background: var(--amber-soft);
}

.card-label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 13px;
  color: var(--purple);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.card-icon {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 0.75rem;
}

.option-card h3 {
  min-height: 34px;
  color: var(--ink-soft);
  font-size: 0.79rem;
  font-weight: 700;
  line-height: 1.35;
}

.card-value {
  margin: 8px 0 12px;
  color: var(--emerald);
  font-size: clamp(1.35rem, 2.2vw, 1.8rem);
  font-weight: 900;
  letter-spacing: -0.04em;
}

.card-metrics {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 13px;
  color: #6e7c8e;
  font-size: 0.72rem;
}

.card-metrics strong {
  color: var(--ink);
}

.card-metrics .metric-wide {
  flex-basis: 100%;
  font-weight: 750;
}

.table-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
}

.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.table-toolbar h3 {
  font-size: 0.94rem;
}

.table-toolbar p {
  margin: 3px 0 0;
  color: #748294;
  font-size: 0.72rem;
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.segmented-control button {
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #6c7a8b;
  font-size: 0.7rem;
  font-weight: 750;
}

.segmented-control button.is-active {
  background: var(--navy);
  color: #fff;
}

.table-scroll {
  max-height: 620px;
  overflow: auto;
  scrollbar-width: thin;
}

table {
  width: 100%;
  min-width: 1160px;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fb;
  color: #718093;
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-align: right;
  white-space: nowrap;
}

thead th:first-child,
thead th:nth-child(2),
tbody td:first-child,
tbody td:nth-child(2) {
  text-align: left;
}

tbody td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: #3f4e62;
  font-size: 0.76rem;
  text-align: right;
  white-space: nowrap;
}

tbody tr.option-row {
  cursor: pointer;
}

tbody tr.option-row:hover td,
tbody tr.option-row.is-selected td {
  background: #f3f8f7;
}

tbody tr.option-row.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--emerald);
}

.expand-button {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--purple);
  font-weight: 900;
}

.money-positive {
  color: var(--emerald);
  font-weight: 850;
}

.money-negative,
.money-credit {
  color: #c43d36;
  font-weight: 850;
}

.margin-value {
  color: #286edb;
  font-weight: 800;
}

.benefit-badge {
  display: inline-block;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 850;
}

.benefit-badge.is-pass {
  background: var(--emerald-soft);
  color: var(--emerald);
}

.benefit-badge.is-fail {
  background: var(--amber-soft);
  color: var(--amber);
}

.detail-row td {
  padding: 0;
  background: #fbfcfd;
  white-space: normal;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  padding: 12px 44px 15px;
}

.detail-grid > div {
  padding: 7px 14px;
  border-left: 1px solid var(--line-soft);
}

.detail-grid > div:nth-child(4n + 1) {
  border-left: 0;
}

.detail-grid span,
.detail-grid strong {
  display: block;
}

.detail-grid span {
  margin-bottom: 3px;
  color: #778599;
  font-size: 0.66rem;
}

.detail-grid strong {
  color: var(--ink);
  font-size: 0.76rem;
}

.calculation-note {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #eef2f5;
  color: #667588;
  font-size: 0.72rem;
  line-height: 1.5;
}

.calculation-note strong {
  flex: 0 0 auto;
  color: var(--ink);
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 320px minmax(0, 1fr);
  }

  .option-cards {
    grid-template-columns: 1fr 1fr;
  }

  .benefit-card {
    grid-column: 1 / -1;
  }

  .snapshot-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .snapshot-strip > div:nth-child(2) {
    border-right: 0;
  }

  .snapshot-strip > div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 860px) {
  .workspace {
    display: block;
  }

  .input-panel {
    position: static;
    max-height: none;
    margin-bottom: 18px;
  }

  .results-panel {
    padding: 18px;
  }

  .table-scroll {
    max-height: none;
  }
}

@media (max-width: 580px) {
  .app-header,
  .results-heading,
  .table-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .pricing-stamp {
    white-space: normal;
  }

  .workspace {
    padding: 14px 10px 28px;
  }

  .field-grid.two-up,
  .assumption-grid,
  .option-cards,
  .snapshot-strip {
    grid-template-columns: 1fr;
  }

  .benefit-card {
    grid-column: auto;
  }

  .snapshot-strip > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .snapshot-strip > div:last-child {
    border-bottom: 0;
  }

  .secondary-button {
    width: 100%;
  }

  .segmented-control {
    width: 100%;
  }

  .segmented-control button {
    flex: 1;
  }

  .calculation-note {
    display: block;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-header {
    min-height: auto;
    padding: 16px 24px;
    background: #fff;
    color: var(--ink);
    box-shadow: none;
    border-bottom: 2px solid var(--ink);
  }

  .eyebrow,
  .pricing-stamp,
  .input-panel,
  .secondary-button,
  .segmented-control,
  .expand-button,
  .detail-row,
  .calculation-note {
    display: none !important;
  }

  .workspace {
    display: block;
    width: 100%;
    padding: 18px 0;
  }

  .results-panel {
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .table-scroll {
    max-height: none;
    overflow: visible;
  }

  table {
    min-width: 0;
    font-size: 8pt;
  }

  tbody td,
  thead th {
    padding: 6px 4px;
  }
}
