/* Wheat Pest Prediction dashboard */
.wheat-pest-page {
  --pest-bg: #f4f6f5;
  --pest-card: #ffffff;
  --pest-text: #1b2631;
  --pest-muted: #5c6b7a;
  --pest-green: #2d6a4f;
  --pest-green-bright: #52b788;
  --pest-red: #c1121f;
  --pest-orange: #e76f51;
  --pest-yellow: #e9c46a;
  --pest-border: #e8ecea;
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--pest-text);
}

.wheat-pest-page__header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.wheat-pest-page__title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.35rem;
}

.wheat-pest-page__title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0;
}

.wheat-pest-page__title-icon {
  font-size: 1.35rem;
  line-height: 1;
  flex-shrink: 0;
}

.wheat-pest-page__subtitle {
  margin: 0;
  color: var(--pest-muted);
  font-size: 0.9rem;
}

.wheat-pest-page__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.wheat-pest-select {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--pest-border);
  border-radius: 6px;
  font-size: 0.82rem;
  background: #fff;
}

.wheat-pest-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.wheat-pest-badge--ai {
  background: #d8f3dc;
  color: var(--pest-green);
}

.wheat-pest-badge--danger {
  background: #fde8e8;
  color: var(--pest-red);
}

.wheat-pest-badge--high {
  background: #fde8e8;
  color: var(--pest-red);
}

.wheat-pest-badge--medium {
  background: #fff3e6;
  color: #e76f51;
}

.wheat-pest-badge--low {
  background: #d8f3dc;
  color: var(--pest-green);
}

.wheat-pest-map-panel {
  margin-bottom: 1.25rem;
}

.wheat-pest-legend-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 2px solid;
  opacity: 0.85;
}

/* KPI row: reuses corn-card--stat + frost-kpi progress (see corn-feasibility.css) */
.wheat-pest-page .wheat-pest-kpi-row.corn-kpi-row {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.wheat-pest-page .wheat-pest-kpi-row .corn-card--stat {
  box-shadow: 0 2px 8px rgba(27, 38, 49, 0.04);
}

.wheat-pest-kpi-emoji {
  display: block;
  font-size: 1.35rem;
  line-height: 1;
}

.wheat-pest-page .wheat-pest-kpi-row .corn-card__icon-wrap--rain {
  background: #e3f2fd;
  color: #2a6f97;
}

/* Status values: smaller text (frost-style); large numeral for pest count */
.wheat-pest-page .wheat-pest-kpi-row .wheat-pest-kpi-value--text {
  font-size: 1.05rem;
  line-height: 1.3;
}

.wheat-pest-page .wheat-pest-kpi-row .wheat-pest-kpi-value--count {
  font-size: 1.65rem;
  line-height: 1.1;
}

.wheat-pest-page .wheat-pest-kpi-row .corn-card__value--danger {
  color: #c1121f;
}

.wheat-pest-page .wheat-pest-kpi-row .corn-card__value--success {
  color: #2d6a4f;
}

.wheat-pest-kpi-trend-line {
  margin-top: 0.15rem;
}

.wheat-pest-kpi-trend--danger {
  color: var(--pest-red);
  font-weight: 700;
}

.wheat-pest-kpi-risk-line {
  margin-top: 0.15rem;
}

.wheat-pest-kpi-risk-level {
  display: inline;
  font-size: 0.78rem !important;
  font-weight: 800;
  line-height: inherit;
}

.wheat-pest-kpi-link {
  display: inline-block;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--pest-green);
  text-decoration: none;
}

.wheat-pest-kpi-link:hover {
  color: #1b4332;
  text-decoration: underline;
}

.wheat-pest-page .wheat-pest-kpi-row .frost-kpi-card__accuracy {
  margin-top: 0.55rem;
}

.wheat-pest-page .wheat-pest-kpi-row .frost-kpi-card__progress-fill {
  background: var(--pest-green-bright);
}

.wheat-pest-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.wheat-pest-main-grid__left,
.wheat-pest-main-grid__right {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.wheat-pest-card {
  background: var(--pest-card);
  border: 1px solid var(--pest-border);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
}

.wheat-pest-panel__title {
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 700;
}

.wheat-pest-card__head {
  margin-bottom: 0.5rem;
}

.wheat-pest-chart-wrap {
  position: relative;
  height: 280px;
}

.wheat-pest-risk-legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.65rem;
  font-size: 0.75rem;
  color: var(--pest-muted);
}

.wheat-pest-risk-legend__swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 2px;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.wheat-pest-risk-legend__swatch--low { background: #40916c; }
.wheat-pest-risk-legend__swatch--medium { background: #e9c46a; }
.wheat-pest-risk-legend__swatch--high { background: #c1121f; }

.wheat-pest-table-wrap {
  overflow-x: auto;
}

.wheat-pest-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.wheat-pest-table th,
.wheat-pest-table td {
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--pest-border);
  text-align: left;
}

.wheat-pest-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pest-muted);
}

.wheat-pest-table__pest {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
}

.wheat-pest-table__pest-icon {
  color: var(--pest-green);
}

.wheat-pest-table__trend {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: #457b9d;
}

.wheat-pest-sparkline {
  color: #457b9d;
}

.wheat-pest-table__trend-label {
  font-size: 0.75rem;
  color: var(--pest-muted);
  white-space: nowrap;
}

/* Key Drivers — single card, column dividers */
.wheat-pest-drivers__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.wheat-pest-drivers__header .wheat-pest-panel__title {
  margin: 0;
  flex: 1;
}

.wheat-pest-drivers__info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid #d5dde3;
  border-radius: 50%;
  background: #fff;
  color: #8a9ba8;
  font-size: 0.72rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.wheat-pest-drivers__info:hover {
  color: var(--pest-text);
  border-color: #b8c5ce;
}

.wheat-pest-drivers {
  list-style: none;
  margin: 0;
  padding: 0.15rem 0 0.25rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--pest-border);
}

.wheat-pest-drivers__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0.85rem 0.65rem 0.7rem;
  position: relative;
}

@media (min-width: 1101px) {
  .wheat-pest-drivers__item:not(:first-child)::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12%;
    bottom: 12%;
    width: 1px;
    background: var(--pest-border);
  }
}

.wheat-pest-drivers__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  margin-bottom: 0.45rem;
  flex-shrink: 0;
}

.wheat-pest-driver-icon-svg {
  display: block;
}

.wheat-pest-drivers__value {
  display: block;
  font-weight: 700;
  font-size: 0.84rem;
  line-height: 1.3;
  color: var(--pest-text);
}

.wheat-pest-drivers__label {
  display: block;
  font-size: 0.75rem;
  color: var(--pest-muted);
  margin-top: 0.15rem;
  line-height: 1.25;
}

.wheat-pest-drivers__delta {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

.wheat-pest-drivers__delta--up {
  color: #2d6a4f;
  font-weight: 600;
}

.wheat-pest-drivers__delta--down {
  color: #c1121f;
  font-weight: 600;
}

.wheat-pest-drivers__delta--neutral {
  color: var(--pest-muted);
  font-weight: 400;
}

.wheat-pest-actions {
  list-style: none;
  margin: 0;
  padding: 0;
}

.wheat-pest-actions__item {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  font-size: 0.84rem;
  color: var(--pest-muted);
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.wheat-pest-actions__icon {
  flex-shrink: 0;
  width: 1.35rem;
  font-size: 1.05rem;
  line-height: 1.35;
  text-align: center;
}

/* Recommended Action Window */
.wheat-pest-action-window {
  background: var(--pest-card);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
  color: var(--pest-text);
  border: 1px solid var(--pest-border);
}

.wheat-pest-action-window__head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.wheat-pest-action-window__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--pest-green);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
}

.wheat-pest-action-window__title {
  flex: 1;
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--pest-text);
}

.wheat-pest-action-window__info {
  border: 1px solid #d5dde3;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #8a9ba8;
  cursor: pointer;
  font-size: 0.72rem;
}

.wheat-pest-action-window__info:hover {
  color: var(--pest-text);
  border-color: #b8c5ce;
}

.wheat-pest-action-window__summary {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  background: #f8faf9;
  border: 1px solid var(--pest-border);
  border-radius: 10px;
  padding: 0.85rem 0.95rem;
  margin-bottom: 1rem;
}

.wheat-pest-action-window__target {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e8f5ef;
  color: var(--pest-green);
  font-size: 1.1rem;
  flex-shrink: 0;
}

.wheat-pest-action-window__eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.72rem;
  color: var(--pest-muted);
}

.wheat-pest-action-window__headline {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.15;
  color: var(--pest-text);
}

.wheat-pest-action-window__range {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--pest-muted);
}

.wheat-pest-action-window__timeline-labels {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.25rem;
  margin-bottom: 0.45rem;
}

.wheat-pest-action-window__day-label {
  display: block;
  font-size: 0.68rem;
  color: var(--pest-muted);
  text-align: center;
  line-height: 1.25;
}

.wheat-pest-action-window__day-label strong {
  display: block;
  color: var(--pest-text);
  font-size: 0.72rem;
}

.wheat-pest-action-window__track {
  position: relative;
  height: 34px;
  border: 1px dashed #d5dde3;
  border-radius: 999px;
  background: #eef1f0;
  overflow: hidden;
}

.wheat-pest-action-window__bar {
  position: relative;
  height: 100%;
  min-width: 42%;
  background: linear-gradient(90deg, #40916c 0%, #52b788 100%);
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wheat-pest-action-window__bar-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  padding: 0 0.5rem;
}

.wheat-pest-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
}

.wheat-pest-footer__meta {
  margin: 0;
  font-size: 0.78rem;
  color: var(--pest-muted);
}

.wheat-pest-footer__confidence {
  flex: 1 1 280px;
  max-width: 420px;
}

.wheat-pest-footer__confidence > span {
  display: block;
  font-size: 0.75rem;
  color: var(--pest-muted);
  margin-bottom: 0.35rem;
}

.wheat-pest-footer__confidence-bar {
  height: 8px;
  border-radius: 999px;
  background: #e8ecea;
  overflow: hidden;
}

.wheat-pest-footer__confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, #40916c, #52b788);
}

@media (max-width: 1100px) {
  .wheat-pest-page .wheat-pest-kpi-row.corn-kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wheat-pest-main-grid {
    grid-template-columns: 1fr;
  }

  .wheat-pest-drivers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    border-top: none;
  }

  .wheat-pest-drivers__item {
    border: 1px solid var(--pest-border);
    border-radius: 8px;
    padding: 0.85rem 0.5rem;
  }
}

@media (max-width: 768px) {
  .wheat-pest-page .wheat-pest-kpi-row.corn-kpi-row {
    grid-template-columns: 1fr;
  }

  .wheat-pest-drivers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wheat-pest-action-window__timeline-labels {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
