:root {
  --ink: #17251e;
  --muted: #6f7b73;
  --line: #dfe5df;
  --paper: #f3f5f1;
  --surface: #ffffff;
  --green: #19583e;
  --green-2: #267453;
  --mint: #dcebdd;
  --lime: #c7dc72;
  --amber: #e3a431;
  --red: #b8584e;
  --blue: #6c91a4;
  --shadow: 0 15px 45px rgba(26, 52, 38, 0.08);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

button, input, select { font: inherit; }
button { color: inherit; }

.topbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  height: 76px;
  justify-content: space-between;
  padding: 0 max(28px, calc((100vw - 1500px) / 2));
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(16px);
}

.brand {
  align-items: center;
  color: var(--ink);
  display: flex;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  align-items: center;
  background: var(--green);
  border-radius: 10px;
  color: white;
  display: flex;
  height: 40px;
  justify-content: center;
  width: 40px;
}

.brand-mark svg { height: 28px; width: 28px; }
.brand strong { display: block; font-size: 17px; letter-spacing: .08em; }
.brand small { color: #8a948d; display: block; font-size: 10px; letter-spacing: .18em; margin-top: 2px; }

.topbar-actions { align-items: center; display: flex; gap: 10px; }
.data-tag { align-items: center; color: var(--muted); display: flex; font-size: 12px; margin-right: 8px; }
.data-tag i { background: #62a36c; border-radius: 50%; box-shadow: 0 0 0 4px #e3efe4; height: 7px; margin-right: 9px; width: 7px; }

.button {
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  transition: .2s ease;
}

.button:hover { transform: translateY(-1px); }
.button.ghost { background: white; }
.button.primary { background: var(--green); border-color: var(--green); color: white; }

.app-shell { margin: 0 auto; max-width: 1500px; padding: 0 28px 70px; }

.hero {
  align-items: flex-end;
  display: flex;
  justify-content: space-between;
  min-height: 290px;
  padding: 55px 12px 48px;
}

.eyebrow, .step-label { color: var(--green-2); font-size: 10px; font-weight: 700; letter-spacing: .22em; }
.hero h1 { font-size: clamp(36px, 4.2vw, 60px); letter-spacing: -.055em; line-height: 1.1; margin: 14px 0 20px; }
.hero h1 em { color: var(--green); font-family: Georgia, "Songti SC", serif; font-weight: 500; }
.hero > div:first-child > p { color: var(--muted); font-size: 15px; line-height: 1.8; margin: 0; max-width: 680px; }

.hero-stat { display: flex; gap: 45px; padding-bottom: 5px; }
.hero-stat div { display: flex; flex-direction: column; }
.hero-stat strong { font-family: Georgia, serif; font-size: 32px; font-weight: 500; }
.hero-stat span { color: var(--muted); font-size: 11px; margin-top: 3px; }

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

.control-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  max-height: calc(100vh - 100px);
  overflow: auto;
  position: sticky;
  top: 90px;
}

.control-panel::-webkit-scrollbar { width: 6px; }
.control-panel::-webkit-scrollbar-thumb { background: #cbd3cc; border-radius: 10px; }

.panel-heading { align-items: center; display: flex; justify-content: space-between; padding: 24px 25px 18px; }
.sticky-title { background: rgba(255,255,255,.96); border-radius: 14px 14px 0 0; position: sticky; top: 0; z-index: 5; }
.panel-heading h2, .result-heading h2 { font-size: 22px; letter-spacing: -.02em; margin: 6px 0 0; }
.text-button { background: none; border: 0; color: var(--green-2); cursor: pointer; font-size: 12px; font-weight: 600; padding: 5px; }

.input-section { border-top: 1px solid var(--line); }
.section-toggle {
  align-items: center;
  background: white;
  border: 0;
  cursor: pointer;
  display: flex;
  font-size: 14px;
  font-weight: 600;
  justify-content: space-between;
  padding: 19px 25px;
  text-align: left;
  width: 100%;
}

.section-toggle span { align-items: center; display: flex; gap: 12px; }
.section-toggle b { color: #9aa39c; font-size: 10px; letter-spacing: .1em; }
.section-toggle i { color: #8c968f; font-size: 17px; font-style: normal; font-weight: 400; }
.section-body { display: none; padding: 0 25px 24px; }
.input-section.open .section-body { display: block; }

.field-grid { display: grid; gap: 14px 12px; grid-template-columns: 1fr 1fr; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; margin-bottom: 14px; }
.field > span { color: #435047; font-size: 11px; font-weight: 600; }
.field small { color: #939b95; font-size: 9px; font-weight: 400; }

.field input, .field select {
  appearance: none;
  background: #f8faf7;
  border: 1px solid #dce3dc;
  border-radius: 7px;
  color: var(--ink);
  height: 42px;
  outline: none;
  padding: 0 11px;
  transition: .18s ease;
  width: 100%;
}

.field select {
  background-image: linear-gradient(45deg, transparent 50%, #69766d 50%), linear-gradient(135deg, #69766d 50%, transparent 50%);
  background-position: calc(100% - 15px) 18px, calc(100% - 10px) 18px;
  background-repeat: no-repeat;
  background-size: 5px 5px, 5px 5px;
  padding-right: 28px;
}

.field input:focus, .field select:focus { background: white; border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(38,116,83,.08); }

.location-brief, .tech-brief {
  background: #f1f6f0;
  border-left: 3px solid var(--green-2);
  border-radius: 0 7px 7px 0;
  color: #536057;
  font-size: 11px;
  line-height: 1.65;
  margin-bottom: 17px;
  padding: 10px 12px;
}

.tech-brief { background: #f7f5ed; border-color: var(--amber); }
.brief-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.brief-tags span { background: white; border: 1px solid #e1e5df; border-radius: 3px; color: #667168; font-size: 9px; padding: 2px 5px; }
.inline-note { color: #8a938d; font-size: 10px; line-height: 1.6; margin: 14px 0 0; }

.results { min-width: 0; }
.assumption-banner {
  align-items: center;
  background: #edf4eb;
  border: 1px solid #d6e3d3;
  border-radius: 10px;
  color: #58675c;
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
  min-height: 50px;
  padding: 10px 14px;
}
.assumption-banner p { flex: 1; font-size: 11px; line-height: 1.55; margin: 0; }
.assumption-banner strong { color: var(--green); }
.assumption-banner button { background: none; border: 0; color: #8d998f; cursor: pointer; font-size: 20px; }
.info-icon { align-items: center; border: 1px solid #83a28c; border-radius: 50%; color: var(--green); display: flex; font-family: Georgia, serif; height: 20px; justify-content: center; width: 20px; }

.result-heading { align-items: end; display: flex; justify-content: space-between; margin: 0 2px 17px; }
.result-heading p { color: var(--muted); font-size: 12px; margin: 7px 0 0; }
.scenario-switch { background: #e8ece7; border-radius: 8px; display: flex; padding: 3px; }
.scenario-switch button { background: transparent; border: 0; border-radius: 6px; color: #727d75; cursor: pointer; font-size: 11px; padding: 7px 12px; }
.scenario-switch button.active { background: white; box-shadow: 0 2px 7px rgba(28,50,35,.1); color: var(--green); font-weight: 600; }

.kpi-grid { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.kpi-card { background: white; border: 1px solid var(--line); border-radius: 10px; min-height: 126px; padding: 18px 20px; }
.kpi-card.featured { background: var(--green); border-color: var(--green); color: white; }
.kpi-top { align-items: center; display: flex; justify-content: space-between; }
.kpi-top span { color: #6f7b73; font-size: 11px; }
.featured .kpi-top span { color: #c9ddd1; }
.kpi-card > strong { display: block; font-family: Georgia, "Noto Serif SC", serif; font-size: 30px; font-weight: 500; letter-spacing: -.03em; margin: 13px 0 4px; }
.kpi-card > small { color: #929b95; font-size: 10px; }
.featured > small { color: #b8d2c3; }
.health-dot { background: var(--lime); border-radius: 50%; height: 8px; width: 8px; }

.chart-grid { display: grid; gap: 12px; grid-template-columns: 1.65fr 1fr; margin-top: 12px; }
.chart-card, .comparison-card { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.card-heading { align-items: start; display: flex; justify-content: space-between; }
.card-heading h3 { font-size: 14px; margin: 0 0 5px; }
.card-heading p { color: #8c968f; font-size: 10px; margin: 0; }
.legend { align-items: center; color: #8d968f; display: flex; font-size: 9px; gap: 5px; }
.legend i { background: var(--green-2); border-radius: 2px; height: 7px; margin-left: 6px; width: 7px; }
.legend i:nth-child(2) { background: var(--amber); }

.chart { height: 235px; margin-top: 14px; position: relative; }
.chart svg { height: 100%; overflow: visible; width: 100%; }
.chart .grid-line { stroke: #e8ece7; stroke-width: 1; }
.chart .zero-line { stroke: #bfc8c0; }
.chart .axis-label { fill: #929b95; font-family: inherit; font-size: 9px; }
.chart .bar-positive { fill: #8bad97; }
.chart .bar-negative { fill: #cc8175; }
.chart .cash-line { fill: none; stroke: var(--amber); stroke-width: 2.5; }
.chart .cash-area { fill: url(#cashGradient); opacity: .22; }
.chart .line-point { fill: white; stroke: var(--amber); stroke-width: 2; }

.donut-layout { align-items: center; display: flex; gap: 24px; justify-content: center; min-height: 235px; padding-top: 10px; }
.donut { align-items: center; border-radius: 50%; display: flex; flex: 0 0 150px; height: 150px; justify-content: center; position: relative; width: 150px; }
.donut::after { background: white; border-radius: 50%; content: ""; inset: 22px; position: absolute; }
.donut > div { position: relative; text-align: center; z-index: 1; }
.donut strong { display: block; font-family: Georgia, serif; font-size: 20px; font-weight: 500; }
.donut span { color: #8d968f; font-size: 9px; }
.donut-legend { display: flex; flex-direction: column; gap: 12px; min-width: 120px; }
.donut-legend > div { display: grid; font-size: 10px; gap: 3px 7px; grid-template-columns: 8px 1fr auto; }
.donut-legend i { border-radius: 2px; height: 8px; margin-top: 2px; width: 8px; }
.donut-legend span { color: #7e8981; }
.donut-legend strong { font-size: 10px; }

.metric-strip { display: grid; gap: 1px; grid-template-columns: repeat(5, 1fr); margin: 12px 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--line); }
.metric-strip > div { background: white; padding: 14px 16px; }
.metric-strip span { color: #929a94; display: block; font-size: 9px; margin-bottom: 6px; }
.metric-strip strong { font-size: 14px; }

.comparison-card { margin-top: 12px; }
.table-hint { color: #8d968f; font-size: 9px; }
.table-wrap { margin: 14px -4px -4px; overflow-x: auto; }
table { border-collapse: collapse; min-width: 680px; width: 100%; }
th { color: #89938c; font-size: 9px; font-weight: 500; padding: 9px 10px; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
td { border-top: 1px solid #edf0ec; font-size: 11px; padding: 11px 10px; text-align: right; white-space: nowrap; }
tbody tr { cursor: pointer; transition: background .15s ease; }
tbody tr:hover { background: #f6f9f5; }
tbody tr.selected { background: #edf5ed; }
.tech-name { align-items: center; display: flex; font-weight: 600; gap: 8px; }
.tech-icon { align-items: center; background: var(--mint); border-radius: 5px; color: var(--green); display: inline-flex; font-size: 9px; height: 23px; justify-content: center; width: 23px; }
.fit-badge { background: #edf3ea; border-radius: 10px; color: var(--green-2); display: inline-block; font-size: 9px; padding: 3px 7px; }
.fit-badge.medium { background: #f6f0df; color: #98701f; }
.fit-badge.low { background: #f7e9e7; color: #a5574e; }

.lower-grid { display: grid; gap: 12px; grid-template-columns: 1.2fr 1fr; }
.ranking-list { display: flex; flex-direction: column; gap: 12px; margin-top: 18px; }
.ranking-item { align-items: center; display: grid; gap: 10px; grid-template-columns: 28px 55px 1fr 47px; }
.ranking-item > b { color: #9aa39c; font-family: Georgia, serif; font-size: 11px; }
.ranking-item > span { font-size: 11px; font-weight: 600; }
.ranking-bar { background: #edf0ec; border-radius: 4px; height: 7px; overflow: hidden; }
.ranking-bar i { background: linear-gradient(90deg, var(--green-2), #83ad79); border-radius: 4px; display: block; height: 100%; }
.ranking-item strong { font-size: 10px; text-align: right; }

.sensitivity-list { display: flex; flex-direction: column; gap: 10px; margin-top: 17px; }
.sensitivity-row { align-items: center; display: grid; gap: 8px; grid-template-columns: 80px 1fr 45px; }
.sensitivity-row > span { color: #667168; font-size: 10px; }
.sensitivity-track { display: flex; height: 9px; justify-content: center; }
.sensitivity-track i { display: block; height: 100%; }
.sensitivity-track i:first-child { background: #ca8378; border-radius: 3px 0 0 3px; }
.sensitivity-track i:last-child { background: #6b9a79; border-radius: 0 3px 3px 0; }
.sensitivity-row strong { font-size: 9px; text-align: right; }
.risk-note { background: #f7f5ed; border-radius: 6px; color: #736b55; font-size: 10px; line-height: 1.6; margin-top: 16px; padding: 10px 12px; }
.hidden { display: none; }
.cashflow-table-card tbody tr { cursor: default; }

footer { color: #8b948e; display: flex; font-size: 10px; justify-content: space-between; margin: 0 auto; max-width: 1500px; padding: 25px 28px 45px; }

.toast {
  background: #1c2d24;
  border-radius: 8px;
  bottom: 24px;
  color: white;
  font-size: 12px;
  left: 50%;
  opacity: 0;
  padding: 11px 18px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 15px);
  transition: .25s ease;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal-backdrop { align-items: center; background: rgba(20,33,25,.48); display: none; inset: 0; justify-content: center; padding: 24px; position: fixed; z-index: 40; }
.modal-backdrop.open { display: flex; }
.modal { background: white; border-radius: 14px; box-shadow: 0 24px 70px rgba(13,29,19,.28); max-height: 85vh; max-width: 950px; overflow: auto; padding: 25px; width: 100%; }
.modal-head { align-items: center; display: flex; justify-content: space-between; }
.modal-head h2 { font-size: 22px; margin: 6px 0 0; }
.modal-head button { background: #eef1ed; border: 0; border-radius: 50%; cursor: pointer; font-size: 21px; height: 34px; width: 34px; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 330px minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid { grid-template-columns: 1fr; }
  .hero-stat { display: none; }
  .metric-strip { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 820px) {
  .topbar { padding: 0 16px; }
  .data-tag, #saveScenario { display: none; }
  .app-shell { padding: 0 14px 50px; }
  .hero { min-height: 240px; padding: 42px 5px 36px; }
  .workspace { display: block; }
  .control-panel { max-height: none; position: static; }
  .results { margin-top: 28px; }
  .lower-grid { grid-template-columns: 1fr; }
  footer { display: block; padding-left: 18px; padding-right: 18px; }
}

@media (max-width: 560px) {
  .brand small { display: none; }
  .brand strong { font-size: 15px; }
  .button { padding: 9px 11px; }
  .hero h1 { font-size: 38px; }
  .hero h1 br { display: none; }
  .field-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card { min-height: 112px; padding: 15px; }
  .kpi-card > strong { font-size: 24px; }
  .result-heading { align-items: start; flex-direction: column; gap: 14px; }
  .scenario-switch { width: 100%; }
  .scenario-switch button { flex: 1; }
  .metric-strip { grid-template-columns: 1fr 1fr; }
  .donut-layout { gap: 14px; }
  .donut { flex-basis: 125px; height: 125px; width: 125px; }
  .donut::after { inset: 19px; }
  .legend { display: none; }
}

@media print {
  .topbar, .control-panel, .assumption-banner, footer, .button, .text-button, .scenario-switch { display: none !important; }
  body, .app-shell { background: white; }
  .hero { min-height: auto; padding: 20px 0; }
  .hero-stat { display: flex; }
  .workspace { display: block; }
  .comparison-card, .chart-card, .kpi-card { break-inside: avoid; }
}
