:root {
  --bg: #eef3ef;
  --surface: #fffdfa;
  --surface-soft: #f7faf6;
  --line: #d7ddd5;
  --line-strong: #bdc9c1;
  --text: #172623;
  --muted: #62706a;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --blue: #50799c;
  --cinnabar: #b64d55;
  --gold: #b88a44;
  --amber: #b45309;
  --red: #b42318;
  --green: #2f855a;
  --focus: #2563eb;
  --shadow: 0 18px 42px rgba(31, 45, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #f8faf6 0, #eef3ef 360px, #f7faf6 100%);
  color: var(--text);
  font-family: Arial, "Microsoft YaHei", "Heiti SC", sans-serif;
  line-height: 1.5;
}

.landing-page {
  min-height: 100vh;
  padding: 28px;
  background:
    linear-gradient(115deg, rgba(15, 118, 110, 0.12), transparent 42%),
    radial-gradient(circle at 86% 18%, rgba(184, 138, 68, 0.18), transparent 28%),
    #f8faf6;
}

.landing-shell {
  display: flex;
  min-height: calc(100vh - 56px);
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 250, 0.92), rgba(247, 250, 246, 0.92)),
    var(--surface);
  box-shadow: var(--shadow);
}

.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
}

.landing-nav strong {
  font-size: 18px;
  letter-spacing: 0;
}

.landing-copy {
  width: min(860px, 100%);
  margin: auto;
  padding: 58px min(7vw, 92px) 68px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
}

.landing-copy h1 {
  margin: 0;
  font-size: clamp(36px, 6vw, 66px);
  line-height: 1.04;
  letter-spacing: 0;
}

.landing-copy p {
  max-width: 760px;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 17px;
}

.landing-boundary {
  color: #44534e !important;
}

.landing-boundary.secondary {
  margin-top: 10px;
  font-size: 14px;
}

.landing-features {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}

.landing-features span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fffefb;
  color: var(--text);
  padding: 7px 12px;
  font-size: 13px;
}

.enter-button {
  margin-top: 34px;
  min-width: 120px;
  padding: 13px 22px;
  font-size: 16px;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 32px 18px;
  border-top: 4px solid var(--teal);
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.07), transparent 34%),
    var(--surface);
}

.topbar h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.segmented {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  min-width: 64px;
  padding: 8px 10px;
  cursor: pointer;
}

.segmented button.active {
  background: var(--teal);
  color: #fff;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: min(1540px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 30px;
}

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

.predictor-panel,
.result-panel {
  padding: 22px;
}

.result-panel {
  order: 3;
}

.batch-panel {
  order: 2;
  padding: 20px 22px;
}

.predictor-panel {
  order: 1;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-heading h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: 0;
}

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

.form-section {
  min-width: 0;
}

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

.compound-section {
  order: 1;
}

.task-section {
  order: 2;
  margin: 2px -6px 0;
  padding: 16px 16px 18px;
  border: 1px solid rgba(15, 118, 110, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(15, 118, 110, 0.08), rgba(184, 138, 68, 0.06)),
    #fbfcfa;
}

.species-section {
  order: 3;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.form-section-title span {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(15, 118, 110, 0.22);
  border-radius: 50%;
  background: #eef8f5;
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.form-section-title h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  letter-spacing: 0;
}

.form-section-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px 16px;
}

.task-grid {
  align-items: end;
}

.field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

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

.field-hint {
  color: var(--muted);
  font-size: 12px;
}

.inline-note,
.result-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.result-note {
  margin: -8px 0 18px;
  padding-left: 10px;
  border-left: 3px solid rgba(15, 118, 110, 0.35);
}

.span-2 {
  grid-column: span 2;
}

.span-4 {
  grid-column: 1 / -1;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffefb;
  color: var(--text);
  padding: 9px 11px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

textarea {
  resize: vertical;
  min-height: 92px;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
  background: #fff;
}

button,
.section-heading a {
  border: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, var(--teal), var(--teal-dark));
  color: #fff;
  padding: 10px 15px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 7px 18px rgba(15, 118, 110, 0.18);
}

button:hover,
.section-heading a:hover {
  background: var(--teal-dark);
}

.search-row,
.batch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

#speciesMatches {
  min-height: 112px;
}

.badge {
  display: inline-flex;
  min-width: 72px;
  justify-content: center;
  border-radius: 999px;
  background: #edf2f0;
  color: var(--muted);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge.high {
  background: #dff3e8;
  color: var(--green);
}

.badge.medium {
  background: #fff0d5;
  color: var(--amber);
}

.badge.low {
  background: #ffe4e0;
  color: var(--red);
}

.empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
}

.hidden {
  display: none !important;
}

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

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

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 13px;
}

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

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 19px;
  overflow-wrap: anywhere;
}

.metric small {
  display: none;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.distance-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.distance-grid div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
}

progress {
  width: 100%;
  height: 12px;
  accent-color: var(--teal);
}

.chart-panel {
  margin: 2px 0 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

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

.chart-heading h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0;
}

.chart-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.chart-heading span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.chart-wrap {
  position: relative;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.chart-panel .result-note {
  margin: 10px 0 0;
}

#taskPlotCanvas {
  display: block;
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: var(--surface-soft);
}

.details {
  margin: 0;
}

.details div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}

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

.details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.table-wrap {
  width: 100%;
  margin-top: 14px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 11px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.errors {
  margin: 14px 0 0;
  overflow: auto;
  border: 1px solid #ffd6d0;
  border-radius: 8px;
  background: #fff6f4;
  color: var(--red);
  padding: 10px;
}

@media (max-width: 980px) {
  .workspace,
  .form-grid,
  .form-section-grid {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-4,
  .batch-panel {
    grid-column: auto;
  }

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

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

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

  .topbar,
  .section-heading,
  .search-row,
  .batch-row {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .landing-page {
    padding: 12px;
  }

  .landing-shell {
    min-height: calc(100vh - 24px);
  }

  .landing-copy {
    padding: 40px 22px 48px;
  }

  .landing-copy p {
    font-size: 15px;
  }
}
