:root {
  --bg: #f4f5f2;
  --surface: #fbfbf8;
  --surface-soft: #eef1ee;
  --ink: #15171c;
  --muted: #67716e;
  --line: #d6dbd4;
  --gain: #008c72;
  --gain-strong: #006b58;
  --loss: #d14d72;
  --loss-strong: #ad2f55;
  --accent: #b98214;
  --shadow: 0 18px 46px rgba(21, 23, 28, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(21, 23, 28, 0.04) 1px, transparent 1px),
    linear-gradient(0deg, rgba(21, 23, 28, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui,
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.hero,
.metric-grid,
.panel,
.status-banner,
.site-footer {
  background: rgba(251, 251, 248, 0.97);
  border: 1px solid var(--line);
  border-radius: 6px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.hero {
  min-height: 280px;
  padding: 30px;
  border-top: 4px solid var(--ink);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  align-items: end;
  gap: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 780px;
  font-size: 58px;
  line-height: 1.04;
  font-weight: 780;
}

h2 {
  font-size: 20px;
}

.subhead {
  max-width: 680px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.7;
}

.hero-market {
  min-height: 172px;
  padding: 22px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  align-content: space-between;
}

.hero-market span,
.hero-market small,
.metric span,
.field span,
.dca-result span,
.panel-heading > span,
.roadmap span {
  color: var(--muted);
  font-size: 13px;
}

.hero-market strong {
  font-size: 44px;
  font-family: Consolas, "Cascadia Mono", monospace;
}

.hero-market small {
  font-size: 18px;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
}

.status-banner {
  padding: 14px 16px;
  color: var(--muted);
  line-height: 1.6;
}

.status-banner.warning {
  border-color: rgba(185, 130, 20, 0.45);
  background: rgba(185, 130, 20, 0.08);
  color: #6f500d;
}

.status-banner.error {
  border-color: rgba(209, 77, 114, 0.35);
  background: rgba(209, 77, 114, 0.08);
  color: var(--loss-strong);
}

.metric {
  min-height: 104px;
  padding: 20px;
  border-right: 1px solid var(--line);
  display: grid;
  align-content: space-between;
  gap: 14px;
}

.metric:last-child {
  border-right: 0;
}

.metric strong,
.dca-result strong {
  font-size: 24px;
  line-height: 1.1;
  font-family: Consolas, "Cascadia Mono", "Microsoft YaHei UI", monospace;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 18px;
  min-width: 0;
}

.content-grid > * {
  min-width: 0;
}

.panel {
  padding: 20px;
}

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

button,
input,
select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}

button {
  padding: 0 15px;
  cursor: pointer;
  font-weight: 750;
}

button:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

input,
select {
  width: 100%;
  padding: 0 12px;
}

.brief-list {
  display: grid;
  gap: 10px;
}

.brief-item {
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  grid-template-columns: 150px minmax(120px, 170px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.brief-item span {
  color: var(--muted);
  font-size: 13px;
}

.brief-item strong {
  font-size: 18px;
}

.brief-item p {
  color: var(--ink);
  line-height: 1.6;
}

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

.field {
  display: grid;
  gap: 7px;
}

.dca-result {
  margin-top: 18px;
  display: grid;
  gap: 12px;
}

.dca-result div {
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  gap: 8px;
}

.heatmap-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.heatmap {
  min-width: 1068px;
}

.heatmap th,
.heatmap td {
  border: 1px solid var(--line);
  min-width: 82px;
  height: 52px;
  padding: 8px;
  text-align: center;
  font-size: 13px;
}

.heatmap th {
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 750;
}

.heatmap .year-cell {
  color: var(--ink);
  font-weight: 800;
}

.year-label,
.year-cell span {
  display: block;
  line-height: 1.2;
}

.year-cell span:last-child {
  margin-top: 4px;
  font-size: 12px;
}

.month-cell {
  color: #fff;
  font-family: Consolas, "Cascadia Mono", "Microsoft YaHei UI", monospace;
  font-weight: 800;
}

.month-cell.flat {
  color: var(--ink);
}

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

.roadmap div {
  min-height: 124px;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 5px;
  display: grid;
  align-content: start;
  gap: 10px;
}

.roadmap strong {
  font-size: 18px;
}

.roadmap span {
  line-height: 1.55;
}

.site-footer {
  padding: 18px 20px;
  display: grid;
  gap: 8px;
}

.site-footer strong {
  font-size: 14px;
}

.site-footer span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.positive {
  color: var(--gain-strong);
  font-weight: 800;
}

.negative {
  color: var(--loss-strong);
  font-weight: 800;
}

.neutral {
  color: var(--muted);
  font-weight: 800;
}

.loading,
.error {
  padding: 18px;
  color: var(--muted);
}

.error {
  color: var(--loss-strong);
}

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

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

  .hero {
    min-height: auto;
  }

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

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

  .brief-item,
  .roadmap,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 10px;
    gap: 12px;
  }

  .hero,
  .panel,
  .site-footer {
    padding: 16px;
  }

  .hero {
    gap: 16px;
  }

  h1 {
    font-size: 34px;
    line-height: 1.08;
  }

  h2 {
    font-size: 18px;
  }

  .subhead {
    margin-top: 12px;
    font-size: 15px;
    line-height: 1.6;
  }

  .hero-market {
    min-height: 136px;
    padding: 16px;
  }

  .hero-market strong {
    font-size: 38px;
    overflow-wrap: anywhere;
  }

  .hero-market span {
    line-height: 1.45;
  }

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

  .metric {
    min-height: 82px;
    padding: 16px;
    border-right: 0;
  }

  .metric strong,
  .dca-result strong {
    font-size: 22px;
    overflow-wrap: anywhere;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 14px;
  }

  .panel-heading button {
    width: 100%;
  }

  .brief-item {
    padding: 14px;
    gap: 8px;
  }

  .brief-item strong {
    font-size: 17px;
  }

  .brief-item p {
    line-height: 1.55;
  }

  .heatmap-wrap {
    margin-inline: -16px;
    padding-inline: 16px;
  }

  .heatmap th,
  .heatmap td {
    min-width: 76px;
    height: 48px;
    padding: 7px;
    font-size: 12px;
  }

  .roadmap div {
    min-height: auto;
  }
}
