:root {
  color-scheme: light;
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-muted: #edf4f6;
  --ink: #202431;
  --muted: #626b7a;
  --line: #dce2e0;
  --forest: #143322;
  --teal: #158f84;
  --teal-dark: #0f6f67;
  --mint: #b7ead9;
  --lime: #72c85e;
  --gold: #f1c232;
  --coral: #e86f5b;
  --violet: #3d356d;
  --shadow: 0 24px 70px rgba(22, 37, 31, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(21, 143, 132, 0.08), transparent 32%),
    linear-gradient(315deg, rgba(232, 111, 91, 0.08), transparent 34%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 440px);
  gap: 24px;
  align-items: stretch;
  min-height: 208px;
  margin-bottom: 24px;
  color: #fff;
  background:
    linear-gradient(115deg, rgba(20, 51, 34, 0.94), rgba(20, 51, 34, 0.86)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 84px);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(28px, 5vw, 54px);
}

.eyebrow,
.section-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.4rem, 5vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.hero-text {
  max-width: 720px;
  margin-bottom: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: clamp(1rem, 1.5vw, 1.22rem);
  line-height: 1.75;
}

.risk-note {
  display: flex;
  align-items: end;
  gap: 14px;
  padding: clamp(22px, 4vw, 42px);
  background:
    linear-gradient(180deg, rgba(61, 53, 109, 0.9), rgba(21, 143, 132, 0.72)),
    linear-gradient(45deg, transparent 0 68%, rgba(255, 255, 255, 0.15) 68% 100%);
}

.risk-note p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 650;
  line-height: 1.55;
}

.risk-icon {
  display: grid;
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.control-panel,
.result-panel,
.chart-card {
  border: 1px solid rgba(220, 226, 224, 0.9);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.control-panel {
  position: sticky;
  top: 24px;
  padding: 24px;
}

.panel-header,
.result-header,
.chart-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
  line-height: 1.2;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--forest);
  font-size: 1.35rem;
  font-weight: 800;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background-color 160ms ease;
}

.icon-button:hover {
  transform: translateY(-1px);
  border-color: var(--teal);
  background: var(--surface-muted);
}

.scenario-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 24px 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8faf9;
}

.scenario-button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  transition:
    background-color 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease;
}

.scenario-button.is-active {
  background: var(--forest);
  color: #fff;
  box-shadow: 0 10px 20px rgba(20, 51, 34, 0.16);
}

.input-grid {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, #fbfcfb);
}

.field-title {
  font-size: 1rem;
  font-weight: 850;
}

.field-help {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.input-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 92px;
  gap: 12px;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  height: 6px;
  accent-color: var(--teal);
}

.value-pill {
  display: grid;
  min-height: 40px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--gold);
  color: #1e281d;
  font-weight: 900;
}

.amount-input {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.amount-input span {
  display: grid;
  height: 100%;
  place-items: center;
  background: var(--surface-muted);
  color: var(--teal-dark);
  font-weight: 900;
}

.amount-input input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 12px 14px;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
  outline: none;
}

.amount-input:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(21, 143, 132, 0.12);
}

.result-panel {
  padding: 24px;
}

.projection-copy {
  margin: 0;
  align-self: center;
  color: var(--muted);
  font-weight: 750;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 24px 0;
}

.metric-card {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.metric-card-primary {
  background: linear-gradient(135deg, var(--forest), var(--teal-dark));
  color: #fff;
  border-color: transparent;
}

.metric-label {
  display: block;
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.metric-card-primary .metric-label {
  color: rgba(255, 255, 255, 0.76);
}

.metric-card strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: clamp(1.25rem, 2.4vw, 2rem);
  line-height: 1.05;
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(380px, 1.15fr);
  gap: 16px;
}

.chart-card {
  min-width: 0;
  padding: 20px;
  box-shadow: none;
}

.chart-card h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

.chart-topline span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-align: right;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: end;
  min-height: 330px;
  margin-top: 22px;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
}

.bar-item {
  display: grid;
  grid-template-rows: minmax(220px, 1fr) auto;
  gap: 12px;
  min-width: 0;
}

.bar-track {
  position: relative;
  display: flex;
  align-items: end;
  justify-content: center;
  min-height: 220px;
  border-bottom: 1px solid #a9b1ad;
}

.bar-fill {
  position: relative;
  width: min(74px, 72%);
  min-height: 10px;
  border-radius: 7px 7px 2px 2px;
  background: var(--mint);
  transition: height 180ms ease;
}

.bar-item:nth-child(2) .bar-fill {
  background: #9ee3a7;
}

.bar-item:nth-child(3) .bar-fill {
  background: var(--lime);
}

.bar-value {
  position: absolute;
  inset: 14px 6px auto;
  color: #102018;
  font-weight: 950;
  text-align: center;
  overflow-wrap: anywhere;
}

.bar-label {
  min-height: 44px;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 850;
  line-height: 1.25;
  text-align: center;
}

.line-chart {
  min-height: 330px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.line-chart svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 300px;
  overflow: visible;
}

.grid-line {
  stroke: #dfe5e3;
  stroke-width: 1;
}

.axis-text {
  fill: #626b7a;
  font-size: 13px;
  font-weight: 700;
}

.area-path {
  fill: rgba(21, 143, 132, 0.13);
}

.line-path {
  fill: none;
  stroke: var(--teal);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.point {
  fill: #fff;
  stroke: var(--teal-dark);
  stroke-width: 4;
}

.point-label {
  fill: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

@media (max-width: 1120px) {
  .workspace,
  .chart-layout {
    grid-template-columns: 1fr;
  }

  .control-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 24px, 1480px);
    padding-top: 12px;
  }

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

  .hero-copy,
  .risk-note {
    padding: 24px;
  }

  .metric-grid,
  .bar-chart {
    grid-template-columns: 1fr;
  }

  .bar-chart {
    min-height: auto;
  }

  .bar-item {
    grid-template-columns: minmax(88px, 1fr) 130px;
    grid-template-rows: 1fr;
    align-items: center;
  }

  .bar-track {
    min-height: 68px;
    justify-content: start;
    border-bottom: 0;
  }

  .bar-fill {
    width: var(--bar-width, 40%);
    height: 52px !important;
    min-width: 78px;
    border-radius: 7px;
  }

  .bar-value {
    inset: 15px 10px auto;
    text-align: left;
    white-space: nowrap;
  }

  .bar-label {
    min-height: auto;
    text-align: left;
  }

  .line-chart {
    min-height: 260px;
  }

  .line-chart svg {
    width: 100%;
    min-width: 0;
    min-height: 240px;
  }
}

@media (max-width: 520px) {
  .control-panel,
  .result-panel,
  .chart-card {
    padding: 16px;
  }

  h1 {
    font-size: 2.35rem;
  }

  .panel-header,
  .result-header,
  .chart-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .projection-copy,
  .chart-topline span {
    text-align: left;
  }

  .input-row {
    grid-template-columns: 1fr;
  }

  .value-pill {
    min-height: 38px;
  }

  .scenario-button {
    font-size: 0.92rem;
  }
}
