:root {
  --bg: #f4f9f1;
  --panel: #fffefa;
  --panel-2: #f6faf3;
  --line: rgba(92, 125, 94, 0.18);
  --text: #213326;
  --muted: #66776a;
  --green: #4f9460;
  --red: #c8645a;
  --amber: #c7952e;
  --blue: #4f84a8;
  --cyan: #3f9f91;
  --leaf-soft: #e6f2df;
  --cane-soft: #f3ead2;
  --sugar-shadow: rgba(57, 91, 61, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, #fbfdf8 0%, var(--bg) 46%, #edf7f4 100%);
  color: var(--text);
  font-family: "IBM Plex Sans", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  padding: 28px 22px;
  background: rgba(239, 248, 233, 0.92);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
  box-shadow: 10px 0 28px rgba(77, 105, 72, 0.08);
}

.brand span,
.kicker,
.eyebrow,
.rail-foot span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

nav {
  display: grid;
  gap: 8px;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 11px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
}

nav a:hover {
  color: var(--text);
  background: rgba(79, 148, 96, 0.11);
  border-color: var(--line);
}

.rail-foot {
  margin-top: auto;
  display: grid;
  gap: 6px;
}

.rail-foot strong,
strong {
  font-family: "IBM Plex Mono", monospace;
}

main {
  margin-left: 248px;
  padding: 28px;
}

.hero,
.panel {
  background: rgba(255, 254, 250, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 44px var(--sugar-shadow);
}

.hero {
  min-height: 210px;
  padding: 34px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  background:
    linear-gradient(135deg, rgba(255, 255, 252, 0.98), rgba(232, 244, 223, 0.94) 58%, rgba(245, 239, 220, 0.9));
}

h1,
h2 {
  margin: 0;
}

h1 {
  margin-top: 8px;
  font-size: 42px;
  line-height: 1.08;
}

h2 {
  margin-top: 5px;
  font-size: 20px;
}

.subtitle {
  max-width: 780px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.7;
}

.decision-strip {
  display: grid;
  grid-template-columns: 0.7fr 0.5fr minmax(320px, 1.8fr) 0.8fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.decision-strip article {
  min-width: 0;
  padding: 15px;
  background: rgba(255, 254, 250, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(70, 96, 67, 0.07);
}

.decision-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.decision-strip strong {
  display: block;
  margin-top: 7px;
  font-size: 16px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  color: #f8fff7;
  background: var(--cyan);
  padding: 10px 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(63, 159, 145, 0.2);
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.head-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.data-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--amber);
  background: rgba(199, 149, 46, 0.11);
  border: 1px solid rgba(199, 149, 46, 0.28);
  font-size: 12px;
  white-space: nowrap;
}

.data-chip.live {
  color: var(--green);
  background: rgba(79, 148, 96, 0.11);
  border-color: rgba(79, 148, 96, 0.28);
}

.data-chip.sample,
.data-chip.stale {
  color: var(--red);
  background: rgba(200, 100, 90, 0.11);
  border-color: rgba(200, 100, 90, 0.28);
}

.data-chip.protected {
  color: var(--cyan);
  background: rgba(63, 159, 145, 0.11);
  border-color: rgba(63, 159, 145, 0.28);
}

.data-chip.partial {
  color: var(--amber);
  background: rgba(199, 149, 46, 0.11);
  border-color: rgba(199, 149, 46, 0.28);
}

.status-grid,
.brazil-layout,
.module-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.8fr);
  gap: 18px;
  margin-top: 18px;
}

.weather-quant-panel {
  margin-top: 18px;
}

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

.quant-card {
  min-width: 0;
  padding: 15px;
  background: linear-gradient(180deg, #fffefa 0%, var(--panel-2) 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quant-card.dry {
  border-color: rgba(200, 100, 90, 0.32);
}

.quant-card.wet {
  border-color: rgba(79, 148, 96, 0.32);
}

.quant-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  min-height: 66px;
}

.quant-head h3 {
  margin: 0;
  font-size: 18px;
}

.quant-head p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.quant-signal {
  flex-shrink: 0;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--amber);
  background: rgba(199, 149, 46, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.quant-card.dry .quant-signal {
  color: var(--red);
  background: rgba(200, 100, 90, 0.12);
}

.quant-card.wet .quant-signal {
  color: var(--green);
  background: rgba(79, 148, 96, 0.12);
}

.quant-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.quant-metrics div {
  min-width: 0;
  padding: 10px;
  background: rgba(255, 255, 255, 0.66);
  border-left: 3px solid rgba(63, 159, 145, 0.44);
}

.quant-card.dry .quant-metrics div {
  border-left-color: rgba(200, 100, 90, 0.56);
}

.quant-card.wet .quant-metrics div {
  border-left-color: rgba(79, 148, 96, 0.56);
}

.quant-metrics .wide {
  grid-column: 1 / -1;
}

.quant-metrics span,
.quant-metrics em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.quant-metrics strong {
  display: block;
  margin: 4px 0;
  font-size: 21px;
}

.quant-copy {
  margin: 12px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.6;
}

.brazil-layout {
  grid-template-columns: 1fr;
}

.module-grid.slim {
  grid-template-columns: 1fr;
}

.module-grid.single {
  grid-template-columns: 1fr;
}

.panel {
  padding: 22px;
  min-width: 0;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--cyan);
  background: rgba(63, 159, 145, 0.11);
  border: 1px solid rgba(63, 159, 145, 0.28);
  font-size: 13px;
  white-space: nowrap;
}

.pill.hot {
  color: var(--amber);
  background: rgba(199, 149, 46, 0.11);
  border-color: rgba(199, 149, 46, 0.28);
}

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

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

.metric-row div,
.price-stack div {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.metric-row span,
.price-stack span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-row strong,
.price-stack strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

canvas {
  width: 100% !important;
  max-height: 270px;
}

.enso-guide {
  display: grid;
  grid-template-columns: minmax(180px, 0.45fr) minmax(260px, 1fr);
  gap: 10px;
  margin: -4px 0 14px;
}

.enso-current,
.enso-rule,
.chart-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.enso-current {
  padding: 12px;
  border-left: 4px solid var(--amber);
}

.enso-current.warm {
  border-left-color: var(--red);
}

.enso-current.cold {
  border-left-color: var(--blue);
}

.enso-current span,
.enso-current em,
.enso-rule span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.enso-current strong {
  display: block;
  margin: 5px 0;
  font-size: 24px;
}

.enso-rule {
  padding: 12px 14px;
}

.enso-rule p {
  margin: 5px 0 0;
  color: var(--text);
  line-height: 1.55;
}

#brazil .metric-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chart-duo {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.95fr);
  gap: 14px;
  align-items: stretch;
}

.chart-panel {
  min-width: 0;
  padding: 14px;
  background: rgba(247, 251, 244, 0.76);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chart-panel h3 {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.chart-toolbar {
  min-height: 38px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.chart-toolbar h3 {
  margin: 4px 0 0;
}

.segmented {
  flex-shrink: 0;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segmented button {
  min-height: 30px;
  padding: 0 9px;
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
}

.segmented button.active {
  color: var(--text);
  background: rgba(79, 148, 96, 0.14);
}

#brazil-chart {
  max-height: 420px;
}

#brazil-seasonal-chart {
  max-height: 420px;
}

.seasonality-block {
  margin-bottom: 14px;
}

.source-plan {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: -4px 0 16px;
}

.price-source-plan {
  margin-top: 0;
}

.source-plan div {
  min-width: 0;
  padding: 12px;
  background: rgba(247, 251, 244, 0.76);
  border: 1px solid var(--line);
  border-left: 3px solid rgba(199, 149, 46, 0.48);
  border-radius: 8px;
}

.source-plan span {
  display: block;
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
}

.source-plan p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

#india-chart {
  max-height: 340px;
}

.mini-chart-block {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.mini-chart-block h3 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.note {
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.strong-note {
  color: var(--text);
}

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

.weather-item {
  display: grid;
  grid-template-columns: 92px 74px 1fr;
  align-items: center;
  gap: 12px;
  padding: 13px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.weather-region {
  font-weight: 700;
}

.signal {
  text-align: center;
  border-radius: 999px;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 700;
}

.signal.利多 {
  color: var(--red);
  background: rgba(200, 100, 90, 0.12);
}

.signal.利空 {
  color: var(--green);
  background: rgba(79, 148, 96, 0.12);
}

.signal.中性,
.signal.待验证 {
  color: var(--amber);
  background: rgba(199, 149, 46, 0.12);
}

.signal.干旱 {
  color: var(--red);
  background: rgba(200, 100, 90, 0.12);
}

.signal.潮湿 {
  color: var(--green);
  background: rgba(79, 148, 96, 0.12);
}

.signal.正常 {
  color: var(--amber);
  background: rgba(199, 149, 46, 0.12);
}

.weather-copy span {
  display: block;
  color: var(--text);
  font-weight: 600;
}

.weather-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

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

.detail-card,
.history-card,
.driver-item,
.policy-item,
.source-row {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-card,
.history-card {
  padding: 15px;
}

.detail-card h3,
.history-card h3 {
  margin: 0;
  font-size: 17px;
}

.detail-card .subline,
.history-card .subline {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.history-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.history-head span {
  flex-shrink: 0;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--amber);
  background: rgba(199, 149, 46, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.history-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.history-card dt {
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}

.history-card dd {
  margin: -4px 0 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.history-lesson {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--text);
  font-weight: 600;
}

.weather-judgements {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}

.weather-judgements div {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.weather-judgements span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.weather-judgements strong {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.weather-image-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.weather-map {
  margin: 0;
}

.weather-map img {
  display: block;
  width: 100%;
  aspect-ratio: 1.18;
  object-fit: cover;
  background: #f4f8ef;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.weather-map figcaption {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.driver-list,
.policy-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.driver-item,
.policy-item {
  display: grid;
  grid-template-columns: 86px 76px 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.policy-item {
  grid-template-columns: 90px 120px 1fr;
}

.driver-state {
  text-align: center;
  padding: 5px 7px;
  border-radius: 999px;
  color: var(--amber);
  background: rgba(199, 149, 46, 0.12);
  font-size: 12px;
  font-weight: 700;
}

.driver-state.偏利多 {
  color: var(--red);
  background: rgba(200, 100, 90, 0.12);
}

.driver-state.利空 {
  color: var(--green);
  background: rgba(79, 148, 96, 0.12);
}

.driver-item p,
.policy-item p,
.history-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.price-stack {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.price-stack div {
  display: block;
  min-width: 0;
  border-left: 4px solid rgba(102, 119, 106, 0.2);
}

.price-stack div.ready {
  border-left-color: var(--green);
}

.price-stack div.pending {
  border-left-color: var(--amber);
}

.price-stack strong {
  display: block;
  margin-top: 6px;
  white-space: nowrap;
}

.price-stack em {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.price-stack div.pending strong {
  color: rgba(33, 51, 38, 0.42);
}

.chart-empty {
  margin: 8px 0 12px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.unlock {
  display: flex;
  gap: 8px;
}

input {
  width: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #fffefa;
  padding: 9px 10px;
}

.brief-text {
  margin: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.9;
}

.brief-text.locked {
  color: var(--muted);
}

.source-table {
  display: grid;
  gap: 8px;
}

.source-row {
  display: grid;
  grid-template-columns: 150px minmax(150px, 0.9fr) 118px 92px minmax(260px, 1.4fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
}

.source-row span {
  color: var(--muted);
}

.source-row p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.source-status {
  color: var(--amber);
}

.source-status.connected {
  color: var(--green);
}

.source-status.partial,
.source-status.located {
  color: var(--amber);
}

.source-status.pending {
  color: var(--red);
}

@media (max-width: 1180px) {
  .rail {
    position: static;
    width: auto;
    min-height: 0;
  }

  nav {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  main {
    margin-left: 0;
    padding: 16px;
  }

  .hero,
  .status-grid,
  .brazil-layout,
  .module-grid,
  .module-grid.slim,
  .decision-strip,
  .enso-guide,
  .quant-grid,
  .detail-grid,
  .history-grid,
  .chart-duo {
    grid-template-columns: 1fr;
  }

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

  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero-actions,
  .head-pills {
    flex-wrap: wrap;
  }

  .chart-toolbar {
    flex-direction: column;
  }

  h1 {
    font-size: 34px;
  }
}

@media (max-width: 620px) {
  .metric-row,
  .metric-row.four,
  #brazil .metric-row,
  .price-stack {
    grid-template-columns: 1fr;
  }

  .weather-item {
    grid-template-columns: 1fr;
  }

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

  .panel-head,
  .unlock {
    flex-direction: column;
    align-items: stretch;
  }

  .driver-item,
  .policy-item,
  .source-row {
    grid-template-columns: 1fr;
  }

  .quant-grid,
  .quant-metrics,
  .source-plan {
    grid-template-columns: 1fr;
  }

  .quant-metrics .wide {
    grid-column: auto;
  }

  input {
    width: 100%;
  }
}
