#map {
  width: 100%;
  height: 700px;
  background: #0f172a;
}

/* Mode + source toggle */
#modeToggle {
  display: inline-flex;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  overflow: hidden;
}
#modeToggle .mode-btn {
  background: transparent;
  color: #cbd5e1;
  border: none;
  padding: 4px 12px;
  font-size: 13px;
  cursor: pointer;
}
#modeToggle .mode-btn.active {
  background: #1e40af;
  color: #fff;
}

/* Field popup styling */
.field-popup-leaflet .leaflet-popup-content-wrapper {
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 6px;
  padding: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
.field-popup-leaflet .leaflet-popup-tip {
  background: #0f172a !important;
}
.field-popup-leaflet .leaflet-popup-close-button {
  color: #94a3b8 !important;
  font-size: 18px !important;
  padding: 4px 6px 0 0 !important;
}
.field-popup-leaflet .leaflet-popup-content {
  margin: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
  font-family: 'Inter', system-ui, sans-serif;
  color: #e2e8f0;
}

.field-popup .fp-head {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: #f1f5f9;
}
.field-popup .fp-crop-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 500;
  font-size: 12px;
  color: #0f172a;
  margin-left: 4px;
}
.field-popup .fp-sub {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.field-popup .fp-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.field-popup .fp-table th,
.field-popup .fp-table td {
  padding: 4px 8px;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.field-popup .fp-table th {
  text-align: left;
  font-weight: 500;
  color: #94a3b8;
  width: 110px;
}
.field-popup .fp-table td.num {
  text-align: right;
  color: #e2e8f0;
}
.field-popup .fp-table td.primary {
  font-weight: 600;
  color: #4ade80;
  font-size: 14px;
}
.field-popup .fp-table td.pos { color: #4ade80; }
.field-popup .fp-table td.neg { color: #f87171; }

.map-legend {
  background: rgba(15, 23, 42, 0.94);
  padding: 10px 14px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.12);
  color: #e2e8f0;
  font-size: 12px;
  min-width: 240px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.map-legend .legend-title {
  color: #94a3b8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 500;
  margin-bottom: 4px;
}

.legend-card p { color: #cbd5e1; line-height: 1.5; }

/* Basemap toggle (top-right of map) */
.basemap-toggle {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.4);
}
.basemap-toggle .bm-btn {
  background: transparent;
  color: #cbd5e1;
  border: none;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.basemap-toggle .bm-btn.active {
  background: #1e40af;
  color: #fff;
}

/* Field popup mini history chart */
.fp-history-block {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.fp-history-title {
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.fp-history-chart {
  width: 100%;
  height: 70px;
  display: block;
}
.fp-history-crops {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 2px;
  margin-top: 4px;
}
.fp-history-crops .hc-cell {
  text-align: center;
  font-size: 9px;
  line-height: 1.2;
  padding: 2px 0 3px;
  border-radius: 2px;
  color: #0f172a;
  font-weight: 600;
}
.fp-history-crops .hc-cell.empty {
  background: rgba(255,255,255,0.04);
  color: #475569;
}
.fp-history-crops .hc-year {
  font-size: 8px;
  color: #64748b;
  margin-top: 1px;
  text-align: center;
}
