:root {
  --wine: #904042;
  --wine-deep: #6c3032;
  --wine-soft: rgba(255, 255, 255, 0.12);
  --rose: #dd6567;
  --gold: #f7b538;
  --sage: #9db4ab;
  --ink: #251d1f;
  --muted: #655b5a;
  --paper: #f7f1ed;
  --panel: #fffdfb;
  --panel-tint: #fff7f1;
  --line: rgba(37, 29, 31, 0.12);
  --shadow: 0 24px 60px rgba(63, 25, 27, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  color: var(--ink);
  font-family: "Roboto", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 28px;
  width: min(1640px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 28px 0;
}

.input-rail {
  min-height: calc(100vh - 56px);
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 46px 34px 30px;
  border-radius: 38px;
  background: linear-gradient(180deg, #7c3739 0%, #622c2e 100%);
  color: #fff8f3;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--wine);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Lora", Georgia, serif;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 2.5vw, 2.8rem);
  line-height: 1.05;
}

h2 {
  width: 100%;
  max-width: none;
  font-size: clamp(2rem, 3vw, 3.1rem);
  line-height: 1.05;
}

h3 {
  font-size: 1.35rem;
}

.controls {
  display: grid;
  gap: 22px;
}

.control-group {
  display: grid;
  gap: 10px;
  font-size: 0.95rem;
  line-height: 1.35;
}

.control-label {
  font-size: 1.05rem;
  font-weight: 700;
}

.with-help {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.help-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255, 248, 243, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff8f3;
  cursor: help;
  font-size: 0.95rem;
  font-weight: 700;
}

.help-popover {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  width: 220px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 248, 243, 0.22);
  border-radius: 14px;
  background: #fff8f3;
  color: var(--ink);
  box-shadow: 0 18px 38px rgba(20, 10, 10, 0.2);
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) translateX(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 5;
}

.help-tip:hover .help-popover,
.help-tip:focus-visible .help-popover {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.stepper {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 58px;
  align-items: stretch;
  min-height: 70px;
  border: 1px solid rgba(255, 248, 243, 0.16);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.11);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

.stepper-btn {
  border: 0;
  border-radius: 0;
  background: rgba(255, 255, 255, 0.04);
  color: #fff8f3;
  font-size: 1.8rem;
  font-weight: 700;
  padding: 0;
}

.stepper-btn:hover,
.stepper-btn:focus-visible {
  background: rgba(255, 255, 255, 0.12);
}

.controls input,
.controls select {
  width: 100%;
  min-height: 70px;
  border: 0;
  border-left: 1px solid rgba(255, 248, 243, 0.1);
  border-right: 1px solid rgba(255, 248, 243, 0.1);
  border-radius: 0;
  padding: 10px 12px;
  background: transparent;
  color: #fff8f3;
  outline: none;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
  appearance: textfield;
}

.controls select option {
  color: var(--ink);
}

.controls input::-webkit-outer-spin-button,
.controls input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.controls select {
  appearance: none;
  text-transform: capitalize;
  text-align-last: center;
}

.workspace {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.view-panel {
  border: 1px solid var(--line);
  border-radius: 32px;
  background: linear-gradient(180deg, var(--panel-tint) 0%, var(--panel) 100%);
  box-shadow: var(--shadow);
}

.intro {
  display: block;
  padding: 4px 0 2px;
}

.intro-plain {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.top-callout {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border: 1px solid rgba(144, 64, 66, 0.16);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff7f1 0%, #fffdfb 100%);
  color: var(--muted);
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.35;
}

.callout-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--wine);
  flex: 0 0 auto;
}

.title-copy {
  margin: 12px 0 0;
  max-width: 60rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
}

.panel-heading span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.view-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

.view-panel {
  min-width: 0;
  padding: 24px 26px;
}

.panel-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 8px;
}

.panel-heading-copy {
  width: 100%;
  max-width: none;
}

.panel-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
}

.panel-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

.growth-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.guaranteed-badge {
  border: 1px solid rgba(144, 64, 66, 0.18);
  background: rgba(144, 64, 66, 0.08);
  color: var(--wine);
}

.nonguaranteed-badge {
  border: 1px solid rgba(157, 180, 171, 0.28);
  background: rgba(157, 180, 171, 0.14);
  color: #58756b;
}

.panel-metric {
  margin-top: 2px;
  padding: 10px 14px;
  border: 1px solid rgba(144, 64, 66, 0.16);
  border-radius: 18px;
  background: rgba(144, 64, 66, 0.08);
  color: var(--wine-deep);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  text-align: right;
  white-space: nowrap;
  box-shadow: 0 10px 20px rgba(144, 64, 66, 0.08);
}

.panel-metric strong {
  color: var(--wine);
  font-size: 1.15em;
}

.chart-wrap,
.pending-chart {
  position: relative;
  display: flex;
  justify-content: center;
  min-height: 300px;
}

.chart-wrap svg,
.pending-chart svg {
  min-height: 286px;
  width: min(100%, 1080px);
}

svg {
  display: block;
  width: 100%;
  height: auto;
}

.line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 4;
  cursor: pointer;
}

.selected-line {
  stroke: var(--wine);
}

.hit-line {
  fill: none;
  stroke: transparent;
  stroke-width: 24;
  cursor: pointer;
}

.muted-line {
  stroke: rgba(139, 63, 67, 0.42);
  stroke-dasharray: 8 8;
}

.placeholder-line {
  fill: none;
  stroke: rgba(157, 180, 171, 0.9);
  stroke-dasharray: 8 8;
  stroke-linecap: round;
  stroke-width: 4;
}

.marker-line {
  stroke: rgba(32, 32, 32, 0.35);
  stroke-dasharray: 4 6;
  stroke-width: 2;
}

.dot {
  fill: var(--panel);
  stroke: var(--wine);
  stroke-width: 4;
}

.axis-text {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.axis-title {
  font-size: 12px;
}

.grid-line {
  stroke: rgba(37, 29, 31, 0.08);
  stroke-width: 1;
}

.year-band {
  fill: rgba(201, 149, 72, 0.13);
}

.growth-band {
  fill: rgba(142, 169, 109, 0.1);
}

.pending-copy {
  position: absolute;
  inset: auto 20px 22px;
  padding: 14px;
  border: 1px solid rgba(31, 111, 120, 0.18);
  border-radius: 8px;
  background: rgba(255, 253, 249, 0.92);
}

.pending-copy strong,
.pending-copy p {
  margin: 0;
}

.pending-copy p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

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

.legend i {
  width: 22px;
  height: 3px;
  border-radius: 99px;
}

.selected-swatch {
  background: var(--wine);
}

.muted-swatch {
  background: repeating-linear-gradient(90deg, rgba(139, 63, 67, 0.45) 0 7px, transparent 7px 11px);
}

.chart-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.chart-tooltip {
  position: absolute;
  width: min(240px, calc(100% - 24px));
  padding: 18px 22px;
  border: 1px solid rgba(144, 64, 66, 0.16);
  border-radius: 28px;
  background: rgba(255, 253, 251, 0.98);
  box-shadow: 0 18px 40px rgba(63, 25, 27, 0.16);
  pointer-events: none;
}

.chart-tooltip h4 {
  margin: 0 0 12px;
  color: var(--wine);
  font-family: "Lora", Georgia, serif;
  font-size: 1.1rem;
}

.chart-tooltip p {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.45;
}

.chart-tooltip p + p {
  margin-top: 4px;
}

.focus-ring {
  fill: #fffdfb;
}

.focus-dot {
  stroke: #fffdfb;
  stroke-width: 2;
}

.heirs-dot {
  fill: var(--sage);
}

.ltc-dot {
  fill: var(--wine);
}

.footnote {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .workspace {
    order: 1;
  }

  .input-rail {
    order: 2;
    min-height: auto;
  }

  .help-popover {
    left: 0;
    top: calc(100% + 10px);
    transform: translateY(0);
  }

  .help-tip:hover .help-popover,
  .help-tip:focus-visible .help-popover {
    transform: translateY(0);
  }

  .panel-heading {
    gap: 10px;
  }

  .panel-topline {
    display: grid;
  }

  .panel-metric {
    text-align: left;
    white-space: normal;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100vw - 18px, 720px);
    padding: 9px 0;
    gap: 14px;
  }

  .intro {
    padding: 12px 0 4px;
  }

  .stepper {
    grid-template-columns: 56px minmax(0, 1fr) 56px;
  }

  .input-rail {
    padding: 28px 22px 24px;
    border-radius: 28px;
  }

  .view-panel {
    padding: 20px 18px;
  }

  .top-callout {
    padding: 14px 18px;
    border-radius: 24px;
  }
}
