:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-soft: #eef4f0;
  --ink: #18201c;
  --muted: #657268;
  --line: #d9e2db;
  --green: #176b52;
  --green-soft: #dff0e7;
  --blue: #285c8f;
  --coral: #b4583d;
  --yellow: #f3d27b;
  --shadow: 0 18px 50px rgba(29, 45, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

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

.product-highlights article {
  min-height: 132px;
  padding: 16px;
  border: 1px solid #b8d7c8;
  border-radius: 8px;
  background: #f8fcfa;
  box-shadow: 0 12px 30px rgba(29, 45, 38, 0.06);
}

.product-highlights strong {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 16px;
}

.product-highlights p {
  margin-bottom: 0;
  color: #315d4d;
  font-size: 14px;
  line-height: 1.65;
}

.scope-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid #b8d7c8;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
}

.scope-strip span {
  color: #315d4d;
  line-height: 1.6;
}

.scope-strip {
  border-color: #ead28b;
  background: #fff7df;
  color: #6b520f;
}

.scope-strip span {
  color: #6b520f;
}

.eyebrow,
.step-label {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 8px;
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

p {
  line-height: 1.7;
}

.privacy-badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill[data-state="loading"] {
  background: #e8eff8;
  color: var(--blue);
}

.status-pill[data-state="success"] {
  background: var(--green-soft);
  color: var(--green);
}

.status-pill[data-state="warning"] {
  background: #fff2ca;
  color: #765200;
}

.status-pill[data-state="error"] {
  background: #f8e6df;
  color: var(--coral);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.guide-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  margin-bottom: 18px;
}

.guide-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.guide-link,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  background: #c7d1ca;
}

[hidden] {
  display: none !important;
}

input:disabled,
select:disabled {
  cursor: not-allowed;
  background: #eef2ef;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.upload-panel,
.profile-panel,
.result-panel,
.planner-panel {
  padding: 22px;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.file-drop {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  min-height: 132px;
  padding: 18px;
  border: 1px dashed #9ab5a8;
  border-radius: 8px;
  background: var(--surface-soft);
  cursor: pointer;
}

.file-drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: var(--yellow);
  color: #3c2f00;
  font-weight: 800;
}

.file-drop strong,
.file-drop small {
  display: block;
}

.file-drop small {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.5;
}

.parsed-summary {
  margin-top: 18px;
}

.metric-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.metric-list dt {
  color: var(--muted);
}

.metric-list dd {
  margin: 0;
  text-align: right;
  font-weight: 700;
}

.profile-form {
  display: grid;
  gap: 16px;
}

.scope-warning {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  padding: 14px;
  border-radius: 8px;
  background: #fff7df;
  color: #6b520f;
  line-height: 1.6;
}

.scope-warning {
  font-size: 14px;
}

.profile-form label,
fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

input[type="date"],
input[type="month"],
input[type="number"],
select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

fieldset {
  border: 0;
  padding: 0;
}

legend {
  padding: 0;
  margin-bottom: 8px;
}

.choice {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: start;
  color: var(--ink);
  line-height: 1.45;
}

.choice input {
  margin-top: 2px;
}

.error-text {
  margin: 14px 0 0;
  color: var(--coral);
  font-weight: 700;
}

.field-help {
  margin: -8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.result-panel {
  margin-top: 18px;
}

.planner-panel {
  margin-top: 18px;
}

.planner-intro {
  max-width: 760px;
  color: var(--muted);
}

.planner-section {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.subsection-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.subsection-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.compact-select {
  display: grid;
  min-width: 260px;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.assumption-grid,
.segment-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.assumption-grid label,
.segment-grid label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.assumption-grid small,
.segment-grid small {
  color: var(--muted);
  line-height: 1.45;
}

.assumption-sources {
  margin-top: 14px;
}

.assumption-sources details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.assumption-sources summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--green);
  font-weight: 700;
}

.source-section {
  padding: 0 14px 14px;
}

.source-section + .source-section {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.source-section h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.source-section ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.source-section li {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.source-section a {
  color: var(--blue);
}

.source-section span {
  display: block;
  margin-top: 2px;
}

.segment-grid .segment-wide {
  grid-column: 1 / -1;
}

.base-detail {
  max-width: 420px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.segment-warning {
  padding: 12px 14px;
  border: 1px solid #ead28b;
  border-radius: 8px;
  background: #fff7df;
  color: #6b520f;
  font-size: 14px;
  line-height: 1.6;
}

.timeline-editor {
  display: grid;
  gap: 12px;
}

.timeline-segment {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.segment-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ghost-button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.planner-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin: 16px 0;
}

.projection-placeholder {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--muted);
  line-height: 1.6;
}

.projection-result-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid #9bc8b4;
  border-top: 5px solid var(--green);
  border-radius: 8px;
  background: linear-gradient(180deg, #edf8f2 0%, #ffffff 38%);
  box-shadow: 0 18px 42px rgba(23, 107, 82, 0.14);
}

.projection-result-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.projection-result-heading h3 {
  margin-bottom: 4px;
  font-size: 18px;
  color: var(--green);
}

.projection-result-heading p {
  margin-bottom: 0;
  color: var(--muted);
}

.comparison-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.comparison-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: #fff;
}

.comparison-table th,
.comparison-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.comparison-table thead th {
  background: #dff0e7;
  color: #315d4d;
  font-size: 13px;
}

.comparison-table th small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
  white-space: normal;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.result-badge[data-state="success"] {
  background: var(--green-soft);
  color: var(--green);
}

.result-badge[data-state="danger"] {
  background: #f8e6df;
  color: var(--coral);
}

.comparison-table tbody tr:last-child th,
.comparison-table tbody tr:last-child td {
  border-bottom: 0;
}

.planning-analysis {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid #b8d7c8;
  border-radius: 8px;
  background: #f8fcfa;
}

.planning-analysis-heading {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
}

.planning-analysis-heading span {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.planning-analysis-heading strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.35;
}

.planning-analysis p {
  margin-bottom: 12px;
  color: #315d4d;
  line-height: 1.75;
}

.planning-analysis dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

.planning-analysis dl div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.planning-analysis dt {
  color: var(--muted);
  font-size: 12px;
}

.planning-analysis dd {
  margin: 6px 0 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.planning-analysis small {
  color: var(--muted);
  line-height: 1.5;
}

.assumption-note {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--muted);
}

.assumption-note summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.assumption-note-body {
  padding: 0 14px 14px;
}

.assumption-note p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.formula-box {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.formula-box ul {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 18px;
}

.formula-box li {
  color: var(--muted);
  line-height: 1.55;
}

.assumption-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.assumption-summary div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.assumption-summary dt {
  color: var(--muted);
  font-size: 12px;
}

.assumption-summary dd {
  margin: 6px 0 0;
  font-weight: 800;
}

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

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

.metric-card span,
.metric-card small {
  display: block;
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0;
  font-size: 24px;
  line-height: 1.15;
}

.result-block {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.result-block p {
  margin-bottom: 8px;
  color: var(--muted);
}

.eligibility-result {
  color: var(--ink) !important;
  font-weight: 700;
}

.result-note-details {
  margin-top: 8px;
}

.result-note-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.result-note,
.source-inline {
  font-size: 13px;
  line-height: 1.65;
}

.source-inline {
  margin-bottom: 0 !important;
}

.source-inline a {
  color: var(--blue);
}

.warning-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

@media (max-width: 860px) {
  .app-shell {
    padding: 18px;
  }

  .topbar,
  .guide-panel,
  .section-title-row,
  .scope-strip,
  .subsection-heading {
    flex-direction: column;
    align-items: stretch;
  }

  h1 {
    font-size: 28px;
  }

  .grid,
  .product-highlights,
  .result-grid,
  .assumption-grid,
  .assumption-summary,
  .planning-analysis dl,
  .segment-grid {
    grid-template-columns: 1fr;
  }

  .guide-link,
  button {
    width: 100%;
  }

  .planner-actions,
  .segment-heading {
    flex-direction: column;
  }
}
